medication.fml · fhir2omop
refs/refs/fhir-omop-ig/input/maps/medication.fml
46 lines · fml
1/// url = 'http://hl7.org/fhir/uv/omop/StructureMap/MedicationMap' 2/// name = 'MedicationMap' 3/// title = 'Mapping MedicationStatement resource to DrugExposure OMOP Domain' 5/// description = "This mapping maps FHIR MedicationStatement instances to OMOP Drug Exposure Table objects. NOTE: It does not map FHIR MedicationRequest instances although there is a discussion of those instances in the notes." 7uses "http://hl7.org/fhir/StructureDefinition/MedicationStatement" alias MedState as source 8uses "http://hl7.org/fhir/uv/omop/StructureDefinition/DrugExposure" alias DrugExpTable as target 10group MedExposure(source src : MedState, target tgt : DrugExpTable) { 11 //src.id as id -> tgt.drug_exposure_id = cast(id, "integer"); 12 //src.subject as s -> tgt then { 13 //s.identifier as sid -> tgt then { 14 // sid.value as a -> tgt.person_id = a; 17 src.medication : CodeableReference as s -> tgt then { 18 s.concept as scs -> tgt then { 19 scs.coding as sc -> tgt then { 20 sc.code as a -> tgt.drug_concept_id = a; 24 src.effective : dateTime as edt -> tgt.drug_exposure_start_datetime = edt, tgt.drug_exposure_start_date = cast(edt, "date"); 25 src.effective : Period as s -> tgt then { 26 s.start as fps -> tgt.drug_exposure_start_datetime = fps, tgt.drug_exposure_start_date = cast(fps, "date"); 28 src.effective : Period as s -> tgt then { 29 s.end as fpe -> tgt.drug_exposure_end_datetime = fpe, tgt.drug_exposure_end_date = cast(fps, "date"); 31 src.effective : Period as s -> tgt then { 32 s.end as fpe -> tgt.verbatim_end_date = cast(fps, "date"); 34 src.category : CodeableConcept as s -> tgt then { 35 s.coding as sc -> tgt then { 36 sc.code as a -> tgt.drug_type_concept_id = a; 39 src.reason : CodeableReference as s -> tgt then { 40 s.concept as scs -> tgt then { 41 scs.coding as sc -> tgt then { 42 sc.code as a -> tgt.stop_reason = a;