hapifhir / org.hl7.fhir.core

Apache License 2.0
156 stars 160 forks source link

Suppress choice group element 'item' from being generated in CDA instances #1583

Closed robeastwood-agency closed 4 months ago

robeastwood-agency commented 7 months ago

The CDA Logical Model IG, v2.0.0-sd-snapshot1 introduced a choice group to a number of CDA datatypes, like AD and PN. See commit here.

This item element has an extension http://hl7.org/fhir/tools/StructureDefinition/xml-choice-group with its value set to true (see this for AD). And the definition of the extension states that

If true, marks that this element is a choice group that doesn’t literally appear in the XML

However, when generating a CDA instance via either the FHIR validator (using -transform of a FHIR Bundle against a StructureMap, with a target of the above CDA logical model) or being processed by the FHIR IG Publisher, in an IG derived from the CDA logical model, the item element appears in the generated CDA instance. This results in the instance failing schema validation. For example, an address appears as such:

<addr>
    <item>
        <country>Australia</country>
        <state>NSW</state>
        <city>Townsville</city>
        <postalCode>5555</postalCode>
        <streetAddressLine>1 Normal Street</streetAddressLine>
    </item>
</addr>

This was raised in zulip https://chat.fhir.org/#narrow/stream/246127-CDA-IG-Publisher/topic/CDA.20Logical.20Model.20-.20Choice.20Group.20.60item.60.20is.20not.20suppressed

With @grahamegrieve responding

I think I forgot to suppress it in the transform code, so feel free to make a bug report for that

Thank you

robeastwood-agency commented 4 months ago

I can confirm this as fixed with the latest release v6.3.16

Thank you @oliveregger , @grahamegrieve and @markiantorno