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

lines 49–49 53 lines · fml
1/// url = 'http://hl7.org/fhir/uv/omop/StructureMap/ObservationMap'
2/// name = 'ObservationMap'
3/// title = 'Mapping Observation resource to Observation OMOP Domain'
4/// status = 'draft'
5/// description = "This mapping maps FHIR Observation instances that are NOT considered measurements to OMOP Observation Table objects. Currently, this is done by considering the category code and mapping 'social-history', 'imaging', 'survey', 'exam', 'therapy', 'activity', and 'procedure' Observations."
7uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as source
8uses "http://hl7.org/fhir/uv/omop/StructureDefinition/Observation" alias ObsTable as target
10 group Observe(source src : Observation, target tgt : ObsTable)
11 {
12 src where ('social-history' | 'imaging' | 'survey' | 'exam' | 'therapy' | 'activity' | 'procedure' ).supersetOf(Observation.category.coding.code) then {
13 //src.id as id -> tgt.observation_id = cast(id, "integer");
14 src.code as s -> tgt then {
15 s.coding as sc -> tgt then {
16 sc.code as a -> tgt.observation_concept_id = a;
17 };
18 };
19 // src.subject as s -> tgt then {
20 // s.identifier as sid -> tgt then {
21 // sid.value as a-> tgt.person_id = a;
22 // };
23 //};
24 // src.encounter as s -> tgt then {
25 // s.identifier as sid -> tgt then {
26 // sid.value as b -> tgt.visit_occurrence_id = b;
27 // };
28 //};
29 src.effective : dateTime as a -> tgt.observation_datetime = a , tgt.observation_date = cast(a, "date");
30 src.effective : instant as einst -> tgt.observation_datetime = cast(einst, "dateTime"), tgt.observation_date = cast(einst, "date");
31 src.effective : Period as s -> tgt then {
32 s.start as ss -> tgt.observation_datetime = cast(ss, "dateTime"), tgt.observation_date = cast(ss, "date");
33 };
34 src.issued as s where (s.toDate != src.effectiveDate) -> tgt.observation_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_as_string = b;
50 src.note as d -> tgt.observation_source_value = d;
51 } "OnlyObs";
52};