FHIR Chat · Extension on closed slice · implementers

Stream: implementers

Topic: Extension on closed slice


view this post on Zulip Mark Kleop (Mar 25 2021 at 06:56):

Hey,
a beginner question:
I have a profile which is derived from a profile in which the identifer is sliced an closed:
baseprofile:
<element id="Patient.identifier">
<path value="Patient.identifier" />
<slicing>
<discriminator>
<type value="value" />
<path value="type.coding.code" />
</discriminator>
<rules value="closed" />
</slicing>
</element>

I would like to add an extension to the identifier in the derived profile:

<element id="Patient.identifier">
<path value="Patient.identifier" />
<min value="1" />
<max value="1" />
<mustSupport value="true" />
</element>

  • <element id="Patient.identifier.extension">
    <path value="Patient.identifier.extension" />

  • <slicing>

  • <discriminator>
    <type value="value" />
    <path value="url" />
    </discriminator>
    <rules value="closed" />
    </slicing>
    </element>

  • <element id="Patient.identifier.extension:test">
    <path value="Patient.identifier.extension" />
    <sliceName value="test" />
    <max value="1" />

  • <type>
    <code value="Extension" />
    <profile value="https://test/StructureDefinition/test" />
    </type>
    <mustSupport value="true" />
    </element>

  • <element id="Patient.identifier.extension:test.value[x]">
    <path value="Patient.identifier.extension.value[x]" />
    <mustSupport value="true" />
    </element>

  • <element id="Patient.identifier.extension:test.value[x]:valueInteger">
    <path value="Patient.identifier.extension.value[x]" />
    <sliceName value="valueInteger" />
    <mustSupport value="true" />
    </element>

Is this valid? And why not? since the validator returned an error

thanks Mark

view this post on Zulip Lloyd McKenzie (Mar 25 2021 at 13:15):

What error are you getting?

Also, both constraining cardinality on identifier as well as closed slicing are things to be very cautious about as they tend to inhibit interoperability. It's rare there's a good reason to stop a system from exposing whatever identifiers it has - you can always ignore the ones you don't care about.

view this post on Zulip Mark Kleop (Mar 25 2021 at 17:11):

I know this could be tricky, but this is a special use-case in which only a few identifiers are allowed.

But why is it forbidden to add an extension to an closed slice? the slices are independent from the usage of extensions, in my opinion. Or not?

The HL7 Validator returned (Translation from german):
This element does not fit to a known slice in profile XXX and the slicing is closed

view this post on Zulip Lloyd McKenzie (Mar 25 2021 at 17:15):

That sounds like a validation issue with the instance, not the profile?

view this post on Zulip Lloyd McKenzie (Mar 25 2021 at 17:16):

You may need to share the full profile and the full instance

view this post on Zulip Mark Kleop (Mar 26 2021 at 06:18):

test.zip
here is a test zip:
example is the example
folder -ig inherits the necessary profiles
folder basis 09.13 is necessary also

Thanks

view this post on Zulip Lloyd McKenzie (Mar 26 2021 at 13:08):

Your base profile says you're discriminating by type.coding.code and slicing is closed - but your instance doesn't declare type.coding.code. Having an extension doesn't waive the constraints of the base profile - you still have to have a value that's valid against the base - which means declaring one of the specified type.coding.code values.

As an aside, you should never slice only by coding.code. Code and system go together and looking at only the code and not the system isn't safe. (Best practice is to actually slice by 'pattern' on the whole CodeableConcept and in your pattern declare a system and a code.)

view this post on Zulip Mark Kleop (Mar 26 2021 at 20:26):

Okay the way of defining this slicing rule could be optimized, but it would be valid to set every sclice to 0..0 and rule ele-1 would be satisfied since the Extension was integrated. I couldn't understand why this is faulty and got this error? The profile prohibits the slices and the example has not any.

view this post on Zulip Lloyd McKenzie (Mar 26 2021 at 20:47):

test2 defines closed slicing on identifier. That means every identifier in the instance MUST match one of the slices defined in the test2 profile. By constraining out all of the declared profiles, you've essentially said "you can't have an identifier here" because the closed slicing in the base says "all identifiers must match one of these slices" and the child profile says "no identifier can match any of the slices defined in the parent"

view this post on Zulip Lloyd McKenzie (Mar 26 2021 at 20:48):

This is one of the reasons why closed slicing should be used with great caution - it's saying "there can be no exceptions" - and in healthcare, there's almost always a need for exceptions...

view this post on Zulip Mark Kleop (Mar 27 2021 at 05:46):

Okay i think i got it now... Thanks for the detailed explanation


Last updated: Apr 12 2022 at 19:14 UTC