MohawkMEDIC / everest

The Everest Framework is designed to ease the creation, formatting, and transmission of HL7v3 and CDA structures with remote systems.
Apache License 2.0
38 stars 22 forks source link

Error: Could not find a type to de-serialize 'ClinicalDocument' into @ /urn:hl7-org:v3#ClinicalDocument #17

Open vinayaroratech opened 1 year ago

vinayaroratech commented 1 year ago

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
            }

image

justin-fyfe commented 1 year ago

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.