FHIR Chat · Slicing based on outside criteria? · conformance

Stream: conformance

Topic: Slicing based on outside criteria?


view this post on Zulip Simone Heckmann (Oct 26 2018 at 10:13):

Hi,
is there a way to select a slice for validation based on a criteria which lies outside the slice?
E.g. a FHIRPath expression that has to evaluate as "true" to select a slice.
Example: Patient has 3 different slices for name, the correct one is selected based on citizenship, so each slice would need a FHIRPath-expression of kind "citizenship=XX" for selection of the correct slice to validate the instance...

view this post on Zulip Stefan Lang (Oct 26 2018 at 10:33):

If there is a slice discriminator, you may add 3 FHIRPath expressions that say "citizenship=DE and name.xyz=(your value for xyz in a German name)"., with the value of the xyz element being the discriminator etc.
If you don't have a discriminator, maybe add an extension that represents one ("name-style" => DE, FR, ES, ...)

view this post on Zulip Ewout Kramer (Oct 26 2018 at 10:37):

Well, we figured this usecase would come up some time ;-) See https://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_id=677&tracker_item_id=12641. But I don't think Grahame nor me bothered to implement it....

view this post on Zulip Stefan Lang (Oct 26 2018 at 10:59):

That would be this extension: http://build.fhir.org/extension-elementdefinition-selector.html
right?

view this post on Zulip Stefan Lang (Oct 26 2018 at 11:03):

If I understand this correct, the extension would be added to the relevant elements in each slice.
But what is the root of the FHIRPath expression then? If it is the sliced element, you would not be able to refer to an element elsewhere in the resource?

view this post on Zulip Ewout Kramer (Oct 26 2018 at 11:04):

Wouldn't %resource work to get you back to the root of the resource?

view this post on Zulip Stefan Lang (Oct 26 2018 at 11:04):

Argh, right

view this post on Zulip Simone Heckmann (Oct 26 2018 at 11:28):

This sounds exactly like what we are looking for. However I am not sure I understand the usage correctly. If each slice has a FHIR-Path expression that must evaluate to "true" to select the slice, then what is the discriminator?

Or rather, if the discriminator was a FHIRPath, would the Expression in the extension then only be the value matching the expression...?

view this post on Zulip Ewout Kramer (Oct 26 2018 at 11:34):

There is essentially no discriminator (which is a fixed code somewhere in the definitions), but rather an entrance criteria for each slice, represented in FHIRPath. So, each slice would have its own FHIRPath expression, that - if it evaluates to true on the instance - triggers the constraints for that slice.

So, you could slice on -say- Observation.referenceRange like so:
slice A1: low <= 100y
slice A2: low > 100y

view this post on Zulip Simone Heckmann (Oct 26 2018 at 11:45):

Thanks, awesome!!

view this post on Zulip Ewout Kramer (Oct 26 2018 at 11:46):

Now, we just need to build it into our validators ;-) But your lucky, I am reviewing the.NET validator over the coming period. Who knows ;-)

view this post on Zulip Michel Rutten (Oct 26 2018 at 11:48):

Becomes interesting when multiple selectors match simultaneously...

view this post on Zulip Ewout Kramer (Oct 26 2018 at 11:55):

Is the Gforge item puts it:

This would also allow for instances to fit in multiple slices (note: this is unlike the behaviour of the familiar switch statement), deeply changing the semantics of slices. The consequences of this might be far-reaching at this moment in the publication cycle so we suggest to add this "selector" as an extension, allowing toolsmiths to experiment with it and get feedback on it."

view this post on Zulip Grahame Grieve (Oct 26 2018 at 13:20):

I have not implemented this

view this post on Zulip Simone Heckmann (Oct 30 2018 at 07:51):

Would this be a correct usage of the extension in a differential to express that a Patient's name must validate against the Profile "humanname-de-basis" if the citizenship is "DE"?

 <StructureDefinition xmlns="http://hl7.org/fhir">
    <url value="http://example.org/fhir/StructureDefinition/MyPatient"/>
    <name value="MyPatient"/>
    <status value="draft"/>
    <fhirVersion value="3.0.1"/>
    <kind value="resource"/>
    <abstract value="false"/>
    <type value="Patient"/>
    <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Patient"/>
    <derivation value="constraint"/>
    <differential>
        <element id="Patient.name">
            <path value="Patient.name"/>
            <slicing>
                <rules value="open"/>
            </slicing>
        </element>
        <element id="Patient.name:Name-DE">
            <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-selector">
                <valueString value="$this.extension('http://hl7.org/fhir/StructureDefinition/patient-citizenship').valueString='DE'"/>
            </extension>
            <path value="Patient.name"/>
            <sliceName value="Name-DE"/>
            <type>
                <code value="HumanName"/>
                <profile value="http://fhir.de/StructureDefinition/humanname-de-basis"/>
            </type>
        </element>
    </differential>
</StructureDefinition>

view this post on Zulip Ewout Kramer (Oct 30 2018 at 10:50):

No, since it would look for an extension under Patient.name (and you could already do that with normal discriminators), I think you mean:

%resource.extension(.....).value = 'DE'

Note that in FHIRPath, the type suffixes do not exist, so it is not extension(....).valueString, but just .value.

view this post on Zulip Simone Heckmann (Oct 30 2018 at 11:46):

Oh, ok! So it would be the structure as above but with the FHIRPath expression
%resource.extension('http://hl7.org/fhir/StructureDefinition/patient-citizenship').value='DE'

view this post on Zulip Simone Heckmann (Oct 30 2018 at 11:52):

Should there be anything in particular (like a keyword) in slicing.description
or would validators know how this works based on the existence of the extensions?
(eld-1 says there needs to be a description if there's no discriminator....)


Last updated: Apr 12 2022 at 19:14 UTC