Starter FHIR Implementation Guide
1.0.1 - draft International flag

Starter FHIR Implementation Guide, published by Jembi Health Systems. This guide is not an authorized publication; it is the continuous build for version 1.0.1 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/jembi/Starter-FHIR-IG/ and changes regularly. See the Directory of published versions

: Map Breastfeeding Question to an Observation - XML Representation

Draft as of 2024-11-17

Raw xml | Download


<StructureMap xmlns="http://hl7.org/fhir">
  <id value="QRBreastfeedingStatusToObservation"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap QRBreastfeedingStatusToObservation</b></p><a name="QRBreastfeedingStatusToObservation"> </a><a name="hcQRBreastfeedingStatusToObservation"> </a><a name="QRBreastfeedingStatusToObservation-en-US"> </a><pre class="fml">
<b>map</b><span style="color: navy"> &quot;</span>http://jembi.org/fhir/StructureMap/QRBreastfeedingStatusToObservation<span style="color: navy">&quot; = &quot;</span>QRBreastfeedingStatusToObservation<span style="color: navy">&quot;

</span><b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R4/questionnaireresponse.html" title="QuestionnaireResponse">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style="color: navy">&quot; </span><b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="StructureDefinition-breastfeeding-status-observation.html" title="Observation - Breastfeeding Status">http://jembi.org/fhir/StructureDefinition/breastfeeding-status-observation</a><span style="color: navy">&quot; </span><b>as </b><b>target</b>

