Stream: shorthand
Topic: Bug: Slice name equals Resource type
Yannick Börner (Feb 25 2022 at 16:55):
Before opening an issue on Github, I'd just like to check whether this is intended behaviour. Suppose the slice name equals a resource type, like this:
* subject 1.. MS
* ^slicing.discriminator.type = #type
* ^slicing.discriminator.path = "resolve()"
* ^slicing.rules = #open
* subject contains Patient 1..1 MS
* subject[Patient] only Reference(Patient)
SUSHI will not actually generate a type
element in the StructureDefinition, so the type is not restricted to Patient in this slice. I am wondering whether this is not supposed to work in the first place (i.e. slice name == resource type) or if this is indeed a bug?
Chris Moesel (Feb 25 2022 at 17:29):
Hi @Yannick Börner. Can you provide a little more information about what you are trying to do? If this is for Observation.subject
, then Observation.subject
is not a list. Since it seems like you are saying that the Patient reference is 1..1 MS
, then isn't that basically the same as this?
* subject 1..1 MS
* subject only Reference(Patient)
Or is there some other nuance I am missing?
Yannick Börner (Feb 28 2022 at 15:54):
Hi @Chris Moesel , certainly! The profile in question is this profile on Account. What I am trying to achieve is the following:
- Allow several subject references
- However, a minimum of one Patient reference must exist
In my understanding, the FSH above should cover these requirements. That's where I stumbled upon the above error, where the type
element is not generated if the slice is called 'Patient'. If I rename it to something other than a resource type, everything works.
Chris Moesel (Mar 01 2022 at 18:47):
Thanks, @Yannick Börner. Now that I think of it, I bet you're running into an unintended consequence of our reference path syntax. When you say subject[Patient]
it thinks you are referring to the Patient
reference in the subject
element, not the Patient
slice. That's unfortunate (especially since reference paths actually have very limited use) -- but I don't see any way around it. So I guess we do have a limitation that you can't name a slice something that is also the name of a resource when that element also has a reference to the same resource. Sorry about that!
Yannick Börner (Mar 03 2022 at 13:38):
All fine and dandy, this is why I wanted to ask before opening an issue :-) Thank you for looking into it! Should we improve the error message though?
Chris Moesel (Mar 03 2022 at 14:26):
Yeah, I'll have to see if we can easily detect that situation and warn on it.
Last updated: Apr 12 2022 at 19:14 UTC