FHIR Chat · slice names not working · shorthand

Stream: shorthand

Topic: slice names not working


view this post on Zulip John Moehrke (Mar 21 2022 at 19:34):

Given a test IG I have -- https://github.com/JohnMoehrke/SlicingSlicedExtension
which I have simplified... but seems a slice inside an extension inside a slice is such that my examples can't use the slicename... I can't use my slice name of npi or provider-id

I want to say

* agent[user].extension[extOtherId][npi].valueIdentifier.type = http://terminology.hl7.org/CodeSystem/v2-0203#NPI
* agent[user].extension[extOtherId][npi].valueIdentifier.value = "1234567@myNPIregistry.example.org"
* agent[user].extension[extOtherId][provider-id].valueIdentifier.type = http://terminology.hl7.org/CodeSystem/v2-0203#PRN
* agent[user].extension[extOtherId][provider-id].valueIdentifier.value = "JohnD"

but am forced to say

* agent[user].extension[extOtherId][+].valueIdentifier.type = http://terminology.hl7.org/CodeSystem/v2-0203#NPI
* agent[user].extension[extOtherId][=].valueIdentifier.value = "1234567@myNPIregistry.example.org"
* agent[user].extension[extOtherId][+].valueIdentifier.type = http://terminology.hl7.org/CodeSystem/v2-0203#PRN
* agent[user].extension[extOtherId][=].valueIdentifier.value = "JohnD"

view this post on Zulip Chris Moesel (Mar 22 2022 at 00:37):

Hi @John Moehrke. You've run into one of the few cases where ordering of statements does matter for SUSHI. When you slice an element, SUSHI creates the slices using copies of that element with the constraints that were there at the time it was sliced. If you add constraints to the base element after you've already sliced it, the slices will not take on those constraints. This is a limitation of SUSHI, but there is a workaround. Ensure that you define all constraints on the base slice before slicing it.

So, in your example, instead of this:

* agent.extension contains OtherId named extOtherId 0..* MS
// Here you are slicing agent *before* you sliced agent.extension, so these agent slices don't get the extension slices
* agent ^slicing.discriminator.type = #pattern
* agent ^slicing.discriminator.path = "type"
* agent ^slicing.rules = #open
* agent contains
    user 1.. and
    userorg 0..
* agent[user].type = http://terminology.hl7.org/CodeSystem/v3-ParticipationType#IRCP "information recipient"
* agent[user].who 1..1
// Here is where you slice agent.extension, but it's just a little too late for SUSHI to add them to the slices
* agent.extension[extOtherId] ^slicing.discriminator.type = #value
* agent.extension[extOtherId] ^slicing.discriminator.path = "type"
* agent.extension[extOtherId] ^slicing.rules = #open
* agent.extension[extOtherId] contains
    npi 0..1 and
    provider-id 0..1
* agent.extension[extOtherId][npi].valueIdentifier.type = http://terminology.hl7.org/CodeSystem/v2-0203#NPI
* agent.extension[extOtherId][provider-id].valueIdentifier.type = http://terminology.hl7.org/CodeSystem/v2-0203#PRN
* agent[userorg].type = http://terminology.hl7.org/CodeSystem/v3-RoleClass#PROV "healthcare provider"
* agent[userorg].who 1..1

do this:

// Add all the constraints to agent FIRST
* agent.extension contains OtherId named extOtherId 0..* MS
* agent.extension[extOtherId] ^slicing.discriminator.type = #pattern
* agent.extension[extOtherId] ^slicing.discriminator.path = "value.type"
* agent.extension[extOtherId] ^slicing.rules = #open
* agent.extension[extOtherId] contains
    npi 0..1 and
    provider-id 0..1
* agent.extension[extOtherId][npi].valueIdentifier.type = http://terminology.hl7.org/CodeSystem/v2-0203#NPI
* agent.extension[extOtherId][provider-id].valueIdentifier.type = http://terminology.hl7.org/CodeSystem/v2-0203#PRN
// THEN slice it
* agent ^slicing.discriminator.type = #pattern
* agent ^slicing.discriminator.path = "type"
* agent ^slicing.rules = #open
* agent contains
    user 1.. and
    userorg 0..
* agent[user].type = http://terminology.hl7.org/CodeSystem/v3-ParticipationType#IRCP "information recipient"
* agent[user].who 1..1
* agent[userorg].type = http://terminology.hl7.org/CodeSystem/v3-RoleClass#PROV "healthcare provider"
* agent[userorg].who 1..1

This fixes the SUSHI issue (so you can reference the slices by name), but there are still IG Publisher issues w/ validation. I've been looking into those too, but so far not making a ton of progress.

view this post on Zulip Chris Moesel (Mar 22 2022 at 00:49):

Oh, I also had to fix agent.extension[extOtherId]'s discriminator type (#value --> #pattern) and path (type --> value.type).

view this post on Zulip Chris Moesel (Mar 22 2022 at 00:56):

I've been able to fix some, but not all, of the QA errors by directly modifying the structure definition. This was necessary because some of the issues were that the IG Publisher wants the differential to declare some properties that aren't really different -- and SUSHI is kind of a stickler for only putting truly different things into the differential.

That got me down to 6 errors:

  • Two of these: Slicing cannot be evaluated: Could not match discriminator ([value.type]) for slice AuditEvent.agent:user.extension:extOtherId in profile http://johnmoehrke.github.io/SlicingSlicedExtension/StructureDefinition/ThirdSliceProfile - the discriminator [value.type] does not have fixed value, binding or existence assertions
  • Two of these: Profile http://johnmoehrke.github.io/SlicingSlicedExtension/StructureDefinition/ThirdSliceProfile, Element matches more than one slice - extOtherId, extOtherId/npi
  • Two of these: Profile http://johnmoehrke.github.io/SlicingSlicedExtension/StructureDefinition/ThirdSliceProfile, Element matches more than one slice - extOtherId, extOtherId/provider-id

I can't figure out those first two (slicing cannot be evaluated) because as far as I can tell, the value.type is definitely fixed. And the last four (matches more than one slice) seem like a bug in IGP to me -- it's not properly handling the re-slicing. But I suspect this may actually be a consequence of those first two errors (i.e., it can't figure out how to evaluate the reslicing).

I don't know where to go from here. Here's my hand-modified structure definition for that profile: StructureDefinition-ThirdSliceProfile.json

view this post on Zulip John Moehrke (Mar 22 2022 at 11:48):

ah, so rearranging the order of the slicing definition here is unfortunate hack solution, as I really only want the otherId slice within a specific slice on agent.. I put this forward as I was hoping that using Identifier would have made the second slice easier.


Last updated: Apr 12 2022 at 19:14 UTC