FHIR © HL7.org  |  Server Home  |  XIG Home  |  Server Source  |  FHIR  

FHIR IG Statistics: StructureMap/MedicationMap

Packagehl7.fhir.uv.omop
TypeStructureMap
IdMedicationMap
FHIR VersionR5
Sourcehttp://hl7.org/fhir/uv/omop/https://build.fhir.org/ig/HL7/fhir-omop-ig/StructureMap-MedicationMap.html
URLhttp://hl7.org/fhir/uv/omop/StructureMap/MedicationMap
Version1.0.0-ballot
Statusdraft
Date2025-07-22T19:48:02+00:00
NameMedicationMap
TitleMapping MedicationStatement resource to DrugExposure OMOP Domain
Realmuv
Authorityhl7
DescriptionThis mapping maps FHIR MedicationStatement instances to OMOP Drug Exposure Table objects. NOTE: It does not map FHIR MedicationRequest instances although there is a discussion of those instances in the notes.

Resources that use this resource

No resources found


Resources that this resource uses

No resources found


Narrative

Note: links and images are rebased to the (stated) source

Generated Narrative: StructureMap MedicationMap

/// url = 'http://hl7.org/fhir/uv/omop/StructureMap/MedicationMap'
/// name = 'MedicationMap'
/// title = 'Mapping MedicationStatement resource to DrugExposure OMOP Domain'
/// status = 'draft'

uses "http://hl7.org/fhir/StructureDefinition/MedicationStatement" alias MedState as source
uses "http://hl7.org/fhir/uv/omop/StructureDefinition/DrugExposure" alias DrugExpTable as target

group MedExposure(source src : MedState, target tgt : DrugExpTable) {
  src.medication : CodeableReference as s -> tgt then {
    s.concept as scs -> tgt then {
      scs.coding as sc -> tgt then {
        sc.code as a -> tgt.drug_concept_id = a;
      };
    };
  }; // src.id as id -> tgt.drug_exposure_id = cast(id, "integer");
  src.effective : dateTime as edt ->  tgt.drug_exposure_start_datetime = edt,  tgt.drug_exposure_start_date = cast(edt, 'date');
  src.effective : Period as s -> tgt then {
    s.start as fps ->  tgt.drug_exposure_start_datetime = fps,  tgt.drug_exposure_start_date = cast(fps, 'date');
  };
  src.effective : Period as s -> tgt then {
    s.end as fpe ->  tgt.drug_exposure_end_datetime = fpe,  tgt.drug_exposure_end_date = cast(fps, 'date');
  };
  src.effective : Period as s -> tgt then {
    s.end as fpe -> tgt.verbatim_end_date = cast(fps, 'date');
  };
  src.category : CodeableConcept as s -> tgt then {
    s.coding as sc -> tgt then {
      sc.code as a -> tgt.drug_type_concept_id = a;
    };
  };
  src.reason : CodeableReference as s -> tgt then {
    s.concept as scs -> tgt then {
      scs.coding as sc -> tgt then {
        sc.code as a -> tgt.stop_reason = a;
      };
    };
  };
}


Source

