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 Blood Pressure Vital Signs resource to Measurement OMOP Domain V4

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

This mapping maps blood pressure FHIR Vital Signs instances that are considered measurements to OMOP Measurement Table objects.

Language: en

/// url = 'http://hl7.org/fhir/uv/omop/StructureMap/BloodPressureVitalSignsMapV4'
/// version = '2.0.0-ballot'
/// name = 'BloodPressureVitalSignsMapV4'
/// title = 'Mapping Blood Pressure Vital Signs resource to Measurement OMOP Domain V4'
/// status = 'active'
/// description = 'This mapping maps blood pressure FHIR Vital Signs instances that are considered measurements to OMOP Measurement Table objects.'

uses "http://hl7.org/fhir/StructureDefinition/Observation|4.0.1" alias BloodPressure as source
uses "http://hl7.org/fhir/uv/omop/StructureDefinition/RecordSet" alias BPRecord as target
uses "http://hl7.org/fhir/uv/omop/StructureDefinition/Measurement" alias Measurement as target

// make the bundle
group BloodPressure(source src : BloodPressure, target recordSet : BPRecord) {
  src where (src.category.coding.code contains 'vital-signs') then {
    src where (src.effective.empty().not()) then {
      src.code as s -> recordSet then {
        s.coding as sc -> recordSet then {
          sc.code as a where (a in ('85354-9' | '8478-0')) -> recordSet then {
            src as parent -> recordSet.measurement as measurement then parentTable(parent, measurement) "bpMeasurement";
            src.component as comp -> recordSet then {
              comp where (comp.code.coding.code = '8480-6') -> recordSet.measurement as measurement then Systolic(src, comp, measurement) "systolicMeasurement";
              comp where (comp.code.coding.code = '8462-4') -> recordSet.measurement as measurement then Diastolic(src, comp, measurement) "diastolicMeasurement";
            };
          };
        };
      };
    } "bpMapping";
  } "bpComponentEntries";
}

group parentTable(source src : BloodPressure, target tgt : Measurement) {
  src as s -> tgt then {
    s.identifier as i -> tgt then {
      i.value as id -> tgt.measurement_id = cast(id, 'code');
    } "measurementIdFromIdentifier";
  } "measurementId";
  src.code as s -> tgt then {
    s.coding as sc -> tgt then {
      sc.code as a -> tgt.measurement_type_concept_id = translate(a, 'http://hl7.org/fhir/uv/omop/ConceptMap/BloodPressureCodes', 'code');
      sc.display as display -> tgt.measurement_concept_id = cast(display, 'code');
    };
  };
  src.effective : dateTime as edt ->  tgt.measurement_datetime = cast(edt, 'dateTime'),  tgt.measurement_date = (edt.toString().substring(0, 10));
  src.effective : instant as einst ->  tgt.measurement_datetime = cast(einst, 'dateTime'),  tgt.measurement_date = (einst.toString().substring(0, 10));
  src.effective : Period as s -> tgt then {
    s.start as eps ->  tgt.measurement_datetime = cast(eps, 'dateTime'),  tgt.measurement_date = (eps.toString().substring(0, 10));
  } "MeasurementDate";
}

// make the systolic measurement table
group Systolic(source parent : BloodPressure, source comp, target tgt : Measurement) {
  parent.effective : dateTime as edt ->  tgt.measurement_datetime = cast(edt, 'dateTime'),  tgt.measurement_date = (edt.toString().substring(0, 10));
  parent.effective : instant as einst ->  tgt.measurement_datetime = cast(einst, 'dateTime'),  tgt.measurement_date = (einst.toString().substring(0, 10));
  parent.effective : Period as s -> tgt then {
    s.start as eps ->  tgt.measurement_datetime = cast(eps, 'dateTime'),  tgt.measurement_date = (eps.toString().substring(0, 10));
  } "MeasurementDate";
  comp.value : Quantity as s -> tgt then {
    s.value as a -> tgt.value_as_number = cast(a, 'decimal');
    s.unit as b -> tgt.unit_concept_id = cast(b, 'code');
  };
}

// make the diastolic measurement table
group Diastolic(source parent : BloodPressure, source comp, target tgt : Measurement) {
  parent.effective : dateTime as edt ->  tgt.measurement_datetime = cast(edt, 'dateTime'),  tgt.measurement_date = (edt.toString().substring(0, 10));
  parent.effective : instant as einst ->  tgt.measurement_datetime = cast(einst, 'dateTime'),  tgt.measurement_date = (einst.toString().substring(0, 10));
  parent.effective : Period as s -> tgt then {
    s.start as eps ->  tgt.measurement_datetime = cast(eps, 'dateTime'),  tgt.measurement_date = (eps.toString().substring(0, 10));
  } "MeasurementDate";
  comp.value : Quantity as s -> tgt then {
    s.value as a ->  tgt.value_as_number = cast(a, 'decimal'),  tgt.value_source_value = cast(a, 'string');
    s.unit as b ->  tgt.unit_concept_id = cast(b, 'code'),  tgt.unit_source_value = cast(b, 'string');
  };
}