everest
everest copied to clipboard
Error: Could not find a type to de-serialize 'ClinicalDocument' into @ /urn:hl7-org:v3#ClinicalDocument
I'm using following code to parse the CCDA format .xml file in C#
var formatter = new XmlIts1Formatter();
// Add CDA data types
formatter.GraphAides.Add(new DatatypeFormatter() { CompatibilityMode = DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture });
// Disable validation
formatter.ValidateConformance = false;
// Open stream or data source
using (var s = System.IO.File.OpenRead(filePath))
{
var result = formatter.Parse(s, typeof(ClinicalDocument).Assembly);
var instance = result.Structure as ClinicalDocument;
// do whatever you like with the CDA
}
You need to add a reference to the CDA model types in Everest to your project. You may also need to force the parsing to use ClinicalDocument using the generic version of the Parse method.