<b>group </b>QRBreastfeedingStatusToObservation<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>QuestionnaireResponse, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>Observation<span style="color: navy">)</span><span style="color: navy"> {
</span>  src<span style="color: navy"><b> -&gt; </b></span>tgt.id = <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span> <i>&quot;SetObservationId&quot;</i><span style="color: navy">;</span>
  src<span style="color: navy"><b> -&gt; </b></span>tgt.meta<b> as </b><span style="color: maroon">meta</span><b> then</b><span style="color: navy"> {
</span>    src<span style="color: navy"><b> -&gt; </b></span>meta.profile = <span style="color: blue">'http://jembi.org/fhir/StructureDefinition/breastfeeding-status-observation'</span> <i>&quot;SetObservationMetaProfile&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;SetObservationMeta&quot;</i><span style="color: navy">;</span>
  src<span style="color: navy"><b> -&gt; </b></span>tgt.status = <span style="color: blue">'final'</span> <i>&quot;SetObservationStatus&quot;</i><span style="color: navy">;</span>
  src<span style="color: navy"><b> -&gt; </b></span>tgt.code = <b>cc</b><span style="color: navy">(</span><span style="color: blue">'http://loinc.org'</span><span style="color: navy">, </span><span style="color: blue">'63895-7'</span><span style="color: navy">)</span> <i>&quot;SetObservationCode&quot;</i><span style="color: navy">;</span>
  src<span style="color: navy"><b> -&gt; </b></span> tgt.code<b> as </b><span style="color: maroon">code</span><span style="color: navy">, </span> code.text = <span style="color: blue">'Breastfeeding status'</span> <i>&quot;SetObservationCodeText&quot;</i><span style="color: navy">;</span>
  src.authored<b> as </b><span style="color: maroon">authored</span><span style="color: navy"><b> -&gt; </b></span>tgt.effective = <span style="color: maroon">authored</span> <i>&quot;SetObservationEffectiveDateTime&quot;</i><span style="color: navy">;</span>
  src<span style="color: navy"><b> -&gt; </b></span>tgt.category = <b>cc</b><span style="color: navy">(</span><span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span><span style="color: navy">, </span><span style="color: blue">'exam'</span><span style="color: navy">)</span> <i>&quot;SetObservationCategory&quot;</i><span style="color: navy">;</span>
  src.subject<b> as </b><span style="color: maroon">patient</span><span style="color: navy"><b> -&gt; </b></span>tgt.subject = <span style="color: maroon">patient</span> <i>&quot;SetObservationSubjectReference&quot;</i><span style="color: navy">;</span>
  src.author<b> as </b><span style="color: maroon">author</span><span style="color: navy"><b> -&gt; </b></span>tgt.performer = <span style="color: maroon">author</span> <i>&quot;SetObservationPerfomerReference&quot;</i><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.encounter = <span style="color: maroon">encounter</span> <i>&quot;SetObservationEncounterReference&quot;</i><span style="color: navy">;</span>
  src.item<b> as </b><span style="color: maroon">item</span><b> where </b>(linkId = '1.1')<b> then</b><span style="color: navy"> {
</span>    item.answer first<b> as </b><span style="color: maroon">ans</span><b> then</b><span style="color: navy"> {
</span>      ans.value<span style="color: navy"> : </span>Coding<b> as </b><span style="color: maroon">breastfeeding</span><span style="color: navy"><b> -&gt; </b></span>tgt.value = <b>create</b><span style="color: navy">(</span><span style="color: blue">'CodeableConcept'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">obsValue</span><b> then</b><span style="color: navy"> {
</span>        breastfeeding<span style="color: navy"><b> -&gt; </b></span>obsValue.coding = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Coding'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">coding</span><b> then</b><span style="color: navy"> {
</span>          breastfeeding<span style="color: navy"><b> -&gt; </b></span>coding.system = <b>translate</b><span style="color: navy">(</span><span style="color: maroon">breastfeeding</span><span style="color: navy">, </span><span style="color: blue">'http://jembi.org/fhir/ConceptMap/LOINCCodesToProprietary'</span><span style="color: navy">, </span><span style="color: blue">'system'</span><span style="color: navy">)</span> <i>&quot;SetObservationValueCodingSystem&quot;</i><span style="color: navy">;</span>
          breastfeeding<span style="color: navy"><b> -&gt; </b></span>coding.code = <b>translate</b><span style="color: navy">(</span><span style="color: maroon">breastfeeding</span><span style="color: navy">, </span><span style="color: blue">'http://jembi.org/fhir/ConceptMap/LOINCCodesToProprietary'</span><span style="color: navy">, </span><span style="color: blue">'code'</span><span style="color: navy">)</span> <i>&quot;SetObservationValueCodingCode&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;SetObservationValueCoding&quot;</i><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></pre></div>
  </text>
  <url
       value="http://jembi.org/fhir/StructureMap/QRBreastfeedingStatusToObservation"/>
  <version value="1.0.1"/>
  <name value="QRBreastfeedingStatusToObservation"/>
  <status value="draft"/>
  <date value="2024-11-17T13:26:33+00:00"/>
  <publisher value="Jembi Health Systems"/>
  <contact>
    <name value="Jembi Health Systems"/>
    <telecom>
      <system value="url"/>
      <value value="https://www.jembi.org/"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="info@jembi.org"/>
    </telecom>
  </contact>
  <contact>
    <name value="Richard Langford"/>
    <telecom>
      <system value="email"/>
      <value value="richard.langford@jembi.org"/>
      <use value="work"/>
    </telecom>
  </contact>
  <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/QuestionnaireResponse"/>
    <mode value="source"/>
  </structure>
  <structure>
    <url
         value="http://jembi.org/fhir/StructureDefinition/breastfeeding-status-observation"/>
    <mode value="target"/>
  </structure>
  <group>
    <name value="QRBreastfeedingStatusToObservation"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="QuestionnaireResponse"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="tgt"/>
      <type value="Observation"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="SetObservationId"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="id"/>
        <transform value="uuid"/>
      </target>
    </rule>
    <rule>
      <name value="SetObservationMeta"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="meta"/>
        <variable value="meta"/>
      </target>
      <rule>
        <name value="SetObservationMetaProfile"/>
        <source>
          <context value="src"/>
        </source>
        <target>
          <context value="meta"/>
          <contextType value="variable"/>
          <element value="profile"/>
          <transform value="copy"/>
          <parameter>
            <valueString
                         value="http://jembi.org/fhir/StructureDefinition/breastfeeding-status-observation"/>
          </parameter>
        </target>
      </rule>
    </rule>
    <rule>
      <name value="SetObservationStatus"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="final"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="SetObservationCode"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <transform value="cc"/>
        <parameter>
          <valueString value="http://loinc.org"/>
        </parameter>
        <parameter>
          <valueString value="63895-7"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="SetObservationCodeText"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="code"/>
      </target>
      <target>
        <context value="code"/>
        <contextType value="variable"/>
        <element value="text"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Breastfeeding status"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="SetObservationEffectiveDateTime"/>
      <source>
        <context value="src"/>
        <element value="authored"/>
        <variable value="authored"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="effective"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="authored"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="SetObservationCategory"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="category"/>
        <transform value="cc"/>
        <parameter>
          <valueString
                       value="http://terminology.hl7.org/CodeSystem/observation-category"/>
        </parameter>
        <parameter>
          <valueString value="exam"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="SetObservationSubjectReference"/>
      <source>
        <context value="src"/>
        <element value="subject"/>
        <variable value="patient"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="patient"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="SetObservationPerfomerReference"/>
      <source>
        <context value="src"/>
        <element value="author"/>
        <variable value="author"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="performer"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="author"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="SetObservationEncounterReference"/>
      <source>
        <context value="src"/>
        <element value="encounter"/>
        <variable value="encounter"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="encounter"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="encounter"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="item"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition value="(linkId = '1.1')"/>
      </source>
      <rule>
        <name value="answer"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <listMode value="first"/>
          <variable value="ans"/>
        </source>
        <rule>
          <name value="valueCoding"/>
          <source>
            <context value="ans"/>
            <type value="Coding"/>
            <element value="value"/>
            <variable value="breastfeeding"/>
          </source>
          <target>
            <context value="tgt"/>
            <contextType value="variable"/>
            <element value="value"/>
            <variable value="obsValue"/>
            <transform value="create"/>
            <parameter>
              <valueString value="CodeableConcept"/>
            </parameter>
          </target>
          <rule>
            <name value="SetObservationValueCoding"/>
            <source>
              <context value="breastfeeding"/>
            </source>
            <target>
              <context value="obsValue"/>
              <contextType value="variable"/>
              <element value="coding"/>
              <variable value="coding"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Coding"/>
              </parameter>
            </target>
            <rule>
              <name value="SetObservationValueCodingSystem"/>
              <source>
                <context value="breastfeeding"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="system"/>
                <transform value="translate"/>
                <parameter>
                  <valueId value="breastfeeding"/>
                </parameter>
                <parameter>
                  <valueString
                               value="http://jembi.org/fhir/ConceptMap/LOINCCodesToProprietary"/>
                </parameter>
                <parameter>
                  <valueString value="system"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="SetObservationValueCodingCode"/>
              <source>
                <context value="breastfeeding"/>
              </source>
              <target>
                <context value="coding"/>
                <contextType value="variable"/>
                <element value="code"/>
                <transform value="translate"/>
                <parameter>
                  <valueId value="breastfeeding"/>
                </parameter>
                <parameter>
                  <valueString
                               value="http://jembi.org/fhir/ConceptMap/LOINCCodesToProprietary"/>
                </parameter>
                <parameter>
                  <valueString value="code"/>
                </parameter>
              </target>
            </rule>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
</StructureMap>