FHIR © HL7.org  |  FHIRsmith 4.0.1  |  Server Home  |  XIG Home  |  XIG Stats  | 

FHIR IG analytics

Packagehl7.fhir.uv.omop
Resource TypeStructureMap
IdStructureMap-AllergyMap.json
FHIR VersionR5
Sourcehttps://build.fhir.org/ig/HL7/fhir-omop-ig/StructureMap-AllergyMap.html
URLhttp://hl7.org/fhir/uv/omop/StructureMap/AllergyMap
Version1.0.0
Statusdraft
Date2026-04-02T22:51:15+00:00
NameAllergyMap
TitleMapping Allergy resource to Observation OMOP Domain
Realmuv
Authorityhl7
DescriptionThis mapping maps FHIR AllergyIntolerance instances to OMOP Observation Table objects.

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 AllergyMap

Language: en

/// url = 'http://hl7.org/fhir/uv/omop/StructureMap/AllergyMap'
/// name = 'AllergyMap'
/// title = 'Mapping Allergy resource to Observation OMOP Domain'
/// status = 'draft'

uses "http://hl7.org/fhir/StructureDefinition/AllergyIntolerance" alias Allergy as source
uses "http://hl7.org/fhir/uv/omop/StructureDefinition/Observation" alias ObservationTable as target

group Observation(source src : Allergy, target tgt : ObservationTable) {
  src.id -> tgt.observation_id = '1'; // OMOP Observation ID would be a map from FHIR ID to an external key
  src.patient -> tgt.person_id = '1'; // OMOP Person ID would be a map from the FHIR Allergy Patient reference to an external key
  src.encounter -> tgt.visit_occurrence_id = '1'; // OMOP Visit Occurrence ID would be a map from the FHIR Allergy Encounter reference to an external key
  src.type as s -> tgt then {
    s.coding as sc -> tgt then {
      sc.code as code where (code = 'allergy') then {
        src.category as category -> tgt.observation_concept_id = translate(category, 'http://hl7.org/fhir/uv/omop/ConceptMap/AllergyType', 'code');
      };
      src.code as code where (code = 'intolerance') then {
        src.category as category -> tgt.observation_concept_id = translate(category, 'http://hl7.org/fhir/uv/omop/ConceptMap/IntoleranceType', 'code');
      };
    };
  };
  src.code as s -> tgt then {
    s.coding as sc -> tgt then {
      sc.code as code ->  tgt.value_as_concept_id = translate(code, 'http://hl7.org/fhir/uv/omop/ConceptMap/AllergySubstanceType', 'code'),  tgt.value_source_value = code;
    };
  };
  src.recordedDate : dateTime as osd ->  tgt.observation_date = (src.recordedDate.toString().substring(0, 10)),  tgt.observation_datetime = osd;
}


Source1

{
  "resourceType": "StructureMap",
  "id": "AllergyMap",
  "language": "en",
  "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/AllergyMap",
  "version": "1.0.0",
  "name": "AllergyMap",
  "title": "Mapping Allergy resource to Observation OMOP Domain",
  "status": "draft",
  "date": "2026-04-02T22:51:15+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 AllergyIntolerance instances to OMOP Observation Table objects.",
  "jurisdiction": [
    {
      "coding": [
        {
          "system": "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code": "001",
          "display": "World"
        }
      ]
    }
  ],
  "structure": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/AllergyIntolerance",
      "mode": "source",
      "alias": "Allergy"
    },
    {
      "url": "http://hl7.org/fhir/uv/omop/StructureDefinition/Observation",
      "mode": "target",
      "alias": "ObservationTable"
    }
  ],
  "group": [
    {
      "name": "Observation",
      "input": [
        {
          "name": "src",
          "type": "Allergy",
          "mode": "source"
        },
        {
          "name": "tgt",
          "type": "ObservationTable",
          "mode": "target"
        }
      ],
      "rule": [
        {
          "name": "id",
          "source": [
            {
              "context": "src",
              "element": "id"
            }
          ],
          "target": [
            {
              "context": "tgt",
              "element": "observation_id",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "1"
                }
              ]
            }
          ],
          "documentation": "OMOP Observation ID would be a map from FHIR ID to an external key"
        },
        {
          "name": "patient",
          "source": [
            {
              "context": "src",
              "element": "patient"
            }
          ],
          "target": [
            {
              "context": "tgt",
              "element": "person_id",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "1"
                }
              ]
            }
          ],
          "documentation": "OMOP Person ID would be a map from the FHIR Allergy Patient reference to an external key"
        },
        {
          "name": "encounter",
          "source": [
            {
              "context": "src",
              "element": "encounter"
            }
          ],
          "target": [
            {
              "context": "tgt",
              "element": "visit_occurrence_id",
              "transform": "copy",
              "parameter": [
                {
                  "valueString": "1"
                }
              ]
            }
          ],
          "documentation": "OMOP Visit Occurrence ID would be a map from the FHIR Allergy Encounter reference to an external key"
        },
        {
          "name": "type",
          "source": [
            {
              "context": "src",
              "element": "type",
              "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": "code",
                      "condition": "(code = 'allergy')"
                    }
                  ],
                  "rule": [
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "src",
                          "element": "category",
                          "variable": "category"
                        }
                      ],
                      "target": [
                        {
                          "context": "tgt",
                          "element": "observation_concept_id",
                          "transform": "translate",
                          "parameter": [
                            {
                              "valueId": "category"
                            },
                            {
                              "valueString": "http://hl7.org/fhir/uv/omop/ConceptMap/AllergyType"
                            },
                            {
                              "valueString": "code"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "code",
                  "source": [
                    {
                      "context": "src",
                      "element": "code",
                      "variable": "code",
                      "condition": "(code = 'intolerance')"
                    }
                  ],
                  "rule": [
                    {
                      "name": "category",
                      "source": [
                        {
                          "context": "src",
                          "element": "category",
                          "variable": "category"
                        }
                      ],
                      "target": [
                        {
                          "context": "tgt",
                          "element": "observation_concept_id",
                          "transform": "translate",
                          "parameter": [
                            {
                              "valueId": "category"
                            },
                            {
                              "valueString": "http://hl7.org/fhir/uv/omop/ConceptMap/IntoleranceType"
                            },
                            {
                              "valueString": "code"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "code",
          "source": [
            {
              "context": "src",
              "element": "code",
              "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": "code"
                    }
                  ],
                  "target": [
                    {
                      "context": "tgt",
                      "element": "value_as_concept_id",
                      "transform": "translate",
                      "parameter": [
                        {
                          "valueId": "code"
                        },
                        {
                          "valueString": "http://hl7.org/fhir/uv/omop/ConceptMap/AllergySubstanceType"
                        },
                        {
                          "valueString": "code"
                        }
                      ]
                    },
                    {
                      "context": "tgt",
                      "element": "value_source_value",
                      "transform": "copy",
                      "parameter": [
                        {
                          "valueId": "code"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "recordedDateDateTime",
          "source": [
            {
              "context": "src",
              "type": "dateTime",
              "element": "recordedDate",
              "variable": "osd"
            }
          ],
          "target": [
            {
              "context": "tgt",
              "element": "observation_date",
              "transform": "evaluate",
              "parameter": [
                {
                  "valueString": "src.recordedDate.toString().substring(0, 10)"
                }
              ]
            },
            {
              "context": "tgt",
              "element": "observation_datetime",
              "transform": "copy",
              "parameter": [
                {
                  "valueId": "osd"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}