Guide d'implémentation du GT Standards et Interopérabilité pour les EDS
0.1.0 - ci-build France flag

Guide d'implémentation du GT Standards et Interopérabilité pour les EDS - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

StructureMap: Mapping Patient resource to Person OMOP Domain

Official URL: https://interop.esante.gouv.fr/ig/fhir/eds/StructureMap/Person Version: 0.1.0
Draft as of 2024-10-08 Computable Name: Person

Mapping Patient resource to Person OMOP Domain

Generated Narrative: StructureMap Person

map "https://interop.esante.gouv.fr/ig/fhir/eds/StructureMap/Person" = "Person"

// Mapping Patient resource to Person OMOP Domain

uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as source
uses "https://interop.esante.gouv.fr/ig/fhir/eds/StructureDefinition/OMOPPerson" alias PersonTable as target

group Person(source src : Patient, target tgt : PersonTable) {
  src.id as srcId -> tgt.person_source_value = srcId;
  src.gender as srcGender then {
    srcGender -> tgt.gender_concept_id = create('Reference') as tgtReference then {
      srcGender ->  translate(srcGender, 'https://interop.esante.gouv.fr/ig/fhir/eds/ConceptMap/Gender', 'code') as genderCode,  tgtReference.reference = append('Concept/', genderCode) "ref";
    } "refConcept";
    srcGender -> tgt.gender_source_value = srcGender "sourceGender";
  };
  src.birthDate as srcBirthDate then {
    srcBirthDate -> tgt.birth_datetime = srcBirthDate "dateTime";
    srcBirthDate -> tgt.year_of_birth = (%srcBirthDate.toString().substring(0, 4).toInteger()) "year";
    srcBirthDate -> tgt.month_of_birth = (%srcBirthDate.toString().substring(5, 2).toInteger()) "month";
    srcBirthDate -> tgt.day_of_birth = (%srcBirthDate.toString().substring(8, 2).toInteger()) "day";
  };
}