FHIR to OMOP FHIR IG
2.0.0-ballot - STU 1 Ballot International flag

FHIR to OMOP FHIR IG, published by HL7 International / Biomedical Research and Regulation. This guide is not an authorized publication; it is the continuous build for version 2.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-omop-ig/ and changes regularly. See the Directory of published versions

: Mapping Immunization resource to Drug Exposure OMOP Domain

Page standards status: Trial-use Maturity Level: 2

Raw xml | Download


<StructureMap xmlns="http://hl7.org/fhir">
  <id value="ImmunizationMap"/>
  <language value="en"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap ImmunizationMap</b></p><a name="ImmunizationMap"> </a><a name="hcImmunizationMap"> </a><pre class="fml">
<span style="color: #cc00cc">/// <b>url</b> = </span><span style="color: blue">'http://hl7.org/fhir/uv/omop/StructureMap/ImmunizationMap'</span>
<span style="color: #cc00cc">/// <b>name</b> = </span><span style="color: blue">'ImmunizationMap'</span>
<span style="color: #cc00cc">/// <b>title</b> = </span><span style="color: blue">'Mapping Immunization resource to Drug Exposure OMOP Domain'</span>
<span style="color: #cc00cc">/// <b>status</b> = </span><span style="color: blue">'active'</span>
<span style="color: #cc00cc">/// <b>description</b> = </span><span style="color: blue">'This mapping maps FHIR Immunization instances to OMOP Drug Exposure Table objects.'</span>

<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R5/immunization.html" title="Immunization">http://hl7.org/fhir/StructureDefinition/Immunization</a><span style="color: navy">&quot; </span><b>alias </b>Immunization <b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="StructureDefinition-DrugExposure.html" title="Drug Exposure OMOP Table">http://hl7.org/fhir/uv/omop/StructureDefinition/DrugExposure</a><span style="color: navy">&quot; </span><b>alias </b>DrugExposureTable <b>as </b><b>target</b>

