Stream: mapping-framework
Topic: Mapping canonical field to/from R3
Morten Ernebjerg (May 27 2020 at 13:51):
I am looking at the R4 -> STU3 maps of QuestionnaireResponse
. The field questionnaire
changed type, from a reference (STU3) to a canonical URL (R4). However, the mapping (in either direction) is simply
src.questionnaire -> tgt.questionnaire;
Is there some automatic mapping done (behind the scenes) when the R4 type is canonical
?
Lloyd McKenzie (May 27 2020 at 14:10):
@Grahame Grieve
Grahame Grieve (Jun 04 2020 at 01:43):
well, it's not done behind the scenes, but in one of the libraries:
group canonical2Reference(source src : canonical, target tgt : ReferenceR3) <<types>> {
src.id -> tgt.id "Element-id";
src.extension where (url.startsWith('http://hl7.org/fhir/3.0/StructureDefinition').not() and (url != 'http://hl7.org/fhir/StructureDefinition/rendered-value')) -> tgt.extension "Element-extensions";
src.value -> tgt.reference "reference";
src.extension as e where url = 'http://hl7.org/fhir/StructureDefinition/rendered-value' then {
e.value -> tgt.display;
};
}
And the equivalent exists in R3 -> R4
Lloyd McKenzie (Jun 04 2020 at 03:52):
Ok, but is that statement valid in the FHIR mapping language?
Grahame Grieve (Jun 04 2020 at 03:53):
umm. yes? I mean, it compiles and executes ok...
Morten Ernebjerg (Jun 04 2020 at 14:42):
Just to make sure I get this right: the "trivial map" src.x -> tgt.y
can actually involve a standard type transformation if src.x
and tgt.y
have different types? If so, is there a list of the type pairs where this happens?
Alexander Zautke (Jun 04 2020 at 15:02):
Yes, that happens for all types for which there is a group with a <<types>> annotation
Alexander Zautke (Jun 04 2020 at 15:02):
Have a look here: https://github.com/FHIR/interversion/blob/master/r4/R4toR3/primitives.map
Morten Ernebjerg (Jun 04 2020 at 20:19):
Great, thanks @Alexander Zautke !
Last updated: Apr 12 2022 at 19:14 UTC