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/EncounterVisitMapV4 | Version: 2.0.0-ballot | ||||
| Standards status: Trial-use | Maturity Level: 2 | Computable Name: EncounterVisitMapV4 | |||
| Other Identifiers: OID:2.16.840.1.113883.4.642.40.80.43.16 | |||||
This mapping maps FHIR Encounter instances to OMOP Visit Occurence Table objects.
Language: en
/// url = 'http://hl7.org/fhir/uv/omop/StructureMap/EncounterVisitMapV4' /// version = '2.0.0-ballot' /// name = 'EncounterVisitMapV4' /// title = 'Mapping Encounter resource to VisitOccurrence OMOP Domain V4' /// status = 'active' /// description = 'This mapping maps FHIR Encounter instances to OMOP Visit Occurence Table objects.' uses "http://hl7.org/fhir/StructureDefinition/Encounter|4.0.1" alias Encounter as source uses "http://hl7.org/fhir/uv/omop/StructureDefinition/VisitOccurrence" alias VisitTable as target group VisitOccurrence(source src : Encounter, target tgt : VisitTable) { src where (src.period.empty().not()) then { // OMOP Visit Occurrence 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.visit_occurrence_id = cast(id, 'integer'); } "encounterIdFromIdentifier"; } "encounterId"; // OMOP Person ID would be a map from the FHIR Encounter Subject reference to an external key src.subject as subject -> tgt then { subject.reference as s -> tgt.person_id = (%s.substring(%s.indexOf('/') + 1)); }; src.class as s -> tgt then { s.code as a -> tgt.visit_concept_id = translate(a, 'http://hl7.org/fhir/uv/omop/ConceptMap/EncounterClass', 'code'), tgt.visit_source_value = cast(a, 'string'); }; src.period as s -> tgt then { s.start as std -> tgt.visit_start_date = (src.period.start.toString().substring(0, 10)), tgt.visit_start_datetime = cast(std, 'dateTime'); s.end as ed -> tgt.visit_end_date = (src.period.end.toString().substring(0, 10)), tgt.visit_end_datetime = cast(ed, 'dateTime'); }; src.hospitalization as s -> tgt then { s.admitSource as sa -> tgt then { sa.coding as sc -> tgt then { sc.code as code -> tgt.admitted_from_concept_id = translate(code, 'http://hl7.org/fhir/uv/omop/ConceptMap/EncounterAdmitSource', 'code'), tgt.admitted_from_source_value = cast(code, 'string'); }; }; s.dischargeDisposition as sd -> tgt then { sd.coding as sc -> tgt then { sc.code as code -> tgt.discharged_to_concept_id = translate(code, 'http://hl7.org/fhir/uv/omop/ConceptMap/EncounterDischargeDisposition', 'code'), tgt.discharged_to_source_value = cast(code, 'string'); }; }; }; } "visitOccurrenceMap"; }