FHIR Chat · Snapshots: include extensions and datatype profiles? · conformance

Stream: conformance

Topic: Snapshots: include extensions and datatype profiles?


view this post on Zulip Ardon Toonstra (Dec 08 2021 at 14:13):

Moved this thread from the implementer's stream. This question originates from wanting to show an overview of mappings of a profile based on its snapshot. As a rule of thumb, we place our mapping 'as close as possible' to the elements that actually represent the data. We also add them within extensions to avoid duplication of mappings if the extensions is reused in more profiles.

It seems that the snapshot generators of JAVA and .NET include the root concept details of the referenced extension/datatype into the host profile's snapshot. It leaves out all children, like the .value[x], which in our case contains mappings. I will add an example below.

I understand that you need to stop somewhere as you might not want to include everything in the snapshot considering performance reasons ect. Would that actually be the main reason?

Moreover, if this is desired, I might be a good idea to be a bit more explicit about this behaviour in the spec? I also think this part of the spec is incorrect: "a StructureDefinition can also carry a "snapshot" - a fully calculated form of the structure that is not dependent on any other structure."

view this post on Zulip Ardon Toonstra (Dec 08 2021 at 14:16):

Example: us-core-patient profile includes the us-core-birthsex extension like this in the diff:

    <element id="Patient.extension:birthsex">
      <path value="Patient.extension"/>
      <sliceName value="birthsex"/>
      <min value="0"/>
      <max value="1"/>
      <type>
        <code value="Extension"/>
        <profile value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"/>
      </type>
      <mustSupport value="false"/>
      <mapping>
        <identity value="argonaut-dq-dstu2"/>
        <map value="Patient.extension"/>
      </mapping>
    </element>

Resulting in this snapshot:

 <element id="Patient.extension:birthsex">
      <path value="Patient.extension"/>
      <sliceName value="birthsex"/>
      <short value="Extension"/>
      <definition value="A code classifying the person&#39;s sex assigned at birth  as specified by the [Office of the National Coordinator for Health IT (ONC)](https://www.healthit.gov/newsroom/about-onc)."/>
      <comment value="The codes required are intended to present birth sex (i.e., the sex recorded on the patient&#x2019;s birth certificate) and not gender identity or reassigned sex."/>
      <min value="0"/>
      <max value="1"/>
      <base>
        <path value="DomainResource.extension"/>
        <min value="0"/>
        <max value="*"/>
      </base>
      <type>
        <code value="Extension"/>
        <profile value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"/>
      </type>
      <condition value="ele-1"/>
      <constraint>
        <key value="ele-1"/>
        <severity value="error"/>
        <human value="All FHIR elements must have a @value or children"/>
        <expression value="hasValue() or (children().count() &gt; id.count())"/>
        <xpath value="@value|f:*|h:div"/>
        <source value="http://hl7.org/fhir/StructureDefinition/Element"/>
      </constraint>
      <constraint>
        <key value="ext-1"/>
        <severity value="error"/>
        <human value="Must have either extensions or value[x], not both"/>
        <expression value="extension.exists() != value.exists()"/>
        <xpath value="exists(f:extension)!=exists(f:*[starts-with(local-name(.), &#39;value&#39;)])"/>
        <source value="http://hl7.org/fhir/StructureDefinition/Extension"/>
      </constraint>
      <mustSupport value="false"/>
      <isModifier value="false"/>
      <mapping>
        <identity value="rim"/>
        <map value="player[classCode=PSN|ANM and determinerCode=INSTANCE]/administrativeGender"/>
      </mapping>
      <mapping>
        <identity value="iso11179"/>
        <map value=".patient.administrativeGenderCode"/>
      </mapping>
      <mapping>
        <identity value="argonaut-dq-dstu2"/>
        <map value="Patient.extension"/>
      </mapping>
    </element>

I expected that also the following would be included in the snapshot:

   <element id="Extension.url">
      <path value="Extension.url"/>
      <fixedUri value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"/>
    </element>
    <element id="Extension.valueCode">
      <path value="Extension.valueCode"/>
      <min value="1"/>
      <max value="1"/>
      <type>
        <code value="code"/>
      </type>
      <binding>
        <strength value="required"/>
        <description value="Code for sex assigned at birth"/>
        <valueSet value="http://hl7.org/fhir/us/core/ValueSet/birthsex"/>
      </binding>
    </element>

view this post on Zulip Lloyd McKenzie (Dec 08 2021 at 14:23):

The simple algorithm for snapshot is that the depth equals that in the differential. If the differential includes foo.extension.value[x], then you should expect the snapshot to include foo.extension.value[x] and all siblings - but not children of those siblings. (I believe there's an exception for backbone elements - if you include a backbone element, you always have to include its children because there's no datatype you can reference.)

view this post on Zulip Ardon Toonstra (Dec 10 2021 at 12:25):

That is indeed how it is implemented in the two main snapshot generators. Performance will be the reason behind it?

This results in either moving our mappings from e.g. extension.value[x] to the extension root or asking for better tooling support in generating a mapping overview. It cannot use the current snapshots then.

Shall I create a ticket to align the text in the profiling section of the spec with the definition of StructureDefinition.snapshot: "
A snapshot view is expressed in a standalone form that can be used and interpreted without considering the base StructureDefinition."?

view this post on Zulip Lloyd McKenzie (Dec 10 2021 at 14:14):

I think the basic gist is - "Can I validate this child element using the profile of the specified type alone?" If the answer to that question is no, then you have to blow out that whole type into the snapshot. You keep asking that question on the way down until the answer becomes 'yes'.


Last updated: Apr 12 2022 at 19:14 UTC