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 Condition resource to Condition Occurrence OMOP Domain

Page standards status: Trial-use Maturity Level: 2

Raw xml | Download


<StructureMap xmlns="http://hl7.org/fhir">
  <id value="ConditionMap"/>
  <language value="en"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap ConditionMap</b></p><a name="ConditionMap"> </a><a name="hcConditionMap"> </a><pre class="fml">
<span style="color: #cc00cc">/// <b>url</b> = </span><span style="color: blue">'http://hl7.org/fhir/uv/omop/StructureMap/ConditionMap'</span>
<span style="color: #cc00cc">/// <b>name</b> = </span><span style="color: blue">'ConditionMap'</span>
<span style="color: #cc00cc">/// <b>title</b> = </span><span style="color: blue">'Mapping Condition resource to Condition Occurrence 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 Condition instances to OMOP Condition Occurence Table objects.'</span>

<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R5/condition.html" title="Condition">http://hl7.org/fhir/StructureDefinition/Condition</a><span style="color: navy">&quot; </span><b>alias </b>Condition <b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="StructureDefinition-ConditionOccurrence.html" title="Condition Occurrence OMOP Table">http://hl7.org/fhir/uv/omop/StructureDefinition/ConditionOccurrence</a><span style="color: navy">&quot; </span><b>alias </b>ConOccTable <b>as </b><b>target</b>

