Stream: shorthand
Topic: fixedString in a profile causing errors in instance
David Hay (Apr 30 2020 at 03:15):
Trying to create an instance of the Australian Imm profile and getting an error when setting a value on a sliced element:
* performer[administeredBy].function = http://terminology.hl7.org/CodeSystem/v2-0443#AP "Administering Provider"
* performer[administeredBy].function.text = "Administering Provider" // a fixed string in the profile
* performer[administeredBy].actor = Reference(aupc-practitioner1)
Error (on the second line):
Cannot fix this element using a pattern; as it is already fixed in the StructureDefinition using fixedString. Since fixed[x] requires exact matches, while pattern[x] allows for variation in unspecified properties, fixed[x] cannot be replaced by pattern[x] since it would loosen the constraint.
Jean Duteau (Apr 30 2020 at 03:20):
I got that and realized that I just had to leave it empty - i.e don't put it on the instance. Even though the string was exactly what was specified in the profile, it wouldn't work. I believe that this is also true if it was a code instead of a string.
David Hay (Apr 30 2020 at 04:24):
I did try that - unfortunately I still got an error:
error Element Immunization.performer:administeredBy.function.text has minimum cardinality 1 but occurs 0 time(s).
David Hay (Apr 30 2020 at 04:26):
I have noted that leaving it out is fine if the profile is defined in FSH though...
Jean Duteau (Apr 30 2020 at 04:37):
Right. my profile was defined in FSH. Even though that works, that still points to a problem with SUSHI being overzealous.
David Hay (Apr 30 2020 at 04:39):
Yes - it's an interesting question whether or not sushu should apply 'defaults'...
Nick Freiter (Apr 30 2020 at 12:54):
This looks like it is an artifact of when we added the new exactly
keyword for fixing values on Profiles and Extensions. Some of the logic for determining whether or not a value can be fixed is shared between Profiles/Extensions and Instances, so it looks like when we changed the logic for Profiles/Extensions to work with the exactly
keyword, we missed this side effect on Instances.
Normally SUSHI should actually automatically set the value of performer[administeredBy].function.text
, but the same error that is stopping you from setting it manually is stopping SUSHI from setting it by hand. Unfortunately I don't think there is really any workaround until we fix this.
Nick Freiter (Apr 30 2020 at 12:54):
Tracking this as an issue https://github.com/FHIR/sushi/issues/398
David Hay (Apr 30 2020 at 18:26):
Thanks!
David Hay (Apr 30 2020 at 23:15):
Hi Nick - is this another example of this issue?
profile
* identifier ^slicing.discriminator.type = #value
* identifier ^slicing.discriminator.path = "system"
* identifier ^slicing.rules = #openAtEnd
//The slice has the name NHI
* identifier contains
NHI 1..1
* identifier[NHI].system = "https://standards.digital.health.nz/id/nhi" (exactly)
Instance:
* identifier[NHI].system = "https://standards.digital.health.nz/id/nhi"
* identifier[NHI].value = "ABC1234"
Error:
error Cannot fix this element using a pattern; as it is already fixed in the StructureDefinition using fixedUri. Since fixed[x] requires exact matches, while pattern[x] allows for variation in unspecified properties, fixed[x] cannot be replaced by pattern[x] since it would loosen the constraint.
Nick Freiter (May 01 2020 at 11:49):
Yeah, looks like the same issue to me! We are working on a fix, and will test out to see how it works with the examples you gave above.
Nick Freiter (May 01 2020 at 21:20):
This should be fixed in SUSHI 0.12.5 https://github.com/FHIR/sushi/releases/tag/v0.12.5
Last updated: Apr 12 2022 at 19:14 UTC