Stream: shorthand
Topic: Open slicing forcing a minimum cardinality
Jean Duteau (Jan 13 2021 at 18:24):
I am setting up slicing on AdverseEvent and I want an open slice where at least one slice is fixed to a specific type or profile. I'm sure I've done this before and I have the following:
* suspectEntity ^slicing.discriminator.type = #profile
* suspectEntity ^slicing.discriminator.path = "type"
* suspectEntity ^slicing.rules = #open
* suspectEntity ^slicing.description = "Slice based on the allowed suspect entity."
* suspectEntity contains Immunization 1..1 MS
* suspectEntity[Immunization].instance only Reference(ICSRImmunization)
In my example instance, I have the following:
Instance: VAERSExampleEvent
InstanceOf: VAERSAdverseEvent
* suspectEntity[0].instance = Reference(VAERSExampleImmunization)
* suspectEntity[0].causality.productRelatedness = "Suspect"
* suspectEntity[1].instance = Reference(VAERSHydrocortisoneAdministration)
* suspectEntity[1].causality.productRelatedness = "Concomitant"
Instance: VAERSExampleImmunization
InstanceOf: ICSRImmunization
I'm getting an error and it's a range of lines:
error Element AdverseEvent.suspectEntity:Immunization has minimum cardinality 1 but occurs 0 time(s).
File: /Users/jeanduteau/Documents/DDIWork/IBM-BEST/fhir-icsr-ae-reporting/input/fsh/Examples.fsh
Line: 327 - 339
Jean Duteau (Jan 13 2021 at 18:27):
as I wrote that, I remembered specifying the slice name and when I did that, the error went away. So SUSHI is looking explicitly for the slice name?
ryan moehrke (Jan 13 2021 at 18:34):
your slicing path looks like it's pointing to suspectEntity.type which does not look like it exists. I think you want "instance.resolve()" no?
Jean Duteau (Jan 13 2021 at 18:35):
yes, just figured that out after I got Sushi to move forward. :)
Jean Duteau (Jan 13 2021 at 18:35):
do I want instance.resolve()? or just instance?
Jean Duteau (Jan 13 2021 at 18:42):
ah, instance.resolve() is needed.
ryan moehrke (Jan 13 2021 at 18:45):
Yup, if you were say, checking a Bundle.entry.resource you wouldn't use resolve because the resource is inline, but because it's a reference you need to add the resolve in order to do checks like profile etc. on that referenced resource.
Jean Duteau (Jan 13 2021 at 18:45):
right. thanks!
Nick Freiter (Jan 14 2021 at 12:19):
@Jean Duteau, SUSHI is looking explicitly for the slice name. However, we've realized that this is probably a bit too limiting, so we have relaxed that constraint in SUSHI 1.1.0 which was just released. In that version of SUSHI, you won't see that error about a missing slice.
Last updated: Apr 12 2022 at 19:14 UTC