FHIR to OMOP FHIR IG, published by HL7 International / Biomedical Research and Regulation. This guide is not an authorized publication; it is the continuous build for version 2.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-omop-ig/ and changes regularly. See the Directory of published versions
| Official URL: http://hl7.org/fhir/uv/omop/StructureMap/AllergyMapV4 | Version: 2.0.0-ballot | ||||
| Standards status: Trial-use | Maturity Level: 2 | Computable Name: AllergyMapV4 | |||
| Other Identifiers: OID:2.16.840.1.113883.4.642.40.80.43.13 | |||||
This mapping maps FHIR AllergyIntolerance instances to OMOP Observation Table objects.
Language: en
/// url = 'http://hl7.org/fhir/uv/omop/StructureMap/AllergyMapV4' /// version = '2.0.0-ballot' /// name = 'AllergyMapV4' /// title = 'Mapping Allergy resource to Observation OMOP Domain V4' /// status = 'active' /// description = 'This mapping maps FHIR AllergyIntolerance instances to OMOP Observation Table objects.' uses "http://hl7.org/fhir/StructureDefinition/AllergyIntolerance|4.0.1" alias Allergy as source uses "http://hl7.org/fhir/uv/omop/StructureDefinition/Observation" alias ObservationTable as target group Allergy(source src : Allergy, target tgt : ObservationTable) { src where (src.recordedDate.empty().not() | src.onset.empty().not()) then { // OMOP Observation ID would be a map from FHIR ID to an external key src as s -> tgt then { s.identifier as i -> tgt then { i.value as id -> tgt.observation_id = cast(id, 'integer'); } "allergyIdFromIdentifier"; } "allergyId"; // OMOP Person ID would be a map from the FHIR Allergy Patient reference to an external key src.patient as subject -> tgt then { subject.reference as s -> tgt.person_id = (%s.substring(%s.indexOf('/') + 1)); }; // OMOP Visit Occurrence ID would be a map from the FHIR Allergy Encounter reference to an external key src.encounter as encounter -> tgt then { encounter.reference as e -> tgt.visit_occurrence_id = (%e.substring(%e.indexOf('/') + 1)); }; src.type as code where (code = 'allergy') then { src.category as category -> tgt.observation_concept_id = translate(category, 'http://hl7.org/fhir/uv/omop/ConceptMap/AllergyType', 'code'); }; src.type as code where (code = 'intolerance') then { src.category as category -> tgt.observation_concept_id = translate(category, 'http://hl7.org/fhir/uv/omop/ConceptMap/IntoleranceType', 'code'); }; src.code as s -> tgt then { s.coding as sc -> tgt then { sc.system as s where (s = 'http://snomed.info/sct') then { sc.code as code -> tgt.value_as_concept_id = translate(code, 'http://hl7.org/fhir/uv/omop/ConceptMap/AllergySubstanceType', 'code'), tgt.value_source_value = cast(code, 'string'); sc.display as display -> tgt.value_as_string = cast(display, 'string'); }; }; }; src.recordedDate : dateTime as osd -> tgt.observation_date = (src.recordedDate.toString().substring(0, 10)), tgt.observation_datetime = cast(osd, 'dateTime'); src where (src.recordedDate.empty()) then { src.onset : dateTime as osd -> tgt.observation_date = (src.onset.toString().substring(0, 10)), tgt.observation_datetime = cast(osd, 'dateTime'); } "allergyDateTime"; } "allergyMap"; }