FHIR Chat · Constraining Choice to Single Type · conformance

Stream: conformance

Topic: Constraining Choice to Single Type


view this post on Zulip Chris Moesel (Dec 03 2019 at 22:24):

If we constrain a choice to a single type (e.g., value[x] to be only Quantity), I don't believe we need to slice; we just remove all but the Quantity type from the value[x] element's type array (please correct me if I'm wrong). Assuming that to be true, does the differential renaming approach (explained in this Firely blog) still apply? Should the snapshot path/id remain value[x] but the differential be renamed to valueQuantity? Or do they both remain value[x] only?

view this post on Zulip Grahame Grieve (Dec 04 2019 at 00:04):

the differential can be either

view this post on Zulip James Agnew (Jun 25 2020 at 11:47):

Building on this question, would this be the right way to express this:

    "differential": {
        "element": [
            {
                "binding": {
                    "strength": "required",
                    "valueSet": "https://bb/ValueSet/BBDemographicAgeUnit"
                },
                "id": "Observation.value[x]",
                "min": 1,
                "path": "Observation.value[x]",
                "type": [
                    {
                        "code": "Quantity"
                    }
                ]
            }
        ]
    },

I think it is, but the Java validator doesn't flag it as an error if I use a type other than Quantity.

Just want to make sure my logic is correct before I add a test case..

view this post on Zulip James Agnew (Jun 25 2020 at 11:47):

(The above is in a SD that has a baseDefinition of http://hl7.org/fhir/StructureDefinition/Observation )

view this post on Zulip Chris Moesel (Jun 25 2020 at 12:40):

Based on my understanding, given that the element is not a slice, it defines the root value[x] element. So it indicates that _only_ Quantity is allowed as a value in this Observation -- and any other value type is a violation. But I won't be offended if you wait for @Grahame Grieve to confirm.

view this post on Zulip Grahame Grieve (Jun 25 2020 at 12:48):

I agree. A test case would be good

view this post on Zulip James Agnew (Jun 25 2020 at 13:41):

Thanks! Will do.

view this post on Zulip Grahame Grieve (Jun 26 2020 at 00:28):

ok. can you approve the changes at https://github.com/hapifhir/org.hl7.fhir.core/pull/261

view this post on Zulip Grahame Grieve (Jun 26 2020 at 00:57):

this bug is fixed in the next version being released soon


Last updated: Apr 12 2022 at 19:14 UTC