This project has moved and is read-only. For the latest updates, please go here.

Multiple Race Codes in CDA

Apr 23, 2016 at 2:51 AM
Hello, was the Multiple Race Code issue ever fixed in the Everest Framework? I downloaded the latest version of the framework and the Patient Model doesn't appear to support multiple race codes. The issue was originally reported here:

Apr 23, 2016 at 12:21 PM
Did the posted solution on that forum not work?
Apr 23, 2016 at 7:37 PM
Yes, that did work, but I was interested in getting parsing to work. I was able to do it by overriding the Itsformatter ParseObject method so that it knows about the MyPatientMultipleRaceCodes type.

Your work with Sherpas looks interesting! Other than updating the models from a MIF, would we eventually be able to define a decor template to solve this type of issue?
Apr 23, 2016 at 7:40 PM
Try setting the AlwaysUseOverrides on the XmlIts1Formatter (introduced in 1.2.10) which should pick up that your implementation of patient is the default instance.
Apr 24, 2016 at 3:27 AM
Thanks for the help. I ended up debugging this and the issue was namespace related.

The source xml document, I was using had xmlns:cda specified. See the header below for an example.
<ClinicalDocument xmlns:xsi=""
 xsi:schemaLocation="urn:hl7-org:v3 ../../../CDA%20R2/cda-schemas-and-samples/infrastructure/cda/CDA.xsd"
<!-- Other stuff here  -->
In the XmlIts1Formatter.ParseObject method, the CreateXSITypeName call was returning "cda:POCD_MT000040UV.Patient" rather than "POCD_MT000040UV.Patient". I ended up registering the MyPatientMultipleRaceCodes under both namespaces. Does this sound like the correct thing to do? My test code looks something like this.
public void TestParse()
    string cda = System.IO.File.ReadAllText("SampleFiles/CCDA_CCD_b1_Ambulatory_v2.xml");

    XmlIts1Formatter fmtr = new XmlIts1Formatter();
    fmtr.GraphAides.Add(new ClinicalDocumentDatatypeFormatter());
    fmtr.RegisterXSITypeName("cda:POCD_MT000040UV.Patient", typeof(MyPatientMultipleRaceCodes));
    fmtr.RegisterXSITypeName("POCD_MT000040UV.Patient", typeof(MyPatientMultipleRaceCodes));
    fmtr.Settings |= SettingsType.SuppressNullEnforcement | SettingsType.AlwaysCheckForOverrides;
    fmtr.ValidateConformance = false;

    ClinicalDocument doc = null;

    using (XmlReader reader = XmlReader.Create(new StringReader(cda)))
        IFormatterParseResult result = fmtr.Parse(reader);
        doc = result.Structure as ClinicalDocument;

    var p = doc.RecordTarget[0].PatientRole.Patient as MyPatientMultipleRaceCodes;

    Assert.IsTrue(p != null);
Apr 24, 2016 at 7:39 AM
That is a temporary fix, however the formatter should pick up the prefix. I'll take a look at it this week and have a proper fix. There was another issue that we discovered regarding namespace prefixes in XSI:TYPE attributes. I'll see if I can correct this as well.
Apr 24, 2016 at 5:59 PM
Thanks again!