# Mapping simple Observation laboratory resources to Measurement OMOP Domain - Data Management with FHIR v0.1.0

* [**Table of Contents**](toc.md)
* [**Artifacts Summary**](artifacts.md)
* **Mapping simple Observation laboratory resources to Measurement OMOP Domain**

## StructureMap: Mapping simple Observation laboratory resources to Measurement OMOP Domain 

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

 
Mapping simple Observation laboratory resources to Measurement OMOP Domain 

```

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

// Mapping simple Observation laboratory resources to Measurement OMOP Domain

uses "http://hl7.org/fhir/StructureDefinition/Observation" alias LabObs as source
uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPMeasurement" alias MeasurementTable as target

group SimpleObservation(source src : LabObs, target tgt : MeasurementTable) {
  src.subject as srcSubject -> tgt.person_id = srcSubject "setSubject"; // reference impropre dans le monde OMOP mais permet d'illustrer l'information qui doit être utilisée pour retrouver la bonne OMOPPerson
  src.code as srcCode -> tgt.measurement_concept_id = create('Reference') as tgtReference then {
    srcCode.coding as srcCoding ->  translate(srcCoding, 'https://interop.aphp.fr/ig/fhir/dm/ConceptMap/LabAnalyses', 'code') as measurementCode,  tgtReference.reference = append('Concept/', measurementCode) "setMeasurementConcept";
  } "createMeasurementConcept";
  src.effective : dateTime as srcDateTime then {
    srcDateTime -> tgt.measurement_datetime = srcDateTime "setDateTime";
    srcDateTime -> tgt.measurement_date = (%srcDateTime.toString().substring(0, 10)) "setDateNotTime";
  } "SetDate";
  src.value : Quantity as srcValueQuantity then {
    srcValueQuantity.value as srcResultValue -> tgt.value_as_number = srcResultValue "setResultValue";
    srcValueQuantity -> tgt.operator_concept_id = create('Reference') as tgtReference then {
      srcValueQuantity.comparator as srcValueComparator ->  translate(srcValueComparator, 'https://interop.aphp.fr/ig/fhir/dm/ConceptMap/LabComparator', 'code') as comparatorCode,  tgtReference.reference = append('Concept/', comparatorCode) "setComparatorConcept";
    } "createComparatorConcept";
    srcValueQuantity -> tgt.unit_concept_id = create('Reference') as tgtReference then {
      srcValueQuantity.code as srcValueCode ->  translate(srcValueCode, 'https://interop.aphp.fr/ig/fhir/dm/ConceptMap/LabUnit', 'code') as unitCode,  tgtReference.reference = append('Concept/', unitCode) "createUnitConcept";
    } "setUnitConcept";
    srcValueQuantity.code as srcValueCode -> tgt.unit_source_value = srcValueCode "setUnitSourceValue";
  } "SetValue";
  src.referenceRange as srcRange then {
    srcRange.low as srcRangeLow then {
      srcRangeLow.value as srcRangeLowValue -> tgt.range_low = srcRangeLowValue "setRangeLow1";
    } "setRangeLow0";
    srcRange.high as srcRangeHigh then {
      srcRangeHigh.value as srcRangeHighValue -> tgt.range_high = srcRangeHighValue "setRangeHigh1";
    } "setRangeHigh0";
  } "setRange";
  src.performer as srcPerformer -> tgt.provider_id = srcPerformer "setPerformer"; // reference impropre dans le monde OMOP mais permet d'illustrer l'information qui doit être utilisée pour retrouver le bon OMOPProvider
}


```



## Resource Content

