C-CDA Validator Indicates Elements Missing That Are Not Missing

181 views
Skip to first unread message

Michael Mall

unread,
Sep 18, 2023, 3:44:43 PM9/18/23
to Edge Test Tool (ETT)
https://site.healthit.gov/sandbox-ccda/ccda-validator

I am using the validator at https://site.healthit.gov/sandbox-ccda/ccda-validator.  Under "R2.1 2015 Edition", I select the options "Sender", "C-CDA_IG_Only", "No Scenario File".  When I validate, it identifies errors indicating items are missing that are not actually missing.

As an example, when I validate the attached file, the first two errors are below indicating the languageCommunication element is missing from the appropriate path and I either am missing the raceCode elment or have an incorrect value for raceCode.  But, I can't see what is actually wrong with either of these in the C-CDA file.  Follwing the IG at http://www.hl7.org/ccdasearch/templates/2.16.840.1.113883.10.20.22.1.1.html , I am using a code for raceCode that is from the Value Set at https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.2074.1.1.3/expansion/Latest.  I have similar issues with ethnicGroupCode and other elements.  Can anyone see what is wrong with the attached C-CDA?


Result Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'name'. One of '{"urn:hl7-org:v3":languageCommunication}' is expected.
Line Number: Line number not available

Result Description: Consol US Realm Header (V3) SHALL contain at least one [1..*] recordTarget, where its type is Record Target (CONF:1198-5266) each SHALL contain exactly one [1..1] patientRole, where (CONF:1198-5267) patient Role SHALL contain exactly one [1..1] patient, where (CONF:1198-5283) patient SHALL contain exactly one [1..1] raceCode, which SHALL be selected from ValueSet Race Category Excluding Nulls 2.16.840.1.113883.3.2074.1.1.3 DYNAMIC (CONF:1198-5322)
XPath: /ClinicalDocument/recordTarget/patientRole/patient
Line Number: 30

SampleC-CDA - Stripped.xml

Edge Test Tool (ETT)

unread,
Sep 18, 2023, 4:07:06 PM9/18/23
to Edge Test Tool (ETT)
Hi Michael - This issue has been logged for review and a member of the team will reach out shortly. 

kylem...@gmail.com

unread,
Sep 21, 2023, 12:26:35 PM9/21/23
to Edge Test Tool (ETT)
It seems like the issue is you are missing the codeSystem OID in each one. When you add them those errors go away...

                 <!--<raceCode code = "2106-3" displayName = "White"/> -->
                <raceCode
                    code = "2106-3"
                    displayName = "White"
                    codeSystem = "2.16.840.1.113883.6.238"
                    codeSystemName = "Race &amp; Ethnicity - CDC"/>
                <!--<ethnicGroupCode code = "2186-5" displayName = "NON-HISPANIC"/> -->
                <ethnicGroupCode
                    code = "2186-5"
                    displayName = "Not Hispanic or Latino"
                    codeSystem = "2.16.840.1.113883.6.238"
                    codeSystemName = "Race &amp; Ethnicity - CDC"/>

Michael Mall

