scandihealth / lpr3-docs

https://scandihealth.github.io/lpr3-docs/
MIT License
11 stars 7 forks source link

xsi namespace required by CDA Schema #18

Closed DaveSS closed 6 years ago

DaveSS commented 6 years ago

There are a few elements that are failing CDA schema validation since the element requires a xsi:type attribute. I am not exactly sure if the CDA schema is specific to US-Realm or if it is OK to just pass the schematron you provide and ignore the CDA schema errors. Please let me know if these issues need to be addressed. The 2 I have been noticing are:

  1. recordTarget/patientRole/addr/useablePeriod - This element is defined as SXCM_TS type which is just a timestamp that doesn't allow child elements like low/high. In order to include the low/high elements for a range, the useablePeriod should specifically specify the type as IVL_TX in the xsi namespace. so an example would look like:

`

`

  1. component/observation/value - This is at a number of places in the document. In order to put a string value the xsi:type="ST" is needed to prevent CDA schema errors. An example would look like:

`

Result7_value

`

jonigkeit commented 6 years ago

Hi @DaveSS I see what you mean. There seems to be a bug/missing feature in art-decor; changing a datatype to a derived datatype does not cascade to the CDA schematron files. We will talk to the art-decor team on how to implement the feature. Meanwhile we will fix the generated schematron manually.

ahenket commented 6 years ago

There's nothing missing: you need to set the right datatype on the element in ART-DECOR. When you do, this trickles down into schematron and helps you identify the right child elements and attributes. If you leave SXCM_TS, ANY or nothing there, then the schematron engine doesn't formally know what is expected

jonigkeit commented 6 years ago

Hi again @DaveSS,

To solve the schematron issue we will be using two useablePeriod elements.

<patientRole classCode="PAT">
  <templateId root="1.2.208.176.7.1.10.107"/>
  <id root="6071000016008" extension="08119675AG1" assigningAuthorityName="Region Nordjylland"/>
  <addr>
    <streetAddressLine>P.O. Pedersens Vej 2</streetAddressLine>
    <postalCode>8200</postalCode>
    <city>Aarhus N</city>
    <county>751</county>
    <country>5100</country>
    <useablePeriod value="20170201000000+0100" operator="I"/>
    <useablePeriod value="20171123000000+0100" operator="I"/>
  </addr>
  <patient classCode="PSN">
    <name>
      <family>Soort-Nielsen</family>
      <given>Jakob</given>
    </name>
    <administrativeGenderCode code="M" displayName="Male" codeSystem="2.16.840.1.113883.5.1"/>
    <birthTime value="19961108000000+0100"/>
  </patient>
</patientRole>

The updated template is for now available in preproduction: DK Alternatively Identified Patient Role

ahenket commented 6 years ago

@jonigkeit: I like the creativity, but that workaround doesn't hold semantically. Please make sure the specification reflects the desired datatype for useablePeriod.

ahenket commented 6 years ago

I checked the template on the link just now. The schematron assert in addr will always yield an error:

<assert role="error" 
              test="count(/useablePeriod) = 1"
    >Only two or no useablePeriod elements are allowed.</assert>

This test aims to duplicate the min/max on the element useablePeriod, is fired in the context of hl7:addr, but tests for /useablePeriod. Since useablePeriod is in namespace hl7, you will not find any element and thus count = 0. Secondly /useablePeriod searches in context root, and you likely have hl7:ClinicalDocument there, not useablePeriod. Lastly the assertion text does not say what you to happen. You test for count = 1, but your message says 0 or 2.

Want you probably wanted is:

<element name="hl7:addr" datatype="AD" 
        minimumMultiplicity="1" maximumMultiplicity="*" conformance="R">
    <include ref="1.2.208.176.7.1.10.127"/>
    <element name="hl7:useablePeriod" datatype="IVL_TS" 
        minimumMultiplicity="0" maximumMultiplicity="1" conformance="R">
        <attribute name="xsi:type" isOptional="false"/>
    </element>
</element>

No assertion needed and you make clear that @xsi:type is required. Optionally you can further specify the useablePeriod with hl7:low and hl7:high if the target audience appreciates that. For TS there are many flavors. TS.DATETIME.MIN came closest, but doesn't require a timezone. I've just added a new flavor TS.DATETIMETZ.MIN. Should you want to call that you would need:

<element name="hl7:addr" datatype="AD" 
        minimumMultiplicity="1" maximumMultiplicity="*" conformance="R">
    <include ref="1.2.208.176.7.1.10.127"/>
    <element name="hl7:useablePeriod" datatype="IVL_TS" 
        minimumMultiplicity="0" maximumMultiplicity="1" conformance="R">
        <attribute name="xsi:type" isOptional="false"/>
        <element name="hl7:low" datatype="TS.DATETIMETZ.MIN" 
            minimumMultiplicity="0" maximumMultiplicity="1" conformance="R"/>
        <element name="hl7:high" datatype="TS.DATETIMETZ.MIN" 
            minimumMultiplicity="0" maximumMultiplicity="1" conformance="R"/>
    </element>
</element>
cjonigkeit-csc commented 6 years ago

Hi @ahenket I see. Our initial attempt was precisely what you have in mind, however we forgot the xsirequirement and on top of that there was a typo usablePeriod.