FHIR Chat · Mapping canonical field to/from R3 · mapping-framework

Stream: mapping-framework

Topic: Mapping canonical field to/from R3


view this post on Zulip 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?

view this post on Zulip Lloyd McKenzie (May 27 2020 at 14:10):

@Grahame Grieve

view this post on Zulip 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

view this post on Zulip Lloyd McKenzie (Jun 04 2020 at 03:52):

Ok, but is that statement valid in the FHIR mapping language?

view this post on Zulip Grahame Grieve (Jun 04 2020 at 03:53):

umm. yes? I mean, it compiles and executes ok...

view this post on Zulip 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?

view this post on Zulip Alexander Zautke (Jun 04 2020 at 15:02):

Yes, that happens for all types for which there is a group with a <<types>> annotation

view this post on Zulip Alexander Zautke (Jun 04 2020 at 15:02):

Have a look here: https://github.com/FHIR/interversion/blob/master/r4/R4toR3/primitives.map

view this post on Zulip Morten Ernebjerg (Jun 04 2020 at 20:19):

Great, thanks @Alexander Zautke !


Last updated: Apr 12 2022 at 19:14 UTC