# Mapping Patient resource to Location OMOP Domain - Data Management with FHIR v0.1.0

* [**Table of Contents**](toc.md)
* [**Artifacts Summary**](artifacts.md)
* **Mapping Patient resource to Location OMOP Domain**

## StructureMap: Mapping Patient resource to Location OMOP Domain 

| | |
| :--- | :--- |
| *Official URL*:https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPLocation | *Version*:0.1.0 |
| Draft as of 2025-10-23 | *Computable Name*:CoreFHIR2OMOPLocation |

 
Mapping Patient resource to Location OMOP Domain 

```

map "https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPLocation" = "CoreFHIR2OMOPLocation"

// Mapping Patient resource to Location OMOP Domain

uses "http://hl7.org/fhir/StructureDefinition/Address" alias Address as source
uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPLocation" alias LocationTable as target

group Location(source src : Address, target tgt : LocationTable) {
  src.line first as srcLine1 -> tgt.address_1 = srcLine1 "setLineOne";
  src.line not_first as srcLine2 -> tgt.address_2 = srcLine2 "setLineTwo";
  src.city as srcCity -> tgt.city = srcCity "setCity";
  src.postalCode as srcZip -> tgt.zip = srcZip "setZip";
  src.country as srcCountry -> tgt.country_source_value = srcCountry "setCountry";
  src.text as srcText -> tgt.location_source_value = truncate(srcText, 50) "setVerbatim";
  src.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";
}


```



## Resource Content

```json
{
  "resourceType" : "StructureMap",
  "id" : "CoreFHIR2OMOPLocation",
  "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPLocation",
  "version" : "0.1.0",
  "name" : "CoreFHIR2OMOPLocation",
  "title" : "Mapping Patient resource to Location OMOP Domain",
  "status" : "draft",
  "date" : "2025-10-23T20:49:03+00:00",
  "publisher" : "AP-HP",
  "contact" : [
    {
      "name" : "AP-HP",
      "telecom" : [
        {
          "system" : "url",
          "value" : "https://aphp.fr"
        }
      ]
    }
  ],
  "description" : "Mapping Patient resource to Location OMOP Domain",
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "urn:iso:std:iso:3166",
          "code" : "FR",
          "display" : "France"
        }
      ]
    }
  ],
  "structure" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Address",
      "mode" : "source",
      "alias" : "Address"
    },
    {
      "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPLocation",
      "mode" : "target",
      "alias" : "LocationTable"
    }
  ],
  "group" : [
    {
      "name" : "Location",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "Address",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "LocationTable",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "setLineOne",
          "source" : [
            {
              "context" : "src",
              "element" : "line",
              "listMode" : "first",
              "variable" : "srcLine1"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "address_1",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "srcLine1"
                }
              ]
            }
          ]
        },
        {
          "name" : "setLineTwo",
          "source" : [
            {
              "context" : "src",
              "element" : "line",
              "listMode" : "not_first",
              "variable" : "srcLine2"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "address_2",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "srcLine2"
                }
              ]
            }
          ]
        },
        {
          "name" : "setCity",
          "source" : [
            {
              "context" : "src",
              "element" : "city",
              "variable" : "srcCity"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "city",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "srcCity"
                }
              ]
            }
          ]
        },
        {
          "name" : "setZip",
          "source" : [
            {
              "context" : "src",
              "element" : "postalCode",
              "variable" : "srcZip"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "zip",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "srcZip"
                }
              ]
            }
          ]
        },
        {
          "name" : "setCountry",
          "source" : [
            {
              "context" : "src",
              "element" : "country",
              "variable" : "srcCountry"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "country_source_value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "srcCountry"
                }
              ]
            }
          ]
        },
        {
          "name" : "setVerbatim",
          "source" : [
            {
              "context" : "src",
              "element" : "text",
              "variable" : "srcText"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "location_source_value",
              "transform" : "truncate",
              "parameter" : [
                {
                  "valueId" : "srcText"
                },
                {
                  "valueInteger" : 50
                }
              ]
            }
          ]
        },
        {
          "name" : "setGeolocation",
          "source" : [
            {
              "context" : "src",
              "element" : "extension",
              "variable" : "geolocation",
              "condition" : "(url = 'http://hl7.org/fhir/StructureDefinition/geolocation')"
            }
          ],
          "rule" : [
            {
              "name" : "setLatitude",
              "source" : [
                {
                  "context" : "geolocation",
                  "element" : "extension",
                  "variable" : "latitude",
                  "condition" : "(url = 'latitude')"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "latitude",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "%latitude.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setLongitude",
              "source" : [
                {
                  "context" : "geolocation",
                  "element" : "extension",
                  "variable" : "longitude",
                  "condition" : "(url = 'longitude')"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "longitude",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "%longitude.value"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

```
