FHIR Chat · Creating Examples with slicing · shorthand

Stream: shorthand

Topic: Creating Examples with slicing


view this post on Zulip Jean Duteau (Mar 25 2020 at 20:15):

I'm trying to figure out the right way of creating examples where I have defined slices. In my profile, I have the following slices:

* telecom 3..*
* telecom ^slicing.discriminator.type = #value
* telecom ^slicing.discriminator.path = "system"
* telecom ^slicing.rules = #open
* telecom ^slicing.description = "Slice based on the different telecom types (systems)"
* telecom contains Phone 1..1 and Fax 1..1 and Email 1..1
* telecom[Phone].system = #phone
* telecom[Fax].system = #fax
* telecom[Email].system = #email

I thought that with the above profile definition, my example could just specify the values:

* telecom[Phone].value = "+01 123 456 78"
* telecom[Fax].value = "+01 123 456 89"
* telecom[Email].value = "email@city.us"

But that doesn't automatically populate the system. I can obviously go in and add the systems in my instance definition, but do I need to? Am I missing something that would allow me not have to populate system in my example and have sushi infer that from the slices?

view this post on Zulip Nick Freiter (Mar 25 2020 at 20:34):

In this case SUSHI will not fill in the values for system, because system has cardinality 0..1, so we can't know for sure that the system field should have a value on a given instance of your profile. So one way to make the system field be automatically populated on an instance would be to change the cardinality to be 1..1 for each slice by adding the following lines to your profile:

* telecom[Phone].system 1..1
* telecom[Fax].system 1..1
* telecom[Email].system 1..1

Or alternately, you could change the cardinality of all slices so that system is 1..1 on any slice by adding this line to your profile:

* telecom.system 1..1

view this post on Zulip Jean Duteau (Mar 25 2020 at 20:34):

thx

view this post on Zulip Chris Moesel (Mar 25 2020 at 22:19):

I suspect that most people would want us to set properties to 1.. automatically if they have a fixed value, but... I don't think this is strictly required by FHIR and there might be use cases where you make something optional but fix the value so that if the user does use it, it must be this value. Still, we welcome thoughts on this...

view this post on Zulip Jean Duteau (Mar 25 2020 at 22:22):

if you a) have a fixed value and b) are using it as the discriminator, I suspect that it should be considered as 1..1 for the specific slices. In my instance, I'm saying that there are three optional slices. When I use the slice later on, we can assume that system (the fixed discriminator) is 1..1 for the slice only.

view this post on Zulip Lloyd McKenzie (Mar 26 2020 at 04:59):

I know we've discussed having that as a rule, though I don't remember if a change request has been submitted or approved. Certainly the elements along the path to the discriminator where a fixed value (for value slicing) or pattern (for pattern slicing) in a slice must be 1..x. (Can't be 0..x or 2+..x)

view this post on Zulip Chris Moesel (Mar 26 2020 at 12:33):

Yeah, I think we can make that happen automagically in SUSHI then (for fixed values in a discriminator path). We'll look into it.


Last updated: Apr 12 2022 at 19:14 UTC