FHIR Chat · restricting value[x] without slicing · shorthand

Stream: shorthand

Topic: restricting value[x] without slicing


view this post on Zulip Patrick Werner (Oct 13 2020 at 15:37):

I just tried to fix value[x] to valueCodeableConcept (inside of a component)

view this post on Zulip Patrick Werner (Oct 13 2020 at 15:38):

I used: * component[dna-chg].value[x] only CodeableConcept

view this post on Zulip Patrick Werner (Oct 13 2020 at 15:39):

which creates a type based slicing, which we don't want. Is there an alternative syntax to just fix the type of value[x] ?

view this post on Zulip Chris Moesel (Oct 13 2020 at 15:58):

Hi @Patrick Werner. If I recall correctly, the rule you noted above (an only rule) should not create a type slice. What typically creates a type slice is if you access value[x] using the type-based path, e.g. * component[dna-chg].valueCodeableConcept from MyValueSet. Are you doing that? If so, you can change those rules to use value[x] instead of valueCodeableConcept -- and that should avoid the type slicing.

view this post on Zulip Chris Moesel (Oct 13 2020 at 16:00):

BTW -- we're considering changing how SUSHI exports this so that even if you say valueCodeableConcept, SUSHI would not use a type slice if value[x] has already been narrowed to only CodeableConcept anyway. This is something that would change current output (for current IGs), however, so we're considering it carefully. Until then, avoiding the type-specific property names in the paths should do the trick.

view this post on Zulip Patrick Werner (Oct 14 2020 at 10:15):

it worked! Thanks @Chris Moesel !!

view this post on Zulip Patrick Werner (Oct 14 2020 at 10:16):

Chris Moesel said:

BTW -- we're considering changing how SUSHI exports this so that even if you say valueCodeableConcept, SUSHI would not use a type slice if value[x] has already been narrowed to only CodeableConcept anyway. This is something that would change current output (for current IGs), however, so we're considering it carefully. Until then, avoiding the type-specific property names in the paths should do the trick.

I think that would be a great change, seems to be much more intuitive (at least to me)

view this post on Zulip Patrick Werner (Oct 14 2020 at 10:26):

btw: if i do this * valueCodeableConcept from http://loinc.org/vs/LL1971-2 (required) (on Observation.value) doesn't introduce a slice.
I expected that i have to change this also to: * value[x] from http://loinc.org/vs/LL1971-2 (required)

view this post on Zulip Chris Moesel (Oct 14 2020 at 12:11):

Patrick Werner said:

btw: if i do this * valueCodeableConcept from http://loinc.org/vs/LL1971-2 (required) (on Observation.value) doesn't introduce a slice.
I expected that i have to change this also to: * value[x] from http://loinc.org/vs/LL1971-2 (required)

Honestly, I find that surprising too. I'm not sure why you didn't have to do it there too... Thanks for the confirmation on the other and the feedback regarding our potential approach.


Last updated: Apr 12 2022 at 19:14 UTC