Stream: shorthand
Topic: Optional slices and goFSH
Morten Ernebjerg (Jun 07 2021 at 10:41):
Hi :wave: I'm using goFSH tool to turn an existing Composition profile designed in Forge into FSH. The profile slices Composition.section
and one of those slices is optional (0..*
, to be precise). The corresponding entry in the StructureDefinition has neither min
nor max
fields:
{
"id": "Composition.section:questionnaire",
"path": "Composition.section",
"sliceName": "questionnaire",
"short": "Questionnaires used in the software"
}
In addition, two fields in the entry
element are defined as required in that slice. However, running goFSH on this gives a required slice in FSH:
* section contains
[other slices]
questionnaire 1..* and
[other slices]
which indeed compiles into an a slice entry like the above, except that it explicitly sets min
and max
to 1 and *, respectively. So it seems goFSH assumes that the default minimum slice cardinality is 1. I didn't see any statement on this (or the contrary) in the ElementDefinition documentation - was this a deliberate choice?
Chris Moesel (Jun 07 2021 at 13:14):
I don't think that is a deliberate choice. It may be a bug. Is there a public FHIR JSON/XML representation we can look at to try to reproduce this?
Morten Ernebjerg (Jun 07 2021 at 16:02):
Hi @Chris Moesel, here is a minimal example that leads to this behavior - the quest slice should be optional but gets converted into a required slice.
I discovered that this is related to the fact that the profile also sets the cardinality of Composition.section
to 1..*
. If that cardinality is set to 0..*
, the slice remains optional (is set to 0..*
). However, since the slicing is open, it is of course valid to only have an optional slice.
Chris Moesel (Jun 07 2021 at 17:04):
Thanks... we're a bit tied up at the moment trying to get some last minute things in for FHIR DevDays, but hopefully we can take a look at this soon. Your example and analysis is very helpful. Thank you!
Morten Ernebjerg (Jun 07 2021 at 18:02):
A worthy cause - after all, I myself learned FSH from your session at the last DevDays :nerd:
Chris Moesel (Jun 16 2021 at 22:17):
I've logged this as GoFSH#135. We hope to fix this in the next two-week sprint (which starts tomorrow).
Last updated: Apr 12 2022 at 19:14 UTC