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 Patient resource to Person OMOP Domain V4

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

This mapping maps FHIR Patient instances to OMOP Person Table objects.

Language: en

/// url = 'http://hl7.org/fhir/uv/omop/StructureMap/PersonMapV4'
/// version = '2.0.0-ballot'
/// name = 'PersonMapV4'
/// title = 'Mapping Patient resource to Person OMOP Domain V4'
/// status = 'active'
/// description = 'This mapping maps FHIR Patient instances to OMOP Person Table objects.'

uses "http://hl7.org/fhir/StructureDefinition/Patient|4.0.0" alias Patient as source
uses "http://hl7.org/fhir/uv/omop/StructureDefinition/Person" alias PersonTable as target

group Person(source src : Patient, target tgt : PersonTable) {
  // OMOP person 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.person_id = cast(id, 'integer');
    } "personIdFromIdentifier";
  } "personId";
  src.gender as gender ->  tgt.gender_concept_id = translate(gender, 'http://hl7.org/fhir/uv/omop/ConceptMap/GenderClass', 'code'),  tgt.gender_source_value = gender;
  src where (src.gender.empty()) ->  tgt.gender_concept_id = 0,  tgt.gender_source_value = 'unknown' "nogender";
  src.birthDate as bdSrc ->  tgt.birth_datetime = cast(bdSrc, 'dateTime'),  tgt.year_of_birth = (src.birthDate.toString().substring(0, 4)),  tgt.month_of_birth = (src.birthDate.toString().substring(5, 2)),  tgt.day_of_birth = (src.birthDate.toString().substring(8, 2));
}