```json
{
  "resourceType" : "StructureMap",
  "id" : "CoreSimpleObservation2OMOPMeasurement",
  "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureMap/CoreSimpleObservation2OMOPMeasurement",
  "version" : "0.1.0",
  "name" : "CoreSimpleObservation2OMOPMeasurement",
  "title" : "Mapping simple Observation laboratory resources to Measurement 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 simple Observation laboratory resources to Measurement OMOP Domain",
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "urn:iso:std:iso:3166",
          "code" : "FR",
          "display" : "France"
        }
      ]
    }
  ],
  "structure" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Observation",
      "mode" : "source",
      "alias" : "LabObs"
    },
    {
      "url" : "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/OMOPMeasurement",
      "mode" : "target",
      "alias" : "MeasurementTable"
    }
  ],
  "group" : [
    {
      "name" : "SimpleObservation",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "LabObs",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "MeasurementTable",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "setSubject",
          "source" : [
            {
              "context" : "src",
              "element" : "subject",
              "variable" : "srcSubject"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "person_id",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "srcSubject"
                }
              ]
            }
          ],
          "documentation" : "reference impropre dans le monde OMOP mais permet d'illustrer l'information qui doit être utilisée pour retrouver la bonne OMOPPerson"
        },
        {
          "name" : "createMeasurementConcept",
          "source" : [
            {
              "context" : "src",
              "element" : "code",
              "variable" : "srcCode"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "measurement_concept_id",
              "variable" : "tgtReference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "Reference"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "setMeasurementConcept",
              "source" : [
                {
                  "context" : "srcCode",
                  "element" : "coding",
                  "variable" : "srcCoding"
                }
              ],
              "target" : [
                {
                  "contextType" : "variable",
                  "variable" : "measurementCode",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "srcCoding"
                    },
                    {
                      "valueString" : "https://interop.aphp.fr/ig/fhir/dm/ConceptMap/LabAnalyses"
                    },
                    {
                      "valueString" : "code"
                    }
                  ]
                },
                {
                  "context" : "tgtReference",
                  "contextType" : "variable",
                  "element" : "reference",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "Concept/"
                    },
                    {
                      "valueId" : "measurementCode"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "SetDate",
          "source" : [
            {
              "context" : "src",
              "type" : "dateTime",
              "element" : "effective",
              "variable" : "srcDateTime"
            }
          ],
          "rule" : [
            {
              "name" : "setDateTime",
              "source" : [
                {
                  "context" : "srcDateTime"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "measurement_datetime",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "srcDateTime"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setDateNotTime",
              "source" : [
                {
                  "context" : "srcDateTime"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "measurement_date",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "%srcDateTime.toString().substring(0, 10)"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "SetValue",
          "source" : [
            {
              "context" : "src",
              "type" : "Quantity",
              "element" : "value",
              "variable" : "srcValueQuantity"
            }
          ],
          "rule" : [
            {
              "name" : "setResultValue",
              "source" : [
                {
                  "context" : "srcValueQuantity",
                  "element" : "value",
                  "variable" : "srcResultValue"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "value_as_number",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "srcResultValue"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "createComparatorConcept",
              "source" : [
                {
                  "context" : "srcValueQuantity"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "operator_concept_id",
                  "variable" : "tgtReference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "setComparatorConcept",
                  "source" : [
                    {
                      "context" : "srcValueQuantity",
                      "element" : "comparator",
                      "variable" : "srcValueComparator"
                    }
                  ],
                  "target" : [
                    {
                      "contextType" : "variable",
                      "variable" : "comparatorCode",
                      "transform" : "translate",
                      "parameter" : [
                        {
                          "valueId" : "srcValueComparator"
                        },
                        {
                          "valueString" : "https://interop.aphp.fr/ig/fhir/dm/ConceptMap/LabComparator"
                        },
                        {
                          "valueString" : "code"
                        }
                      ]
                    },
                    {
                      "context" : "tgtReference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "Concept/"
                        },
                        {
                          "valueId" : "comparatorCode"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setUnitConcept",
              "source" : [
                {
                  "context" : "srcValueQuantity"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "unit_concept_id",
                  "variable" : "tgtReference",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Reference"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "createUnitConcept",
                  "source" : [
                    {
                      "context" : "srcValueQuantity",
                      "element" : "code",
                      "variable" : "srcValueCode"
                    }
                  ],
                  "target" : [
                    {
                      "contextType" : "variable",
                      "variable" : "unitCode",
                      "transform" : "translate",
                      "parameter" : [
                        {
                          "valueId" : "srcValueCode"
                        },
                        {
                          "valueString" : "https://interop.aphp.fr/ig/fhir/dm/ConceptMap/LabUnit"
                        },
                        {
                          "valueString" : "code"
                        }
                      ]
                    },
                    {
                      "context" : "tgtReference",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "append",
                      "parameter" : [
                        {
                          "valueString" : "Concept/"
                        },
                        {
                          "valueId" : "unitCode"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setUnitSourceValue",
              "source" : [
                {
                  "context" : "srcValueQuantity",
                  "element" : "code",
                  "variable" : "srcValueCode"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "unit_source_value",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueId" : "srcValueCode"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setRange",
          "source" : [
            {
              "context" : "src",
              "element" : "referenceRange",
              "variable" : "srcRange"
            }
          ],
          "rule" : [
            {
              "name" : "setRangeLow0",
              "source" : [
                {
                  "context" : "srcRange",
                  "element" : "low",
                  "variable" : "srcRangeLow"
                }
              ],
              "rule" : [
                {
                  "name" : "setRangeLow1",
                  "source" : [
                    {
                      "context" : "srcRangeLow",
                      "element" : "value",
                      "variable" : "srcRangeLowValue"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "range_low",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srcRangeLowValue"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "setRangeHigh0",
              "source" : [
                {
                  "context" : "srcRange",
                  "element" : "high",
                  "variable" : "srcRangeHigh"
                }
              ],
              "rule" : [
                {
                  "name" : "setRangeHigh1",
                  "source" : [
                    {
                      "context" : "srcRangeHigh",
                      "element" : "value",
                      "variable" : "srcRangeHighValue"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "range_high",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "srcRangeHighValue"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "setPerformer",
          "source" : [
            {
              "context" : "src",
              "element" : "performer",
              "variable" : "srcPerformer"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "provider_id",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "srcPerformer"
                }
              ]
            }
          ],
          "documentation" : "reference impropre dans le monde OMOP mais permet d'illustrer l'information qui doit être utilisée pour retrouver le bon OMOPProvider"
        }
      ]
    }
  ]
}

```
