Stream: IG creation
Topic: QA error on type slicing
Stefan Karl (Aug 16 2018 at 11:02):
I'm getting QA errors with type slicing in this profile, which restricts Observation.value[x] to valueQuantity or valueRatio and makes constraints on each of them. Here is the relevant part of StructureDefinition.differential:
<element id="Observation.value[x]"> <path value="Observation.value[x]"/> <slicing> <discriminator> <type value="type"/> <path value="$this"/> </discriminator> <rules value="open"/> </slicing> <min value="0"/> <max value="1"/> <type> <code value="Quantity"/> </type> <type> <code value="Ratio"/> </type> <condition value="pocd-obs-1"/> </element> <element id="Observation.value[x]:valueQuantity"> <path value="Observation.valueQuantity"/> <sliceName value="valueQuantity"/> <type> <code value="Quantity"/> </type> </element> <element id="Observation.value[x]:valueQuantity.value"> <path value="Observation.valueQuantity.value"/> <min value="1"/> </element> <element id="Observation.value[x]:valueQuantity.system"> <path value="Observation.valueQuantity.system"/> <fixedUri value="http://unitsofmeasure.org"/> </element> <element id="Observation.value[x]:valueRatio"> <path value="Observation.valueRatio"/> <sliceName value="valueRatio"/> <type> <code value="Ratio"/> </type> </element> <element id="Observation.value[x]:valueRatio.numerator"> <path value="Observation.valueRatio.numerator"/> </element> <element id="Observation.value[x]:valueRatio.numerator.value"> <path value="Observation.valueRatio.numerator.value"/> <min value="1"/> </element> <element id="Observation.value[x]:valueRatio.numerator.system"> <path value="Observation.valueRatio.numerator.system"/> <fixedUri value="http://unitsofmeasure.org"/> </element> <element id="Observation.value[x]:valueRatio.denominator"> <path value="Observation.valueRatio.denominator"/> </element> <element id="Observation.value[x]:valueRatio.denominator.value"> <path value="Observation.valueRatio.denominator.value"/> <min value="1"/> </element> <element id="Observation.value[x]:valueRatio.denominator.system"> <path value="Observation.valueRatio.denominator.system"/> <fixedUri value="http://unitsofmeasure.org"/> </element>
This example referencing the profile gets an "Element matches more than one slice" error. What's going wrong here?
Grahame Grieve (Aug 16 2018 at 11:03):
I don't know. is it committed?
Stefan Karl (Aug 16 2018 at 11:08):
It's in the PoCD Implementation Guide.
Grahame Grieve (Aug 16 2018 at 11:10):
ok I'll add it to my list
Stefan Karl (Aug 16 2018 at 11:11):
Thanks
Grahame Grieve (Aug 17 2018 at 00:28):
@Lloyd McKenzie I'm not sure what to do with this one. The goal is to constrain a 0..1 element with a choice of types to a single type, and then constrain it.
Grahame Grieve (Aug 17 2018 at 00:29):
http://build.fhir.org/elementdefinition.html#slicing says:
Elements that allow a choice of multiple types can be constrained. In principle, there are two different types of constraints to apply:
- A constraint that applies to the element as a whole - e.g. as restricting the cardinality, or limiting the choice of types
- A constraint that applies to the use of a particular type - e.g. value set binding
When constraining elements with multiple types, the following rules apply:
- Constraints limiting the acceptable list of types must be applied to the original "[x]" element as this is where the list of acceptable types is defined
- The inclusion of a type specific path (such as "Patient.deceasedBoolean") SHALL NOT be interpreted as constraining allowed types, but instead, it constrains the use of a particular type
- the original element SHALL always be represented in a snapshot; the type specific variants are only represented when needed
Grahame Grieve (Aug 17 2018 at 00:31):
so I would expect that you'd have this:
Observation.value[x]
type = Quantity
Observation.valueQuantity
Observation.valueQuantity.system
fixedUri = http://unitsofmeasure.org
Grahame Grieve (Aug 17 2018 at 00:31):
but the snapshot generator doesn't accept this. Where as the validator seems to assume it...
Lloyd McKenzie (Aug 17 2018 at 00:50):
Agree that the snapshot generator should allow/expect this. Also realize that digging into that particular piece of code at this point in the process is a very scary prospect...
Grahame Grieve (Aug 17 2018 at 00:53):
Yes @Stefan Karl we're going to carry this error. We'll fix it after ballot
Last updated: Apr 12 2022 at 19:14 UTC