{
  "resourceType": "StructureMap",
  "id": "MedicationMap",
  "text": {
    "status": "generated",
    "div": "<!-- snip (see above) -->"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
      "valueCode": "brr"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
      "valueInteger": 1,
      "_valueInteger": {
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom",
            "valueCanonical": "http://hl7.org/fhir/uv/omop/ImplementationGuide/hl7.fhir.uv.omop"
          }
        ]
      }
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
      "valueCode": "informative",
      "_valueCode": {
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom",
            "valueCanonical": "http://hl7.org/fhir/uv/omop/ImplementationGuide/hl7.fhir.uv.omop"
          }
        ]
      }
    }
  ],
  "url": "http://hl7.org/fhir/uv/omop/StructureMap/MedicationMap",
  "version": "1.0.0-ballot",
  "name": "MedicationMap",
  "title": "Mapping MedicationStatement resource to DrugExposure OMOP Domain",
  "status": "draft",
  "date": "2025-07-22T19:48:02+00:00",
  "publisher": "HL7 International / Biomedical Research and Regulation",
  "contact": [
    {
      "name": "HL7 International / Biomedical Research and Regulation",
      "telecom": [
        {
          "system": "url",
          "value": "http://www.hl7.org/Special/committees/rcrim"
        }
      ]
    }
  ],
  "description": "This mapping maps FHIR MedicationStatement instances to OMOP Drug Exposure Table objects.  NOTE: It does not map FHIR MedicationRequest instances although there is a discussion of those instances in the notes.",
  "jurisdiction": [
    {
      "coding": [
        {
          "system": "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code": "001",
          "display": "World"
        }
      ]
    }
  ],
  "structure": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/MedicationStatement",
      "mode": "source",
      "alias": "MedState"
    },
    {
      "url": "http://hl7.org/fhir/uv/omop/StructureDefinition/DrugExposure",
      "mode": "target",
      "alias": "DrugExpTable"
    }
  ],
  "group": [
    {
      "name": "MedExposure",
      "input": [
        {
          "name": "src",
          "type": "MedState",
          "mode": "source"
        },
        {
          "name": "tgt",
          "type": "DrugExpTable",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "medicationCodeableReference",
          "source": [
            {
              "context": "src",
              "type": "CodeableReference",
              "element": "medication",
              "variable": "s"
            }
          ],
          "target": [
            {
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "tgt"
                }
              ]
            }
          ],
          "rule": [
            {
              "name": "concept",
              "source": [
                {
                  "context": "s",
                  "element": "concept",
                  "variable": "scs"
                }
              ],
              "target": [
                {
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "tgt"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "coding",
                  "source": [
                    {
                      "context": "scs",
                      "element": "coding",
                      "variable": "sc"
                    }
                  ],
                  "target": [
                    {
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "tgt"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "sc",
                          "element": "code",
                          "variable": "a"
                        }
                      ],
                      "target": [
                        {
                          "context": "tgt",
                          "element": "drug_concept_id",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "a"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ],
          "documentation": "src.id as id -> tgt.drug_exposure_id = cast(id, \"integer\");"
        },
        {
          "name": "effectiveDateTime",
          "source": [
            {
              "context": "src",
              "type": "dateTime",
              "element": "effective",
              "variable": "edt"
            }
          ],
          "target": [
            {
              "context": "tgt",
              "element": "drug_exposure_start_datetime",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "edt"
                }
              ]
            },
            {
              "context": "tgt",
              "element": "drug_exposure_start_date",
              "transform": "cast",
              "parameter": [
                {
                  "valueId": "edt"
                },
                {
                  "valueString": "date"
                }
              ]
            }
          ]
        },
        {
          "name": "effectivePeriod",
          "source": [
            {
              "context": "src",
              "type": "Period",
              "element": "effective",
              "variable": "s"
            }
          ],
          "target": [
            {
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "tgt"
                }
              ]
            }
          ],
          "rule": [
            {
              "name": "start",
              "source": [
                {
                  "context": "s",
                  "element": "start",
                  "variable": "fps"
                }
              ],
              "target": [
                {
                  "context": "tgt",
                  "element": "drug_exposure_start_datetime",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "fps"
                    }
                  ]
                },
                {
                  "context": "tgt",
                  "element": "drug_exposure_start_date",
                  "transform": "cast",
                  "parameter": [
                    {
                      "valueId": "fps"
                    },
                    {
                      "valueString": "date"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "effectivePeriod",
          "source": [
            {
              "context": "src",
              "type": "Period",
              "element": "effective",
              "variable": "s"
            }
          ],
          "target": [
            {
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "tgt"
                }
              ]
            }
          ],
          "rule": [
            {
              "name": "end",
              "source": [
                {
                  "context": "s",
                  "element": "end",
                  "variable": "fpe"
                }
              ],
              "target": [
                {
                  "context": "tgt",
                  "element": "drug_exposure_end_datetime",
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "fpe"
                    }
                  ]
                },
                {
                  "context": "tgt",
                  "element": "drug_exposure_end_date",
                  "transform": "cast",
                  "parameter": [
                    {
                      "valueId": "fps"
                    },
                    {
                      "valueString": "date"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "effectivePeriod",
          "source": [
            {
              "context": "src",
              "type": "Period",
              "element": "effective",
              "variable": "s"
            }
          ],
          "target": [
            {
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "tgt"
                }
              ]
            }
          ],
          "rule": [
            {
              "name": "end",
              "source": [
                {
                  "context": "s",
                  "element": "end",
                  "variable": "fpe"
                }
              ],
              "target": [
                {
                  "context": "tgt",
                  "element": "verbatim_end_date",
                  "transform": "cast",
                  "parameter": [
                    {
                      "valueId": "fps"
                    },
                    {
                      "valueString": "date"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "categoryCodeableConcept",
          "source": [
            {
              "context": "src",
              "type": "CodeableConcept",
              "element": "category",
              "variable": "s"
            }
          ],
          "target": [
            {
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "tgt"
                }
              ]
            }
          ],
          "rule": [
            {
              "name": "coding",
              "source": [
                {
                  "context": "s",
                  "element": "coding",
                  "variable": "sc"
                }
              ],
              "target": [
                {
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "tgt"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "sc",
                      "element": "code",
                      "variable": "a"
                    }
                  ],
                  "target": [
                    {
                      "context": "tgt",
                      "element": "drug_type_concept_id",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "a"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "reasonCodeableReference",
          "source": [
            {
              "context": "src",
              "type": "CodeableReference",
              "element": "reason",
              "variable": "s"
            }
          ],
          "target": [
            {
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "tgt"
                }
              ]
            }
          ],
          "rule": [
            {
              "name": "concept",
              "source": [
                {
                  "context": "s",
                  "element": "concept",
                  "variable": "scs"
                }
              ],
              "target": [
                {
                  "transform": "copy",
                  "parameter": [
                    {
                      "valueId": "tgt"
                    }
                  ]
                }
              ],
              "rule": [
                {
                  "name": "coding",
                  "source": [
                    {
                      "context": "scs",
                      "element": "coding",
                      "variable": "sc"
                    }
                  ],
                  "target": [
                    {
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "tgt"
                        }
                      ]
                    }
                  ],
                  "rule": [
                    {
                      "name": "code",
                      "source": [
                        {
                          "context": "sc",
                          "element": "code",
                          "variable": "a"
                        }
                      ],
                      "target": [
                        {
                          "context": "tgt",
                          "element": "stop_reason",
                          "transform": "copy",
                          "parameter": [
                            {
                              "valueId": "a"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}