Stream: mapping-framework
Topic: Adding a 'let' statement
Ewout Kramer (Aug 20 2019 at 16:24):
Yesterday during the FHIR-I teleconf, we discussed GF#21642, asking for the addition of a "const" or "let" to the mapping language, so you can define, say, a named constant for an often-used extension url in your mapping.
like so:
let TariffFormExtensionUrl = 'http://uk-koeln.de/fhir/StructureDefinition/Extension/nNGM/pkvTarifform/0.1'
We have several things we want to discuss before we decide on adding this:
- Where do we allow a let? Just at the top of the mapping file with a global scope? Inside each group or nested set of dependent rules?
- The
let
would just define a read-only label, you cannot re-assign another value to it later on. - It would need to be defined at the beginning of a group, it makes no sense to insert a let between rules.
- Would this only work with constant values? E.g. should we let the right hand side of the let contain function calls? Or refer to variables/aliases defined in the parent scope of the
let
? - If a constant, shall we call it 'const'?
Currently, my engine supports constant values only, and they need to be included just before the first group in a map. When serialized to a StructureMap, I emit an extension:
<StructureMap xmlns="http://hl7.org/fhir"> <extension url="http://hl7.org/fhir/5.0/StructureDefinition/extension-StructureMap.let"> <extension url="name"> <valueString value="TariffFormExtensionUrl" /> </extension> <extension url="value"> <valueString value="http://uk-koeln.de/fhir/StructureDefinition/Extension/nNGM/pkvTarifform/0.1" /> </extension> </extension> <url value="http://fire.ly/tests/AllFeatures" />
Grahame Grieve (Aug 21 2019 at 19:23):
what type can it have? primitive only?
Grahame Grieve (Aug 21 2019 at 19:24):
can it be defined at group scope?
Simone Heckmann (Sep 16 2019 at 14:50):
right hand side should allow at least the function uuid().
When your target is a Bundle, you may want to assign fullUrls to your entries that you can later use within different grous to link your resources together.
David Hay (Dec 05 2019 at 05:39):
global scope would mean that they could all go at the top of the mapping file, making them easier to see. Would also support use across different groups...
Last updated: Apr 12 2022 at 19:14 UTC