FHIR Chat · Slicing and exists processing type · implementers

Stream: implementers

Topic: Slicing and exists processing type


view this post on Zulip Katie Wheatley (Dec 20 2017 at 16:22):

The HL7 FHIR website defines the exists processing type as
exists The slices are differentiated by the presence or absence of the nominated element.
Does this mean that the slice differentiating will occur based on whether the element is populated or not, so there could be a legal discriminator with no value in it? Why would this processing type be used?

view this post on Zulip Lloyd McKenzie (Dec 20 2017 at 20:22):

I typically use it with an extension - so one slice where the extension is present and another where the extension is absent. But you could do it for any element. It allows you to place limits like "this extension is only allowed to be present on a maximum of one repetition" or "this extension must appear on at least one repetition".

view this post on Zulip Eric Haas (Jun 14 2018 at 23:30):

@Lloyd McKenzie can you share an example of this SD?

view this post on Zulip Lloyd McKenzie (Jun 14 2018 at 23:59):

Deleted

view this post on Zulip Eric Haas (Jun 15 2018 at 00:03):

Thanks @Lloyd McKenzie but this isn't slicing where one slice contains a extension and the other doesn't ?

view this post on Zulip Lloyd McKenzie (Jun 15 2018 at 00:13):

Should have read the thread first :) Will post an example shortly.

view this post on Zulip Lloyd McKenzie (Jun 15 2018 at 00:45):

<element>
  <path value="Practitioner.practitionerRole"/>
  <slicing>
    <discriminator>
      <type value="exists"/>
      <path value="organization"/>
    </discriminator>
    <rules value="open"/>
  </slicing>
  <mustSupport value="true"/>
</element>
<element>
  <path value="Practitioner.practitionerRole"/>
  <sliceName value="practitionerOrg"/>
  <mustSupport value="true"/>
</element>
<element>
  <path value="Practitioner.practitionerRole.organization"/>
  <min value="1"/>
  <type>
    <code value="Reference"/>
    <targetProfile value="http://sharedhealth.exchange/fhir/StructureDefinition/profile-organization-service-location"/>
    <aggregation value="bundled"/>
  </type>
  <mustSupport value="true"/>
</element>
<element>
  <path value="Practitioner.practitionerRole.organization.reference"/>
  <min value="1"/>
  <mustSupport value="true"/>
</element>
<element>
  <path value="Practitioner.practitionerRole"/>
  <sliceName value="practitionerSpecialty"/>
  <mustSupport value="true"/>
</element>
<element>
  <path value="Practitioner.practitionerRole.organization"/>
  <max value="0"/>
  <mustSupport value="false"/>
</element>
<element>
  <path value="Practitioner.practitionerRole.role"/>
  <type>
    <code value="CodeableConcept"/>
    <profile value="http://sharedhealth.exchange/fhir/StructureDefinition/dtprofile-codeableconcept-code"/>
  </type>
  <mustSupport value="true"/>
  <binding>
    <strength value="required"/>
    <valueSetReference>
      <reference value="https://fhir.infoway-inforoute.ca/ValueSet/sharedpractitionerrole"/>
    </valueSetReference>
  </binding>
</element>
<element>
  <path value="Practitioner.practitionerRole.role.coding"/>
  <min value="1"/>
  <mustSupport value="true"/>
</element>
<element>
  <path value="Practitioner.practitionerRole.specialty"/>
  <min value="1"/>
  <type>
    <code value="CodeableConcept"/>
    <profile value="http://sharedhealth.exchange/fhir/StructureDefinition/dtprofile-codeableconcept-text-required-with-code"/>
  </type>
  <mustSupport value="true"/>
</element>

view this post on Zulip Eric Haas (Jun 15 2018 at 04:59):

Thanks @Lloyd McKenzie , I want to limit the choice on Task.owner to Practitioner or extension PractitionerRole, I thought this would be the ticket but I am stuck. Getting a 'can't slice non-repeating elements' message in R3 build. I can always use an invariant.

view this post on Zulip Eric Haas (Jun 15 2018 at 05:02):

I thought this was possible but not so sure anymore.

view this post on Zulip Lloyd McKenzie (Jun 15 2018 at 10:59):

That's odd. You're using the most recent IGPublisher?

view this post on Zulip Eric Haas (Jun 15 2018 at 17:03):

Is it possible because in the current build documentation it only talk about elements that repeat and polymorphic elements. Nothing that describes slicing non repeating elements. Also I may have done it wrong...since I hand edited it. but want to make sure is a thing first before trying to debug it. So basically here is the constraint

slice 1 Task.owner 0..1 ref(Practitioner)
slice 2 Task.owner 0..1 extension...valueRed(PractitionerRole)

view this post on Zulip Eric Haas (Jun 15 2018 at 17:55):

here is my xml snippet...

...
        <element id="Task.owner">
            <path value="Task.owner"/>
            <slicing>
                <discriminator>
                    <type value="exists"/>
                    <path value="extension.url"/>
                </discriminator>
                <rules value="open"/>
            </slicing>
            <mustSupport value="true"/>
            <isModifier value="false"/>
        </element>
        <element id="Task.owner:owner-p">
            <path value="Task.owner"/>
            <sliceName value="owner-p"/>
            <type>
                <code value="Reference"/>
                <profile value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner"/>
                <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner"/>
            </type>
            <mustSupport value="true"/>
            <isModifier value="false"/>
        </element>
        <element id="Task.owner:owner-pr">
            <path value="Task.owner"/>
            <sliceName value="owner-pr"/>
            <mustSupport value="true"/>
            <isModifier value="false"/>
        </element>
        <element id="Task.owner:oner-pr.extension">
            <path value="Task.owner.extension"/>
            <slicing>
                <discriminator>
                    <type value="value"/>
                    <path value="url"/>
                </discriminator>
                <rules value="open"/>
            </slicing>
            <mustSupport value="true"/>
            <isModifier value="false"/>
        </element>
        <element id="Task.owner:owner-pr.extension:owner-pr">
            <path value="Task.owner.extension"/>
            <sliceName value="owner-pr"/>
            <min value="0"/>
            <max value="1"/>
            <type>
                <code value="Extension"/>
                <profile value="http://hl7.org/fhir/ig/davinci/StructureDefinition/ext-practitionerRole"/>
            </type>
            <mustSupport value="true"/>
            <isModifier value="false"/>
        </element>
...

view this post on Zulip Lloyd McKenzie (Jun 15 2018 at 17:58):

If you want to base it on the existence of an extension, you need to do something like this:
<slicing>
<discriminator>
<type value="exists"/>
<path value="extension('http://sharedhealth.exchange/fhir/StructureDefinition/ext-communication-sender-locum')"/>
</discriminator>
<rules value="open"/>
</slicing>

view this post on Zulip Lloyd McKenzie (Jun 15 2018 at 17:58):

End then in one slice, have a minOccurs=1 for that extension and in the other slice have a maxOccurs=0

view this post on Zulip Eric Haas (Jun 15 2018 at 18:02):

Got it! ty.....that is not obvious to mere mortals like me. This seems like a relatively common pattern in r3 where the choice gets expanded by an ig. Do you agree? Is this only way to skin this cat using slicing and is it really better than using an invariant?

view this post on Zulip Lloyd McKenzie (Jun 15 2018 at 18:12):

It's the cleanest way to skin the cat. You could put the extension on the root instead, but it's more vulnerable to getting stripped there.


Last updated: Apr 12 2022 at 19:14 UTC