<b>group </b>ConditionOccurrence<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>Condition, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>ConOccTable<span style="color: navy">)</span><span style="color: navy"> {
</span>  src<b> where </b><span style="color: navy">(</span>src.recordedDate.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 Condition 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.condition_occurrence_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;conditionID&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 Condition subject reference to an external key</span>
    src.subject<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>
    src.code<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">a</span><span style="color: navy"><b> -&gt; </b></span>tgt.condition_concept_id = <b>translate</b><span style="color: navy">(</span><span style="color: maroon">a</span><span style="color: navy">, </span><span style="color: blue">'http://hl7.org/fhir/uv/omop/ConceptMap/ConditionConcepts'</span><span style="color: navy">, </span><span style="color: blue">'code'</span><span style="color: navy">)</span><span style="color: navy">;</span>
        sc.display<b> as </b><span style="color: maroon">d</span><span style="color: navy"><b> -&gt; </b></span>tgt.condition_source_value = <span style="color: maroon">d</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.recordedDate<b> as </b><span style="color: maroon">rd</span><span style="color: navy"><b> -&gt; </b></span> tgt.condition_start_datetime = <b>cast</b><span style="color: navy">(</span><span style="color: maroon">rd</span><span style="color: navy">, </span><span style="color: blue">'dateTime'</span><span style="color: navy">)</span><span style="color: navy">, </span> tgt.condition_start_date = <b>cast</b><span style="color: navy">(</span><span style="color: maroon">rd</span><span style="color: navy">, </span><span style="color: blue">'date'</span><span style="color: navy">)</span><span style="color: navy">;</span>
    src.onset<span style="color: navy"> : </span>dateTime<b> as </b><span style="color: maroon">osd</span><span style="color: navy"><b> -&gt; </b></span> tgt.condition_start_datetime = <span style="color: maroon">osd</span><span style="color: navy">, </span> tgt.condition_start_date = <b>cast</b><span style="color: navy">(</span><span style="color: maroon">osd</span><span style="color: navy">, </span><span style="color: blue">'date'</span><span style="color: navy">)</span><span style="color: navy">;</span>
    src.abatement<span style="color: navy"> : </span>dateTime<b> as </b><span style="color: maroon">abdt</span><span style="color: navy"><b> -&gt; </b></span> tgt.condition_end_datetime = <span style="color: maroon">abdt</span><span style="color: navy">, </span> tgt.condition_end_date = <b>cast</b><span style="color: navy">(</span><span style="color: maroon">abdt</span><span style="color: navy">, </span><span style="color: blue">'date'</span><span style="color: navy">)</span><span style="color: navy">;</span>
    src.clinicalStatus<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">a</span><span style="color: navy"><b> -&gt; </b></span> tgt.condition_status_concept_id = <b>translate</b><span style="color: navy">(</span><span style="color: maroon">a</span><span style="color: navy">, </span><span style="color: blue">'http://hl7.org/fhir/uv/omop/ConceptMap/ConditionStatusConcepts'</span><span style="color: navy">, </span><span style="color: blue">'code'</span><span style="color: navy">)</span><span style="color: navy">, </span> tgt.condition_status_source_value = <span style="color: maroon">a</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.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.category<span style="color: navy"><b> -&gt; </b></span>tgt.condition_type_concept_id = <span style="color: blue">32817</span> <i>&quot;default&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;conditionMapping&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/ConditionMap"/>
  <identifier>
    <system value="urn:ietf:rfc:3986"/>
    <value value="urn:oid:2.16.840.1.113883.4.642.40.77.43.3"/>
  </identifier>
  <version value="2.0.0-ballot"/>
  <name value="ConditionMap"/>
  <title
         value="Mapping Condition resource to Condition Occurrence 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 Condition instances to OMOP Condition Occurence 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/Condition"/>
    <mode value="source"/>
    <alias value="Condition"/>
  </structure>
  <structure>
    <url
         value="http://hl7.org/fhir/uv/omop/StructureDefinition/ConditionOccurrence"/>
    <mode value="target"/>
    <alias value="ConOccTable"/>
  </structure>
  <group>
    <name value="ConditionOccurrence"/>
    <input>
      <name value="src"/>
      <type value="Condition"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="tgt"/>
      <type value="ConOccTable"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="conditionMapping"/>
      <source>
        <context value="src"/>
        <condition value="src.recordedDate.empty().not()"/>
      </source>
      <rule>
        <name value="conditionID"/>
        <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="condition_occurrence_id"/>
            <transform value="cast"/>
            <parameter>
              <valueId value="id"/>
            </parameter>
            <parameter>
              <valueString value="integer"/>
            </parameter>
          </target>
        </rule>
        <documentation
                       value="OMOP Condition ID would be a map from FHIR ID to an external key"/>
      </rule>
      <rule>
        <name value="subject"/>
        <source>
          <context value="src"/>
          <element value="subject"/>
          <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 Condition subject reference to an external key"/>
      </rule>
      <rule>
        <name value="code"/>
        <source>
          <context value="src"/>
          <element value="code"/>
          <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="a"/>
            </source>
            <target>
              <context value="tgt"/>
              <element value="condition_concept_id"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="a"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/uv/omop/ConceptMap/ConditionConcepts"/>
              </parameter>
              <parameter>
                <valueString value="code"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="display"/>
            <source>
              <context value="sc"/>
              <element value="display"/>
              <variable value="d"/>
            </source>
            <target>
              <context value="tgt"/>
              <element value="condition_source_value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="d"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
      <rule>
        <name value="recordedDate"/>
        <source>
          <context value="src"/>
          <element value="recordedDate"/>
          <variable value="rd"/>
        </source>
        <target>
          <context value="tgt"/>
          <element value="condition_start_datetime"/>
          <transform value="cast"/>
          <parameter>
            <valueId value="rd"/>
          </parameter>
          <parameter>
            <valueString value="dateTime"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <element value="condition_start_date"/>
          <transform value="cast"/>
          <parameter>
            <valueId value="rd"/>
          </parameter>
          <parameter>
            <valueString value="date"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="onsetDateTime"/>
        <source>
          <context value="src"/>
          <type value="dateTime"/>
          <element value="onset"/>
          <variable value="osd"/>
        </source>
        <target>
          <context value="tgt"/>
          <element value="condition_start_datetime"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="osd"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <element value="condition_start_date"/>
          <transform value="cast"/>
          <parameter>
            <valueId value="osd"/>
          </parameter>
          <parameter>
            <valueString value="date"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="abatementDateTime"/>
        <source>
          <context value="src"/>
          <type value="dateTime"/>
          <element value="abatement"/>
          <variable value="abdt"/>
        </source>
        <target>
          <context value="tgt"/>
          <element value="condition_end_datetime"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="abdt"/>
          </parameter>
        </target>
        <target>
          <context value="tgt"/>
          <element value="condition_end_date"/>
          <transform value="cast"/>
          <parameter>
            <valueId value="abdt"/>
          </parameter>
          <parameter>
            <valueString value="date"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="clinicalStatus"/>
        <source>
          <context value="src"/>
          <element value="clinicalStatus"/>
          <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="a"/>
            </source>
            <target>
              <context value="tgt"/>
              <element value="condition_status_concept_id"/>
              <transform value="translate"/>
              <parameter>
                <valueId value="a"/>
              </parameter>
              <parameter>
                <valueString
                             value="http://hl7.org/fhir/uv/omop/ConceptMap/ConditionStatusConcepts"/>
              </parameter>
              <parameter>
                <valueString value="code"/>
              </parameter>
            </target>
            <target>
              <context value="tgt"/>
              <element value="condition_status_source_value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="a"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </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>
      </rule>
      <rule>
        <name value="default"/>
        <source>
          <context value="src"/>
          <element value="category"/>
        </source>
        <target>
          <context value="tgt"/>
          <element value="condition_type_concept_id"/>
          <transform value="copy"/>
          <parameter>
            <valueInteger value="32817"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
</StructureMap>