FHIR to OMOP FHIR IG
2.0.0-ballot - STU 1 Ballot International flag

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

StructureMap: Mapping an International Patient Summary resource to OMOP domains collected in a RecordSet resource

Official URL: http://hl7.org/fhir/uv/omop/StructureMap/RecordSetMap Version: 2.0.0-ballot
Standards status: Trial-use Maturity Level: 2 Computable Name: RecordSetMap
Other Identifiers: OID:2.16.840.1.113883.4.642.40.77.43.10

This mapping maps a FHIR International Patient Summary Bundle to a set of OMOP Patient records collected in a RecordSet resource.

Language: en

/// url = 'http://hl7.org/fhir/uv/omop/StructureMap/RecordSetMap'
/// name = 'RecordSetMap'
/// title = 'Mapping an International Patient Summary resource to OMOP domains collected in a RecordSet resource'
/// status = 'active'
/// description = 'This mapping maps a FHIR International Patient Summary Bundle to a set of OMOP Patient records collected in a RecordSet resource.'

uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as source
uses "http://hl7.org/fhir/uv/omop/StructureDefinition/RecordSet" alias RecordSetTable as target

imports "http://hl7.org/fhir/uv/omop/StructureMap/AllergyMap"
imports "http://hl7.org/fhir/uv/omop/StructureMap/BloodPressureVitalSignsMap"
imports "http://hl7.org/fhir/uv/omop/StructureMap/ConditionMap"
imports "http://hl7.org/fhir/uv/omop/StructureMap/EncounterVisitMap"
imports "http://hl7.org/fhir/uv/omop/StructureMap/ImmunizationMap"
imports "http://hl7.org/fhir/uv/omop/StructureMap/MeasurementMap"
imports "http://hl7.org/fhir/uv/omop/StructureMap/PersonMap"
imports "http://hl7.org/fhir/uv/omop/StructureMap/ProcedureMap"
imports "http://hl7.org/fhir/uv/omop/StructureMap/SimpleVitalSignsMap"

group RecordSet(source src : Bundle, target tgt : RecordSetTable) {
  src.id as s -> tgt then {
    s.id as id -> tgt.record_id = (%id.substring(%id.indexOf('/') + 1));
  };
  // Map bundle timestamp
  src.timestamp as ts -> tgt.record_set_timestamp = ts;
  // Map bundle entries
  src.entry as entry -> tgt then {
    entry.resource : AllergyIntolerance as a -> tgt then {
      a -> tgt.allergy as allergy then Allergy(a, allergy) "allergyEntry";
    } "allergyIntoleranceEntry";
    entry.resource : Condition as condition -> tgt then {
      condition -> tgt.condition as conditionOccurrence then ConditionOccurrence(condition, conditionOccurrence) "conditionEntry";
    } "conditionOccurenceEntry";
    entry.resource : Encounter as encounter -> tgt then {
      encounter -> tgt.visitOccurrence as visitOccurrence then VisitOccurrence(encounter, visitOccurrence) "encounterEntry";
    } "conditionOccurenceEntry";
    entry.resource : Observation as observation -> tgt then {
      observation -> tgt.measurement as measurement then Measures(observation, measurement) "measurementEntry";
      observation -> tgt as recordSet then BloodPressure(observation, recordSet) "bloodPressureEntry";
      observation -> tgt.measurement as vitalSign then VitalSigns(observation, vitalSign) "simpleVitalSignEntry";
    } "observationEntry";
    entry.resource : Patient as patient -> tgt then {
      patient as s -> tgt then {
        s.id as id -> tgt.patient_id = cast(id, 'integer');
      } "personID";
    };
    entry.resource : Encounter as encounter -> tgt then {
      encounter -> tgt.visitOccurrence as visit then VisitOccurrence(encounter, visit) "visit";
    };
  } "bundleEntry";
}