unread,
Sep 22, 2023, 6:10:38 PM9/22/23
to Edge Test Tool (ETT)
Thank you for your reply.  I have cleaned up the C-CDA, but there are 3 remaining errors, all related to <text> elements.  The Implementation guide indicates where <text> elements are required, but it doesn't say anything about what content is required.  The Validator seems to care, however.  Below are the errors I am getting with the attached C-CDA.  Can you identify what is wrong?  They all indicate " Line number not available".


  • Result Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'text'. One of '{"urn:hl7-org:v3":realmCode, "urn:hl7-org:v3":typeId, "urn:hl7-org:v3":templateId, "urn:hl7-org:v3":id, "urn:hl7-org:v3":code}' is expected.
  • Line Number: Line number not available
    • Result Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'text'. One of '{"urn:hl7-org:v3":realmCode, "urn:hl7-org:v3":typeId, "urn:hl7-org:v3":templateId, "urn:hl7-org:v3":id, "urn:hl7-org:v3":code}' is expected.
    • Line Number: Line number not available
      • Result Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'text'. One of '{"urn:hl7-org:v3":interpretationCode}' is expected.
      • Line Number: Line number not available
      SampleC-CDA - Stripped.xml

      nagesh.bashyam (Dragon)

      unread,
      Sep 25, 2023, 9:16:34 AM9/25/23
      to Edge Test Tool (ETT)

      This looks to be an ordering issue. The order in which text is placed with respect to the other elements seems to be incorrect. 
      Please use a schema validator and it should point out the issue. 

      Bheem

      unread,
      Sep 25, 2023, 11:55:16 AM9/25/23
      to Edge Test Tool (ETT)
      Nagesh, could you share the schema validator link?

      Michael Mall

      unread,
      Sep 25, 2023, 12:17:30 PM9/25/23
      to Edge Test Tool (ETT)
      I am using the validator at https://site.healthit.gov/sandbox-ccda/ccda-validator.  Under "R2.1 2015 Edition", I select the options "Sender", "C-CDA_IG_Only", "No Scenario File".  When I validate, it identifies errors indicating items are missing that are not actually missing.

      Dan Brown SITE

      unread,
      Sep 26, 2023, 12:40:09 PM9/26/23
      to Edge Test Tool (ETT)
      The HL7 C-CDA schema specifies a specific order for elements within the XML. If the order of elements is not correct per the schema, then it is not a C-CDA file, and cannot be validated. We are able to determine that it is invalid, but not the line number in such cases. You can check schema on your own locally using the schema file by specifying the XSD in the file and validating with an XML application such as Notepad++, however, this is not likely to get you any line numbers either. I would suggest breaking the document down in order to isolate it and/or consider what was added or changed recently to make it invalid. Since the latest elements that do not match schema requirements are <text> elements, which are extremely common, and since the file is not valid as per schema for our validator, we cannot support any further analysis. I will ask Brett to provide a link to the C-CDA Schema (XSD file(s)). Best of luck.

      Dan Brown SITE

      unread,
      Sep 26, 2023, 12:48:17 PM9/26/23
      to Edge Test Tool (ETT)
      Just to add a little more clarity: We do not produce the schema, HL7 does. It is not something that should be edited, except by HL7, if there is a bug. So, if there is any concern in how it processes, one would need to file that with HL7. I will let Brett clarify as needed. Thanks!

      br...@waveoneassociates.com

      unread,
      Sep 26, 2023, 12:52:35 PM9/26/23
      to Edge Test Tool (ETT)
      The latest HL7 Schema is available on gitHub: https://github.com/HL7/CDA-core-2.0/tree/master/schema/extensions/SDTC

      It appears you have elements out of order. 



      Mat Davis

      unread,
      Oct 7, 2023, 10:15:30 PM10/7/23
      to Edge Test Tool (ETT)
      Very helpful discussion and info all. I've came across the elements out of order issue once or twice. Definitely a lesson learned.

      Thanks for the Notepad++ mention Dan. 
      • After some adjustments to XSD filepath references, I was successful on my end with local XSD validation using Plugins > XML Tools > Validate Now command and the files from Brett's link.

      Thanks for the HL7 Schema link Brett. 
      • Schema, XSD, and Schematron are some pretty big deep dives. I think I've slipped into the matrix.
      • Out of curiosity, in the chicken or the egg convo, which one came/comes 1st as far as being a source - the Companion Guides then the Schema or the Schema then Companion Guides?
      • Which one of the 2 or which source outside of these 2 is "king" in the hierarchy?
      Thanks - Mat

      Dan Brown SITE

      unread,
      Oct 9, 2023, 2:08:25 PM10/9/23
      to Edge Test Tool (ETT)
      Great, you're welcome.

      Without meeting the base-level schema requirements the document is not considered a C-CDA document so therefore that is first/"king"

      The order for our validation is:
      1: Schema (via the XSD files shared)
      2: IG (via MDHT within the reference-c-cda-validator, we do not use schematron)
      3: (if selected) Vocabulary validation (via the code-validator-api, a dependency of the reference-c-cda-validator, which may also include some companion guide alterations)
      4: (if selected) Content Validation (via the content-validator-api, a dependency of the reference-c-cda-validator, which may also include some companion guide alterations)

      Reply all
      Reply to author
      Forward
      0 new messages