FHIR Chat · Slicing polymorphic Elements · conformance

Stream: conformance

Topic: Slicing polymorphic Elements


view this post on Zulip Grahame Grieve (Nov 29 2019 at 18:56):

@Alexander Henket I'm still chipping away at the zib snapshot generation issues. When the snapshot generator runs into the construct below, it returns this error:

Unable to generate snapshot for http://nictiz.nl/fhir/StructureDefinition/zib-Pregnancy-PregnancyDuration because Error at path Observation.value[x] in http://nictiz.nl/fhir/StructureDefinition/zib-Pregnancy-PregnancyDuration: Type slicing with slicing.discriminator.type != 'type'

The differential in question says this:

   <element id="Observation.value[x]">
      <path value="Observation.value[x]" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="code" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <min value="1" />
    </element>

I don't understand what this is trying to do - to slice an polymorphic element that can't repeat by anything other than type, and the validator doesn't support this. I don't see that it makes sense either, and so I think this is an error in your profiles, but I'm interested in discussion here.

view this post on Zulip Grahame Grieve (Nov 29 2019 at 18:59):

btw, here's the first slice:

   <element id="Observation.value[x]:PregnancyDurationDays">
      <path value="Observation.value[x]" />
      <sliceName value="PregnancyDurationDays" />
      <short value="PregnancyDuration" />
      <definition value="Duration of the pregnancy on the day on which the patient was asked. The duration can be entered in days (d) or weeks (wk)." />
      <alias value="Zwangerschapsduur" />
      <type>
        <code value="Quantity" />
      </type>
      <mapping>
        <identity value="hcim-pregnancy-v3.1-2017EN" />
        <map value="NL-CM:7.14.4" />
        <comment value="PregnancyDuration" />
      </mapping>
    </element>
    <element id="Observation.value[x]:PregnancyDurationDays.unit">
      <path value="Observation.value[x].unit" />
      <defaultValueString value="days" />
    </element>
    <element id="Observation.value[x]:PregnancyDurationDays.system">
      <path value="Observation.value[x].system" />
      <min value="1" />
      <fixedUri value="http://unitsofmeasure.org" />
    </element>
    <element id="Observation.value[x]:PregnancyDurationDays.code">
      <path value="Observation.value[x].code" />
      <min value="1" />
      <fixedCode value="d" />
    </element>

view this post on Zulip Grahame Grieve (Nov 29 2019 at 18:59):

and here's the second:

   <element id="Observation.value[x]:PregnancyDurationWeeks">
      <path value="Observation.value[x]" />
      <sliceName value="PregnancyDurationWeeks" />
      <short value="PregnancyDuration" />
      <definition value="Duration of the pregnancy on the day on which the patient was asked. The duration can be entered in days (d) or weeks (wk)." />
      <alias value="Zwangerschapsduur" />
      <type>
        <code value="Quantity" />
      </type>
      <mapping>
        <identity value="hcim-pregnancy-v3.1-2017EN" />
        <map value="NL-CM:7.14.4" />
        <comment value="PregnancyDuration" />
      </mapping>
    </element>
    <element id="Observation.value[x]:PregnancyDurationWeeks.unit">
      <path value="Observation.value[x].unit" />
      <defaultValueString value="weeks" />
    </element>
    <element id="Observation.value[x]:PregnancyDurationWeeks.system">
      <path value="Observation.value[x].system" />
      <min value="1" />
      <fixedUri value="http://unitsofmeasure.org" />
    </element>
    <element id="Observation.value[x]:PregnancyDurationWeeks.code">
      <path value="Observation.value[x].code" />
      <min value="1" />
      <fixedCode value="wk" />
    </element>

view this post on Zulip Grahame Grieve (Nov 29 2019 at 19:01):

I can't see how these are usefully different to each other except to set the default value for the unit. Which you shouldn't be doing anyway, and I'm surprised isn't an error (though it might be the discriminator would be found first)

view this post on Zulip Grahame Grieve (Nov 29 2019 at 19:04):

I see we did not make a formal invariant for that rule until R4. but it has been in narrative from the beginning

view this post on Zulip Alexander Henket (Nov 30 2019 at 08:36):

@Grahame Grieve This 'little gem' comes from the functional model HCIM Pregnancy. This lists a concept PregnancyDuration in either days or weeks. Hence we'd like to say that you may use PregnancyDuration using code d or code wk.

I suppose you could achieve the same thing using a UCUM value set binding containing d/wk on valueQuantity as implicit slice? If you think that is a better solution, we can update for that.

view this post on Zulip Alexander Henket (Nov 30 2019 at 09:22):

I've checked in the suggested update for the profile in the develop branch under commit id af6423d57f4f67996d4619f93d91ae90822bad74. Let me know if that solved this issue.

view this post on Zulip Grahame Grieve (Nov 30 2019 at 09:24):

Ok, I’ll look. I definitely think that a value set is a much simpler way to meet this requirement for everyone

view this post on Zulip Alexander Henket (Nov 30 2019 at 09:24):

Well it sure makes for easier reading :-)

view this post on Zulip Alexander Henket (Nov 30 2019 at 09:25):

Mental note to @Pieter Edelman: if this is the better way to go, we should update our profiling guidelines for how to attach units to quantities.

view this post on Zulip Pieter Edelman (Dec 02 2019 at 07:55):

Agree that this is much more elegant. I'll update our guidelines.


Last updated: Apr 12 2022 at 19:14 UTC