<b>group </b>DrugExposure<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>Immunization, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>DrugExposureTable<span style="color: navy">)</span><span style="color: navy"> {
</span>  src<b> where </b><span style="color: navy">(</span>src.occurrence.empty().not()<span style="color: navy">)</span><b> then</b><span style="color: navy"> {
</span>    <span style="color: navy">// </span><span style="color: green">OMOP Drug Exposure ID would be a map from FHIR ID to an external key</span>
    src<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>      s.id<b> as </b><span style="color: maroon">id</span><span style="color: navy"><b> -&gt; </b></span>tgt.drug_exposure_id = <b>cast</b><span style="color: navy">(</span><span style="color: maroon">id</span><span style="color: navy">, </span><span style="color: blue">'integer'</span><span style="color: navy">)</span><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;immunizationID&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">// </span><span style="color: green">OMOP Person ID would be a map from the FHIR Immunization Patient reference to an external key</span>
    src.patient<b> as </b><span style="color: maroon">subject</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>      subject.reference<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -&gt; </b></span>tgt.person_id = <span style="color: navy">(</span>%s.substring(%s.indexOf('/') + 1)<span style="color: navy">)</span><span style="color: navy">;</span>
    <span style="color: navy">}</span><span style="color: navy">;</span>
    <span style="color: navy">// </span><span style="color: green">OMOP Visit Occurrence ID would be a map from the FHIR Immunization Encounter reference to an external key</span>
    src.encounter<b> as </b><span style="color: maroon">encounter</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>      encounter.reference<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -&gt; </b></span>tgt.visit_occurrence_id = <span style="color: navy">(</span>%e.substring(%e.indexOf('/') + 1)<span style="color: navy">)</span><span style="color: navy">;</span>
    <span style="color: navy">}</span><span style="color: navy">;</span>
    src.vaccineCode<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>      s.coding first<b> as </b><span style="color: maroon">sc</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>        sc.code<b> as </b><span style="color: maroon">c</span><span style="color: navy"><b> -&gt; </b></span> tgt.drug_concept_id = <b>translate</b><span style="color: navy">(</span><span style="color: maroon">c</span><span style="color: navy">, </span><span style="color: blue">'http://hl7.org/fhir/uv/omop/ConceptMap/ImmunizationVaccine'</span><span style="color: navy">, </span><span style="color: blue">'code'</span><span style="color: navy">)</span><span style="color: navy">, </span> tgt.drug_source_value = <span style="color: maroon">c</span><span style="color: navy">;</span>
      <span style="color: navy">}</span><span style="color: navy">;</span>
    <span style="color: navy">}</span><span style="color: navy">;</span>
    src.doseQuantity<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>      s.value<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -&gt; </b></span>tgt.quantity = <span style="color: maroon">s</span><span style="color: navy">;</span>
    <span style="color: navy">}</span><span style="color: navy">;</span>
    src.route<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>      s.coding<b> as </b><span style="color: maroon">sc</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>        sc.code<b> as </b><span style="color: maroon">c</span><span style="color: navy"><b> -&gt; </b></span> tgt.route_concept_id = <b>translate</b><span style="color: navy">(</span><span style="color: maroon">c</span><span style="color: navy">, </span><span style="color: blue">'http://hl7.org/fhir/uv/omop/ConceptMap/ImmunizationRoute'</span><span style="color: navy">, </span><span style="color: blue">'code'</span><span style="color: navy">)</span><span style="color: navy">, </span> tgt.route_source_value = <span style="color: maroon">c</span><span style="color: navy">;</span>
      <span style="color: navy">}</span><span style="color: navy">;</span>
    <span style="color: navy">}</span><span style="color: navy">;</span>
    src<b> where </b><span style="color: navy">(</span>src.informationSource.empty()<span style="color: navy">)</span><span style="color: navy"><b> -&gt; </b></span>tgt.drug_type_concept_id = <span style="color: blue">32818</span> <i>&quot;emptysource&quot;</i><span style="color: navy">;</span>
    src.informationSource<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>      s.concept<b> as </b><span style="color: maroon">concept</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>        concept.coding<b> as </b><span style="color: maroon">sc</span><span style="color: navy"><b> -&gt; </b></span>tgt<b> then</b><span style="color: navy"> {
</span>          sc.code<b> as </b><span style="color: maroon">c</span><span style="color: navy"><b> -&gt; </b></span>tgt.drug_type_concept_id = <b>translate</b><span style="color: navy">(</span><span style="color: maroon">c</span><span style="color: navy">, </span><span style="color: blue">'http://hl7.org/fhir/uv/omop/ConceptMap/ImmunizationSource'</span><span style="color: navy">, </span><span style="color: blue">'code'</span><span style="color: navy">)</span><span style="color: navy">;</span>
        <span style="color: navy">}</span><span style="color: navy">;</span>
      <span style="color: navy">}</span><span style="color: navy">;</span>
    <span style="color: navy">}</span><span style="color: navy">;</span>
    src.occurrence<span style="color: navy"> : </span>dateTime<b> as </b><span style="color: maroon">odt</span><span style="color: navy"><b> -&gt; </b></span> tgt.drug_exposure_start_date = <span style="color: navy">(</span>src.occurrence.toString().substring(0, 10)<span style="color: navy">)</span><span style="color: navy">, </span> tgt.drug_exposure_start_datetime = <span style="color: maroon">odt</span><span style="color: navy">, </span> tgt.drug_exposure_end_date = <span style="color: navy">(</span>src.occurrence.toString().substring(0, 10)<span style="color: navy">)</span><span style="color: navy">, </span> tgt.drug_exposure_end_datetime = <span style="color: maroon">odt</span><span style="color: navy">;</span>
    src.lotNumber<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -&gt; </b></span>tgt.lot_number<span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;drugExposureMapping&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span></pre></div>
  </text>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="brr"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
    <valueInteger value="2">
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom">
        <valueCanonical
                        value="http://hl7.org/fhir/uv/omop/ImplementationGuide/hl7.fhir.uv.omop"/>
      </extension>
    </valueInteger>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
    <valueCode value="trial-use">
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom">
        <valueCanonical
                        value="http://hl7.org/fhir/uv/omop/ImplementationGuide/hl7.fhir.uv.omop"/>
      </extension>
    </valueCode>
  </extension>
  <url value="http://hl7.org/fhir/uv/omop/StructureMap/ImmunizationMap"/>
  <identifier>
    <system value="urn:ietf:rfc:3986"/>
    <value value="urn:oid:2.16.840.1.113883.4.642.40.77.43.5"/>
  </identifier>
  <version value="2.0.0-ballot"/>
  <name value="ImmunizationMap"/>
  <title value="Mapping Immunization resource to Drug Exposure OMOP Domain"/>
  <status value="active"/>
  <date value="2026-08-14T16:09:20+00:00"/>
  <publisher value="HL7 International / Biomedical Research and Regulation"/>
  <contact>
    <name value="HL7 International / Biomedical Research and Regulation"/>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/rcrim"/>
    </telecom>
  </contact>
  <description
               value="This mapping maps FHIR Immunization instances to OMOP Drug Exposure Table objects."/>
  <jurisdiction>
    <coding>
      <system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
      <code value="001"/>
      <display value="World"/>
    </coding>
  </jurisdiction>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Immunization"/>
    <mode value="source"/>
    <alias value="Immunization"/>
  </structure>
  <structure>
    <url
         value="http://hl7.org/fhir/uv/omop/StructureDefinition/DrugExposure"/>
    <mode value="target"/>
    <alias value="DrugExposureTable"/>
  </structure>
  <group>
    <name value="DrugExposure"/>
    <input>
      <name value="src"/>
      <type value="Immunization"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="tgt"/>
      <type value="DrugExposureTable"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="drugExposureMapping"/>
      <source>
        <context value="src"/>
        <condition value="src.occurrence.empty().not()"/>
      </source>
      <rule>
        <name value="immunizationID"/>
        <source>
          <context value="src"/>
          <variable value="s"/>
        </source>
        <target>
          <context value="tgt"/>
        </target>
        <rule>
          <name value="id"/>
          <source>
            <context value="s"/>
            <element value="id"/>
            <variable value="id"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="drug_exposure_id"/>
            <transform value="cast"/>
            <parameter>
              <valueId value="id"/>
            </parameter>
            <parameter>
              <valueString value="integer"/>
            </parameter>
          </target>
        </rule>
        <documentation
                       value="OMOP Drug Exposure ID would be a map from FHIR ID to an external key"/>
      </rule>
      <rule>
        <name value="patient"/>
        <source>
          <context value="src"/>
          <element value="patient"/>
          <variable value="subject"/>
        </source>
        <target>
          <context value="tgt"/>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="subject"/>
            <element value="reference"/>
            <variable value="s"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="person_id"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="%s.substring(%s.indexOf('/') + 1)"/>
            </parameter>
          </target>
        </rule>
        <documentation
                       value="OMOP Person ID would be a map from the FHIR Immunization Patient reference to an external key"/>
      </rule>
      <rule>
        <name value="encounter"/>
        <source>
          <context value="src"/>
          <element value="encounter"/>
          <variable value="encounter"/>
        </source>
        <target>
          <context value="tgt"/>
        </target>
        <rule>
          <name value="reference"/>
          <source>
            <context value="encounter"/>
            <element value="reference"/>
            <variable value="e"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="visit_occurrence_id"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="%e.substring(%e.indexOf('/') + 1)"/>
            </parameter>
          </target>
        </rule>
        <documentation
                       value="OMOP Visit Occurrence ID would be a map from the FHIR Immunization Encounter reference to an external key"/>
      </rule>
      <rule>
        <name value="vaccineCode"/>
        <source>
          <context value="src"/>
          <element value="vaccineCode"/>
          <variable value="s"/>
        </source>
        <target>
          <context value="tgt"/>
        </target>
        <rule>
          <name value="coding"/>
          <source>
            <context value="s"/>
            <element value="coding"/>
            <listMode value="first"/>
            <variable value="sc"/>
          </source>
          <target>
            <context value="tgt"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="sc"/>
              <element value="code"/>
              <variable value="c"/>
            </source>
            <target>
              <context value="tgt"/>
              <element value="drug_concept_id"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="c"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/uv/omop/ConceptMap/ImmunizationVaccine"/>
              </parameter>
              <parameter>
                <valueString value="code"/>
              </parameter>
            </target>
            <target>
              <context value="tgt"/>
              <element value="drug_source_value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="c"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
      <rule>
        <name value="doseQuantity"/>
        <source>
          <context value="src"/>
          <element value="doseQuantity"/>
          <variable value="s"/>
        </source>
        <target>
          <context value="tgt"/>
        </target>
        <rule>
          <name value="value"/>
          <source>
            <context value="s"/>
            <element value="value"/>
            <variable value="s"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="quantity"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="s"/>
            </parameter>
          </target>
        </rule>
      </rule>
      <rule>
        <name value="route"/>
        <source>
          <context value="src"/>
          <element value="route"/>
          <variable value="s"/>
        </source>
        <target>
          <context value="tgt"/>
        </target>
        <rule>
          <name value="coding"/>
          <source>
            <context value="s"/>
            <element value="coding"/>
            <variable value="sc"/>
          </source>
          <target>
            <context value="tgt"/>
          </target>
          <rule>
            <name value="code"/>
            <source>
              <context value="sc"/>
              <element value="code"/>
              <variable value="c"/>
            </source>
            <target>
              <context value="tgt"/>
              <element value="route_concept_id"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="c"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/uv/omop/ConceptMap/ImmunizationRoute"/>
              </parameter>
              <parameter>
                <valueString value="code"/>
              </parameter>
            </target>
            <target>
              <context value="tgt"/>
              <element value="route_source_value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="c"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
      <rule>
        <name value="emptysource"/>
        <source>
          <context value="src"/>
          <condition value="src.informationSource.empty()"/>
        </source>
        <target>
          <context value="tgt"/>
          <element value="drug_type_concept_id"/>
          <transform value="copy"/>
          <parameter>
            <valueInteger value="32818"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="informationSource"/>
        <source>
          <context value="src"/>
          <element value="informationSource"/>
          <variable value="s"/>
        </source>
        <target>
          <context value="tgt"/>
        </target>
        <rule>
          <name value="concept"/>
          <source>
            <context value="s"/>
            <element value="concept"/>
            <variable value="concept"/>
          </source>
          <target>
            <context value="tgt"/>
          </target>
          <rule>
            <name value="coding"/>
            <source>
              <context value="concept"/>
              <element value="coding"/>
              <variable value="sc"/>
            </source>
            <target>
              <context value="tgt"/>
            </target>
            <rule>
              <name value="code"/>
              <source>
                <context value="sc"/>
                <element value="code"/>
                <variable value="c"/>
              </source>
              <target>
                <context value="tgt"/>
                <element value="drug_type_concept_id"/>
                <transform value="translate"/>
                <parameter>
                  <valueId value="c"/>
                </parameter>
                <parameter>
                  <valueString
                               value="http://hl7.org/fhir/uv/omop/ConceptMap/ImmunizationSource"/>
                </parameter>
                <parameter>
                  <valueString value="code"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
      </rule>
      <rule>
        <name value="occurrenceDateTime"/>
        <source>
          <context value="src"/>
          <type value="dateTime"/>
          <element value="occurrence"/>
          <variable value="odt"/>
        </source>
        <target>
          <context value="tgt"/>
          <element value="drug_exposure_start_date"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="src.occurrence.toString().substring(0, 10)"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <element value="drug_exposure_start_datetime"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="odt"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <element value="drug_exposure_end_date"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="src.occurrence.toString().substring(0, 10)"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <element value="drug_exposure_end_datetime"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="odt"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="lotNumber"/>
        <source>
          <context value="src"/>
          <element value="lotNumber"/>
          <variable value="s"/>
        </source>
        <target>
          <context value="tgt"/>
          <element value="lot_number"/>
        </target>
      </rule>
    </rule>
  </group>
</StructureMap>