Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

Order of header templateIds matters though shouldn't #128

@naXa777

Description

@naXa777

I'm not sure if this is a real issue. I just find it confusing.

Clinical document A

<ClinicalDocument ...>
   ...
   <templateId root="2.16.840.1.113883.10.20.22.1.1"/>
   <templateId root="2.16.840.1.113883.10.20.22.1.2"/>
   ...

Clinical document B

<ClinicalDocument ...>
   ...
   <templateId root="2.16.840.1.113883.10.20.22.1.2"/>
   <templateId root="2.16.840.1.113883.10.20.22.1.1"/>
   ...

Both clinical documents have identical content and declare conformance to the US Realm Header template and to the C-CDA CCD document template. But when loaded by MDHT they have different types:

import org.eclipse.mdht.uml.cda.ClinicalDocument;
import org.eclipse.mdht.uml.cda.util.CDAUtil;
import org.openhealthtools.mdht.uml.cda.consol.ContinuityOfCareDocument;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
    ...
    CDAUtil.loadPackages();
    final ClinicalDocument doc_A = CDAUtil.load(new FileInputStream("A.xml"));
    final ClinicalDocument doc_B = CDAUtil.load(new FileInputStream("B.xml"));

    assertThat(doc_B, instanceOf(ContinuityOfCareDocument.class));   // ok
    assertThat(doc_A, instanceOf(ContinuityOfCareDocument.class));   // fail (AssertionError)

Error:

java.lang.AssertionError: 
Expected: an instance of org.openhealthtools.mdht.uml.cda.consol.ContinuityOfCareDocument
     but: <org.openhealthtools.mdht.uml.cda.mu2consol.impl.GeneralHeaderConstraintsImpl@52231f30 (nullFlavor: <unset>, classCode: <unset>, moodCode: <unset>)> is a org.openhealthtools.mdht.uml.cda.mu2consol.impl.GeneralHeaderConstraintsImpl

I have consol2 and mu2consol dependencies in pom.xml.

    <dependency>
        <groupId>org.openhealthtools.mdht.cda</groupId>
        <artifactId>org.openhealthtools.mdht.uml.cda.consol2</artifactId>
    </dependency>

    <!-- Note: if I remove mu2consol then both docs are loaded as ContinuityOfCareDocument -->
    <dependency>
        <groupId>org.openhealthtools.mdht.cda</groupId>
        <artifactId>org.openhealthtools.mdht.uml.cda.mu2consol</artifactId>
        <version>3.0.0-SNAPSHOT</version>
    </dependency>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions