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 Location OMOP Domain

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

Mapping Patient resource to Location OMOP Domain

Generated Narrative: StructureMap Location

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

// Mapping Patient resource to Location OMOP Domain

uses "https://interop.esante.gouv.fr/ig/fhir/eds/StructureDefinition/EDSPatient" alias EDSPatient as source
uses "https://interop.esante.gouv.fr/ig/fhir/eds/StructureDefinition/EDSAddress" alias EDSAddress as source
uses "https://interop.esante.gouv.fr/ig/fhir/eds/StructureDefinition/OMOPLocation" alias LocationTable as target

group Location(source src : EDSPatient, target tgt : LocationTable) {
  src.address as srcAddress where (use = 'home') and period.end.empty() then {
    srcAddress.line first as srcLine1 -> tgt.address_1 = srcLine1;
    srcAddress.line last as srcLine2 where srcLine1 != srcLine2 -> tgt.address_2 = srcLine2;
    srcAddress.city as srcCity -> tgt.city = srcCity;
    srcAddress.postalCode as srcZip -> tgt.zip = srcZip;
    srcAddress.text as srcText -> tgt.location_source_value = truncate(srcText, 50);
    srcAddress.extension as geolocation where (url = 'http://hl7.org/fhir/StructureDefinition/geolocation') then {
      geolocation.extension as latitude where (url = 'latitude') -> tgt.latitude = (%latitude.value) "setLatitude";
      geolocation.extension as longitude where (url = 'longitude') -> tgt.longitude = (%longitude.value) "setLongitude";
    } "setGeolocation";
  };
}