Stream: conformance
Topic: Constrain a string
Rik Smithies (Aug 17 2021 at 16:52):
Is it possible to constrain a string to be one of a set of values? This is for Composition.section.title.
Ideally something like a preferred value set binding.
The only things I can think of are:
- to constrain to a pattern (one of several strings, 'or'd) using ElementDefinition.constraint.expression (but I can't find any documentation here http://build.fhir.org/datatypes-definitions.html#ElementDefinition.constraint.expression)
- have a slice on each possible string value
Neither seem good.
Lloyd McKenzie (Aug 17 2021 at 17:11):
You can put a value set on a string
Oliver Egger (Aug 17 2021 at 18:51):
@Rik Smithies we used the first approach for our document (section) titles: http://fhir.ch/ig/ch-emed/StructureDefinition-ch-emed-composition-medicationcard.html with a constraint:
($this='Medikationsplan' and %resource.language.startsWith('de')) or ($this='Plan de médication' and %resource.language.startsWith('fr')) or ($this='Piano farmacologico' and %resource.language.startsWith('it')) or ($this='Medication Card' and %resource.language.startsWith('en'))
we were not aware that you can bind a ValueSet to a string as @Lloyd McKenzie mentions, but for that we would need to create for each string a ValueSet and a CodeSystem for all titles and we would loose the language check.
Rik Smithies (Aug 18 2021 at 20:12):
thanks both. I have only just realised that there is any documentation for ElementDefinition elements, because the UML links that I always use are all broken... FHIR#33207
Kevin Mayfield (Aug 19 2021 at 07:24):
Have also started going down the same route as @Oliver Egger and using constraints.
image.png
https://simplifier.net/guide/nhsdigital/NHSDigital-Practitioner
Last updated: Apr 12 2022 at 19:14 UTC