refs/refs/fhir-omop-ig/input/maps/Measurement.fml

54 lines · fml
1/// url = 'http://hl7.org/fhir/uv/omop/StructureMap/MeasurementMap'
2/// name = 'MeasurementMap'
3/// title = 'Mapping Observation resource to Measurement OMOP Domain'
4/// status = 'draft'
5/// description = "This mapping maps FHIR Observation instances that are considered measurements to OMOP Measurement Table objects. Currently, this is done by considering the category code and mapping 'vital-signs' and 'laboratory' Observations."
7uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as source
8uses "http://hl7.org/fhir/uv/omop/StructureDefinition/Measurement" alias MeasureTable as target
10group Measures(source src : Observation, target tgt : MeasureTable) {
11 src where ('vital-signs' | 'laboratory' ).supersetOf(Observation.category.coding.code) then {
12 //src.id as id -> tgt.measurement_id = cast(id, "integer");
13 src.code as s -> tgt then {
14 s.coding as sc -> tgt then {
15 sc.code as a -> tgt.measurement_concept_id = a;
16 };
17 };
18 //src.subject as s -> tgt then {
19 //s.identifier as sid -> tgt then {
20 // sid.value as a -> tgt.person_id = a;
21 //};
22 //};
23 //src.encounter as s -> tgt then {
24 // s.identifier as sid -> tgt then {
25 // sid.value as b -> tgt.visit_occurrence_id = b;
26 //};
27 //};
28 src.effective : dateTime as edt -> tgt.measurement_datetime = edt, tgt.measurement_date = cast(edt, "date");
29 src.effective : instant as einst -> tgt.measurement_datetime = cast(einst, "dateTime"), tgt.measurement_date = cast(einst, "date");
30 src.effective : Period as s -> tgt then {
31 s.start as eps -> tgt.measurement_datetime = cast(eps, "dateTime"), tgt.measurement_date = cast(eps, "date");
32 };
33 src.issued as s where (src.issued.toDate != src.effectiveDateTime) -> tgt.measurement_source_value = cast(s, "string");
35 //src.performer as s -> tgt then {
36 // s.identifier as sid -> tgt then {
37 // sid.value as b -> tgt.provider_id = b;
38 // };
39 //};
40 src.value : Quantity as s -> tgt then {
41 s.value as a -> tgt.value_as_number = a;
42 s.unit as b -> tgt.unit_concept_id = b;
43 };
44 src.value : CodeableConcept as s -> tgt then {
45 s.coding as sc -> tgt then {
46 sc.code as a -> tgt.value_as_concept_id = a;
47 };
48 };
49 src.value : string as b -> tgt.value_source_value = b;
50 src.interpretation as c -> tgt.value_as_concept_id = c;
51 src.note as d -> tgt.measurement_source_value = d; // complex notes should be in note table
52 } "OnlyMeasures";
53};