SGHI FHIR Profile Implementation Guide
0.1.0 - ci-build

SGHI FHIR Profile Implementation Guide, published by Kathurima Kimathi. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/savannahghi/sil_fhir_profile_ig/ and changes regularly. See the Directory of published versions

## : ExtractVitalSigns - XML Representation

Draft as of 2026-04-27

Raw xml | Download

    <StructureMap xmlns="http://hl7.org/fhir">
      <id value="ExtractVitalSigns"/>
      <text>
        <status value="generated"/>
        <div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap ExtractVitalSigns</b></p><a name="ExtractVitalSigns"> </a><a name="hcExtractVitalSigns"> </a><pre class="fml">
    <span style="color: #cc00cc">/// <b>url</b> = </span><span style="color: blue">'https://fhir.slade360.co.ke/fhir/StructureMap/ExtractVitalSigns'</span>
    <span style="color: #cc00cc">/// <b>name</b> = </span><span style="color: blue">'ExtractVitalSigns'</span>
    <span style="color: #cc00cc">/// <b>status</b> = </span><span style="color: blue">'draft'</span>

    <b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R5/questionnaireresponse.html" title="QuestionnaireResponse">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style="color: navy">&quot; </span><b>alias </b>QR <b>as </b><b>source</b>
    <b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R5/bundle.html" title="Bundle">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style="color: navy">&quot; </span><b>alias </b>Bundle <b>as </b><b>target</b>
    <b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R5/observation.html" title="Observation">http://hl7.org/fhir/StructureDefinition/Observation</a><span style="color: navy">&quot; </span><b>alias </b>Observation <b>as </b><b>target</b>

    <b>group </b>ExtractVitalSigns<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">bundle</span><span style="color: navy"> : </span>Bundle<span style="color: navy">)</span><span style="color: navy"> {
    </span>  qr<span style="color: navy"><b> -&gt; </b></span>bundle.type = <span style="color: blue">'transaction'</span> <i>&quot;setBundleType&quot;</i><span style="color: navy">;</span>
      qr.item<b> as </b><span style="color: maroon">itH</span><b> where </b>(linkId = '8302-2')<b> then</b><span style="color: navy"> {
    </span>    itH.answer first<b> as </b><span style="color: maroon">aH</span><b> then</b><span style="color: navy"> {
    </span>      aH<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eH</span><span style="color: navy">, </span> eH.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oH</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oH</span><span style="color: navy">, </span> <span style="color: maroon">eH</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oH</span><span style="color: navy">, </span><span style="color: maroon">eH</span><span style="color: navy">)</span> <i>&quot;heightBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oH.category<b> as </b><span style="color: maroon">catH</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catH.coding<b> as </b><span style="color: maroon">catHCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catHCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catHSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catHCoding.code = <span style="color: blue">'vital-signs'</span> <i>&quot;catHCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catHCoding.display = <span style="color: blue">'Vital Signs'</span> <i>&quot;catHDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catHCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;categoryH&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oH.code<b> as </b><span style="color: maroon">codeH</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeH.coding<b> as </b><span style="color: maroon">codeHCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeHCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeHSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeHCoding.code = <span style="color: blue">'8302-2'</span> <i>&quot;codeHCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeHCoding.display = <span style="color: blue">'Body Height'</span> <i>&quot;codeHDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeHCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;codeH&quot;</i><span style="color: navy">;</span>
            aH.value<b> as </b><span style="color: maroon">hv</span><span style="color: navy"><b> -&gt; </b></span>oH.valueQuantity<b> as </b><span style="color: maroon">vH</span><b> then</b><span style="color: navy"> {
    </span>          hv<span style="color: navy"><b> -&gt; </b></span>vH.value = <span style="color: maroon">hv</span> <i>&quot;setVal&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vH.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;setSys&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vH.code = <span style="color: blue">'cm'</span> <i>&quot;setCode&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vH.unit = <span style="color: blue">'centimeter'</span> <i>&quot;setUnit&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;valH&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;heightObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;heightAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;heightRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Height</span>
      qr.item<b> as </b><span style="color: maroon">itW</span><b> where </b>(linkId = '29463-7')<b> then</b><span style="color: navy"> {
    </span>    itW.answer first<b> as </b><span style="color: maroon">aW</span><b> then</b><span style="color: navy"> {
    </span>      aW<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eW</span><span style="color: navy">, </span> eW.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oW</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oW</span><span style="color: navy">, </span> <span style="color: maroon">eW</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oW</span><span style="color: navy">, </span><span style="color: maroon">eW</span><span style="color: navy">)</span> <i>&quot;weightBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oW.category<b> as </b><span style="color: maroon">catW</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catW.coding<b> as </b><span style="color: maroon">catWCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catWCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catWSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catWCoding.code = <span style="color: blue">'vital-signs'</span> <i>&quot;catWCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catWCoding.display = <span style="color: blue">'Vital Signs'</span> <i>&quot;catWDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catWCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;categoryW&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oW.code<b> as </b><span style="color: maroon">codeW</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeW.coding<b> as </b><span style="color: maroon">codeWCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeWCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeWSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeWCoding.code = <span style="color: blue">'29463-7'</span> <i>&quot;codeWCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeWCoding.display = <span style="color: blue">'Body Weight'</span> <i>&quot;codeWDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeWCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;codeW&quot;</i><span style="color: navy">;</span>
            aW.value<b> as </b><span style="color: maroon">hv</span><span style="color: navy"><b> -&gt; </b></span>oW.valueQuantity<b> as </b><span style="color: maroon">vW</span><b> then</b><span style="color: navy"> {
    </span>          hv<span style="color: navy"><b> -&gt; </b></span>vW.value = <span style="color: maroon">hv</span> <i>&quot;setVal&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vW.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;setSys&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vW.code = <span style="color: blue">'kg'</span> <i>&quot;setCode&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vW.unit = <span style="color: blue">'kilogram'</span> <i>&quot;setUnit&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;valW&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;weightObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;weightAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;weightRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Weight</span>
      qr.item<b> as </b><span style="color: maroon">itBmi</span><b> where </b>(linkId = '39156-5')<b> then</b><span style="color: navy"> {
    </span>    itBmi.answer first<b> as </b><span style="color: maroon">aBmi</span><b> then</b><span style="color: navy"> {
    </span>      aBmi<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eBmi</span><span style="color: navy">, </span> eBmi.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oBmi</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oBmi</span><span style="color: navy">, </span> <span style="color: maroon">eBmi</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oBmi</span><span style="color: navy">, </span><span style="color: maroon">eBmi</span><span style="color: navy">)</span> <i>&quot;bmiBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oBmi.category<b> as </b><span style="color: maroon">catBmi</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catBmi.coding<b> as </b><span style="color: maroon">catBmiCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catBmiCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catBmiSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catBmiCoding.code = <span style="color: blue">'vital-signs'</span> <i>&quot;catBmiCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catBmiCoding.display = <span style="color: blue">'Vital Signs'</span> <i>&quot;catBmiDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catBmiCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;categoryBmi&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oBmi.code<b> as </b><span style="color: maroon">codeBmi</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeBmi.coding<b> as </b><span style="color: maroon">codeBmiCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeBmiCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeBmiSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeBmiCoding.code = <span style="color: blue">'39156-5'</span> <i>&quot;codeBmiCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeBmiCoding.display = <span style="color: blue">'Body mass index (BMI) [Ratio]'</span> <i>&quot;codeBmiDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeBmiCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;codeBmi&quot;</i><span style="color: navy">;</span>
            aBmi.value<b> as </b><span style="color: maroon">hv</span><span style="color: navy"><b> -&gt; </b></span>oBmi.valueQuantity<b> as </b><span style="color: maroon">vBmi</span><b> then</b><span style="color: navy"> {
    </span>          hv<span style="color: navy"><b> -&gt; </b></span>vBmi.value = <span style="color: maroon">hv</span> <i>&quot;setVal&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vBmi.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;setSys&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vBmi.code = <span style="color: blue">'kg/m2'</span> <i>&quot;setCode&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vBmi.unit = <span style="color: blue">'kilogram per square meter'</span> <i>&quot;setUnit&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;valBmi&quot;</i><span style="color: navy">;</span>
            itBmi.item<b> as </b><span style="color: maroon">bmiStatusItem</span><b> where </b>(linkId = '39156-5_status')<b> then</b><span style="color: navy"> {
    </span>          bmiStatusItem.answer first<b> as </b><span style="color: maroon">bmiStatusAns</span><span style="color: navy"><b> -&gt; </b></span>oBmi.interpretation<b> as </b><span style="color: maroon">iBmi</span><b> then</b><span style="color: navy"> {
    </span>            bmiStatusAns.value<b> as </b><span style="color: maroon">statusText</span><span style="color: navy"><b> -&gt; </b></span>iBmi.text = <span style="color: maroon">statusText</span> <i>&quot;interpBmi&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;setInterpBmi&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;findBmiStatus&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Interpretation 39156-5_status</span>
          <span style="color: navy">}</span> <i>&quot;bmiObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;bmiAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;bmiRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">BMI</span>
      qr.item<b> as </b><span style="color: maroon">itP</span><b> where </b>(linkId = '8889-8')<b> then</b><span style="color: navy"> {
    </span>    itP.answer first<b> as </b><span style="color: maroon">aP</span><b> then</b><span style="color: navy"> {
    </span>      aP<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eP</span><span style="color: navy">, </span> eP.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oP</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oP</span><span style="color: navy">, </span> <span style="color: maroon">eP</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oP</span><span style="color: navy">, </span><span style="color: maroon">eP</span><span style="color: navy">)</span> <i>&quot;pulseBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oP.category<b> as </b><span style="color: maroon">catP</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catP.coding<b> as </b><span style="color: maroon">catPCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catPCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catPSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catPCoding.code = <span style="color: blue">'vital-signs'</span> <i>&quot;catPCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catPCoding.display = <span style="color: blue">'Vital Signs'</span> <i>&quot;catPDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catPCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;categoryP&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oP.code<b> as </b><span style="color: maroon">codeP</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeP.coding<b> as </b><span style="color: maroon">codePCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codePCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codePSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codePCoding.code = <span style="color: blue">'8889-8'</span> <i>&quot;codePCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codePCoding.display = <span style="color: blue">'Heart rate by Pulse oximetry'</span> <i>&quot;codePDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codePCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;codeP&quot;</i><span style="color: navy">;</span>
            aP.value<b> as </b><span style="color: maroon">hv</span><span style="color: navy"><b> -&gt; </b></span>oP.valueQuantity<b> as </b><span style="color: maroon">vP</span><b> then</b><span style="color: navy"> {
    </span>          hv<span style="color: navy"><b> -&gt; </b></span>vP.value = <span style="color: maroon">hv</span> <i>&quot;setVal&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vP.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;setSys&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vP.code = <span style="color: blue">'/min'</span> <i>&quot;setCode&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vP.unit = <span style="color: blue">'per minute'</span> <i>&quot;setUnit&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;valP&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;pulseObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;pulseAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;pulseRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Pulse</span>
      qr.item<b> as </b><span style="color: maroon">itBP</span><b> where </b>(linkId = '55284-4')<b> then</b><span style="color: navy"> {
    </span>    qr<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eBP</span><span style="color: navy">, </span> eBP.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oBP</span><b> then</b><span style="color: navy"> {
    </span>      qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oBP</span><span style="color: navy">, </span> <span style="color: maroon">eBP</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oBP</span><span style="color: navy">, </span><span style="color: maroon">eBP</span><span style="color: navy">)</span> <i>&quot;bpBase&quot;</i><span style="color: navy">;</span>
          qr<span style="color: navy"><b> -&gt; </b></span>oBP.category<b> as </b><span style="color: maroon">catBP</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span>catBP.coding<b> as </b><span style="color: maroon">catBPCoding</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catBPCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catBPSys&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>catBPCoding.code = <span style="color: blue">'vital-signs'</span> <i>&quot;catBPCode&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>catBPCoding.display = <span style="color: blue">'Vital Signs'</span> <i>&quot;catBPDisplay&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;catBPCodingRule&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;categoryBP&quot;</i><span style="color: navy">;</span>
          qr<span style="color: navy"><b> -&gt; </b></span>oBP.code<b> as </b><span style="color: maroon">codeBP</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span>codeBP.coding<b> as </b><span style="color: maroon">codeBPCoding</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeBPCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeBPSys&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>codeBPCoding.code = <span style="color: blue">'55284-4'</span> <i>&quot;codeBPCode&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>codeBPCoding.display = <span style="color: blue">'Blood pressure systolic and diastolic'</span> <i>&quot;codeBPDisplay&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;codeBPCodingRule&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;codeBP&quot;</i><span style="color: navy">;</span>
          itBP.item<b> as </b><span style="color: maroon">itSys</span><b> where </b>(linkId = '8480-6')<b> then</b><span style="color: navy"> {
    </span>        itSys.answer first<b> as </b><span style="color: maroon">aSys</span><span style="color: navy"><b> -&gt; </b></span>oBP.component<b> as </b><span style="color: maroon">cSys</span><b> then</b><span style="color: navy"> {
    </span>          aSys<span style="color: navy"><b> -&gt; </b></span>cSys.code<b> as </b><span style="color: maroon">bpSysCC</span><b> then</b><span style="color: navy"> {
    </span>            aSys<span style="color: navy"><b> -&gt; </b></span>bpSysCC.coding<b> as </b><span style="color: maroon">bpSysCoding</span><b> then</b><span style="color: navy"> {
    </span>              aSys<span style="color: navy"><b> -&gt; </b></span>bpSysCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;bpSysCodingSystem&quot;</i><span style="color: navy">;</span>
                  aSys<span style="color: navy"><b> -&gt; </b></span>bpSysCoding.code = <span style="color: blue">'8480-6'</span> <i>&quot;bpSysCodingCode&quot;</i><span style="color: navy">;</span>
                  aSys<span style="color: navy"><b> -&gt; </b></span>bpSysCoding.display = <span style="color: blue">'Systolic blood pressure'</span> <i>&quot;bpSysCodingDisplay&quot;</i><span style="color: navy">;</span>
                <span style="color: navy">}</span> <i>&quot;bpSysCodingRule&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;bpSysCode&quot;</i><span style="color: navy">;</span>
              aSys.value<b> as </b><span style="color: maroon">hv</span><span style="color: navy"><b> -&gt; </b></span>cSys.valueQuantity<b> as </b><span style="color: maroon">vSys</span><b> then</b><span style="color: navy"> {
    </span>            hv<span style="color: navy"><b> -&gt; </b></span>vSys.value = <span style="color: maroon">hv</span> <i>&quot;setVal&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>vSys.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;setSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>vSys.code = <span style="color: blue">'mm[Hg]'</span> <i>&quot;setCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>vSys.unit = <span style="color: blue">'millimeter of mercury'</span> <i>&quot;setUnit&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;bpSysVal&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;bpSysComponent&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;bpSysRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Systolic 8480-6</span>
          itBP.item<b> as </b><span style="color: maroon">itDia</span><b> where </b>(linkId = '8462-4')<b> then</b><span style="color: navy"> {
    </span>        itDia.answer first<b> as </b><span style="color: maroon">aDia</span><span style="color: navy"><b> -&gt; </b></span>oBP.component<b> as </b><span style="color: maroon">cDia</span><b> then</b><span style="color: navy"> {
    </span>          aDia<span style="color: navy"><b> -&gt; </b></span>cDia.code<b> as </b><span style="color: maroon">bpDiaCC</span><b> then</b><span style="color: navy"> {
    </span>            aDia<span style="color: navy"><b> -&gt; </b></span>bpDiaCC.coding<b> as </b><span style="color: maroon">bpDiaCoding</span><b> then</b><span style="color: navy"> {
    </span>              aDia<span style="color: navy"><b> -&gt; </b></span>bpDiaCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;bpDiaCodingSystem&quot;</i><span style="color: navy">;</span>
                  aDia<span style="color: navy"><b> -&gt; </b></span>bpDiaCoding.code = <span style="color: blue">'8462-4'</span> <i>&quot;bpDiaCodingCode&quot;</i><span style="color: navy">;</span>
                  aDia<span style="color: navy"><b> -&gt; </b></span>bpDiaCoding.display = <span style="color: blue">'Diastolic blood pressure'</span> <i>&quot;bpDiaCodingDisplay&quot;</i><span style="color: navy">;</span>
                <span style="color: navy">}</span> <i>&quot;bpDiaCodingRule&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;bpDiaCode&quot;</i><span style="color: navy">;</span>
              aDia.value<b> as </b><span style="color: maroon">hv</span><span style="color: navy"><b> -&gt; </b></span>cDia.valueQuantity<b> as </b><span style="color: maroon">vDia</span><b> then</b><span style="color: navy"> {
    </span>            hv<span style="color: navy"><b> -&gt; </b></span>vDia.value = <span style="color: maroon">hv</span> <i>&quot;setVal&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>vDia.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;setSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>vDia.code = <span style="color: blue">'mm[Hg]'</span> <i>&quot;setCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>vDia.unit = <span style="color: blue">'millimeter of mercury'</span> <i>&quot;setUnit&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;bpDiaVal&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;bpDiaComponent&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;bpDiaRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Diastolic 8462-4</span>
        <span style="color: navy">}</span> <i>&quot;bpObs&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;bpRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Blood Pressure</span>
      qr.item<b> as </b><span style="color: maroon">itT</span><b> where </b>(linkId = '8310-5')<b> then</b><span style="color: navy"> {
    </span>    itT.answer first<b> as </b><span style="color: maroon">aT</span><b> then</b><span style="color: navy"> {
    </span>      aT<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eT</span><span style="color: navy">, </span> eT.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oT</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oT</span><span style="color: navy">, </span> <span style="color: maroon">eT</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oT</span><span style="color: navy">, </span><span style="color: maroon">eT</span><span style="color: navy">)</span> <i>&quot;tempBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oT.category<b> as </b><span style="color: maroon">catT</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catT.coding<b> as </b><span style="color: maroon">catTCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catTCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catTSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catTCoding.code = <span style="color: blue">'vital-signs'</span> <i>&quot;catTCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catTCoding.display = <span style="color: blue">'Vital Signs'</span> <i>&quot;catTDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catTCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;categoryT&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oT.code<b> as </b><span style="color: maroon">codeT</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeT.coding<b> as </b><span style="color: maroon">codeTCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeTCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeTSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeTCoding.code = <span style="color: blue">'8310-5'</span> <i>&quot;codeTCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeTCoding.display = <span style="color: blue">'Body Temperature'</span> <i>&quot;codeTDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeTCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;codeT&quot;</i><span style="color: navy">;</span>
            aT.value<b> as </b><span style="color: maroon">hv</span><span style="color: navy"><b> -&gt; </b></span>oT.valueQuantity<b> as </b><span style="color: maroon">vT</span><b> then</b><span style="color: navy"> {
    </span>          hv<span style="color: navy"><b> -&gt; </b></span>vT.value = <span style="color: maroon">hv</span> <i>&quot;setVal&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vT.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;setSys&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vT.code = <span style="color: blue">'Cel'</span> <i>&quot;setCode&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vT.unit = <span style="color: blue">'degree Celsius'</span> <i>&quot;setUnit&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;valT&quot;</i><span style="color: navy">;</span>
            itT.item<b> as </b><span style="color: maroon">tStatusItem</span><b> where </b>(linkId = '8310-5_status')<b> then</b><span style="color: navy"> {
    </span>          tStatusItem.answer first<b> as </b><span style="color: maroon">tStatusAns</span><span style="color: navy"><b> -&gt; </b></span>oT.interpretation<b> as </b><span style="color: maroon">iT</span><b> then</b><span style="color: navy"> {
    </span>            tStatusAns.value<b> as </b><span style="color: maroon">statusText</span><span style="color: navy"><b> -&gt; </b></span>iT.text = <span style="color: maroon">statusText</span> <i>&quot;interpT&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;setInterpT&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;findTStatus&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Interpretation 8310-5_status</span>
          <span style="color: navy">}</span> <i>&quot;tempObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;tempAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;tempRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Temperature</span>
      qr.item<b> as </b><span style="color: maroon">itO2</span><b> where </b>(linkId = '20564-1')<b> then</b><span style="color: navy"> {
    </span>    itO2.answer first<b> as </b><span style="color: maroon">aO2</span><b> then</b><span style="color: navy"> {
    </span>      aO2<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eO2</span><span style="color: navy">, </span> eO2.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oO2</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oO2</span><span style="color: navy">, </span> <span style="color: maroon">eO2</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oO2</span><span style="color: navy">, </span><span style="color: maroon">eO2</span><span style="color: navy">)</span> <i>&quot;spo2Base&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oO2.category<b> as </b><span style="color: maroon">catO2</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catO2.coding<b> as </b><span style="color: maroon">catO2Coding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catO2Coding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catO2Sys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catO2Coding.code = <span style="color: blue">'vital-signs'</span> <i>&quot;catO2Code&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catO2Coding.display = <span style="color: blue">'Vital Signs'</span> <i>&quot;catO2Display&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catO2CodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;categoryO2&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oO2.code<b> as </b><span style="color: maroon">codeO2</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeO2.coding<b> as </b><span style="color: maroon">codeO2Coding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeO2Coding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeO2Sys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeO2Coding.code = <span style="color: blue">'20564-1'</span> <i>&quot;codeO2Code&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeO2Coding.display = <span style="color: blue">'Oxygen saturation in Blood'</span> <i>&quot;codeO2Display&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeO2CodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;codeO2&quot;</i><span style="color: navy">;</span>
            aO2.value<b> as </b><span style="color: maroon">hv</span><span style="color: navy"><b> -&gt; </b></span>oO2.valueQuantity<b> as </b><span style="color: maroon">vO2</span><b> then</b><span style="color: navy"> {
    </span>          hv<span style="color: navy"><b> -&gt; </b></span>vO2.value = <span style="color: maroon">hv</span> <i>&quot;setVal&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vO2.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;setSys&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vO2.code = <span style="color: blue">'%'</span> <i>&quot;setCode&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vO2.unit = <span style="color: blue">'%'</span> <i>&quot;setUnit&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;valO2&quot;</i><span style="color: navy">;</span>
            itO2.item<b> as </b><span style="color: maroon">o2StatusItem</span><b> where </b>(linkId = '20564-1_status')<b> then</b><span style="color: navy"> {
    </span>          o2StatusItem.answer first<b> as </b><span style="color: maroon">o2StatusAns</span><span style="color: navy"><b> -&gt; </b></span>oO2.interpretation<b> as </b><span style="color: maroon">iO2</span><b> then</b><span style="color: navy"> {
    </span>            o2StatusAns.value<b> as </b><span style="color: maroon">statusText</span><span style="color: navy"><b> -&gt; </b></span>iO2.text = <span style="color: maroon">statusText</span> <i>&quot;interpO2&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;setInterpO2&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;findO2Status&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Interpretation of SpO2 20564-1_status</span>
          <span style="color: navy">}</span> <i>&quot;spo2Obs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;spo2Ans&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;spo2Rule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">SpO2</span>
      qr.item<b> as </b><span style="color: maroon">itRR</span><b> where </b>(linkId = '9279-1')<b> then</b><span style="color: navy"> {
    </span>    itRR.answer first<b> as </b><span style="color: maroon">aRR</span><b> then</b><span style="color: navy"> {
    </span>      aRR<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eRR</span><span style="color: navy">, </span> eRR.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oRR</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oRR</span><span style="color: navy">, </span> <span style="color: maroon">eRR</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oRR</span><span style="color: navy">, </span><span style="color: maroon">eRR</span><span style="color: navy">)</span> <i>&quot;rrBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oRR.category<b> as </b><span style="color: maroon">catRR</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catRR.coding<b> as </b><span style="color: maroon">catRRCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catRRCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catRRSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catRRCoding.code = <span style="color: blue">'vital-signs'</span> <i>&quot;catRRCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catRRCoding.display = <span style="color: blue">'Vital Signs'</span> <i>&quot;catRRDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catRRCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;categoryRR&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oRR.code<b> as </b><span style="color: maroon">codeRR</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeRR.coding<b> as </b><span style="color: maroon">codeRRCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeRRCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeRRSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeRRCoding.code = <span style="color: blue">'9279-1'</span> <i>&quot;codeRRCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeRRCoding.display = <span style="color: blue">'Respiratory rate'</span> <i>&quot;codeRRDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeRRCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;codeRR&quot;</i><span style="color: navy">;</span>
            aRR.value<b> as </b><span style="color: maroon">hv</span><span style="color: navy"><b> -&gt; </b></span>oRR.valueQuantity<b> as </b><span style="color: maroon">vRR</span><b> then</b><span style="color: navy"> {
    </span>          hv<span style="color: navy"><b> -&gt; </b></span>vRR.value = <span style="color: maroon">hv</span> <i>&quot;setVal&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vRR.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;setSys&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vRR.code = <span style="color: blue">'/min'</span> <i>&quot;setCode&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vRR.unit = <span style="color: blue">'per minute'</span> <i>&quot;setUnit&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;valRR&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;rrObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;rrAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;rrRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Respiratory rate</span>
      qr.item<b> as </b><span style="color: maroon">itMuac</span><b> where </b>(linkId = '9847-5')<b> then</b><span style="color: navy"> {
    </span>    itMuac.answer first<b> as </b><span style="color: maroon">aMuac</span><b> then</b><span style="color: navy"> {
    </span>      aMuac<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eMuac</span><span style="color: navy">, </span> eMuac.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oMuac</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oMuac</span><span style="color: navy">, </span> <span style="color: maroon">eMuac</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oMuac</span><span style="color: navy">, </span><span style="color: maroon">eMuac</span><span style="color: navy">)</span> <i>&quot;muacBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oMuac.category<b> as </b><span style="color: maroon">catMuac</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catMuac.coding<b> as </b><span style="color: maroon">catMuacCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catMuacCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catMuacSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catMuacCoding.code = <span style="color: blue">'vital-signs'</span> <i>&quot;catMuacCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catMuacCoding.display = <span style="color: blue">'Vital Signs'</span> <i>&quot;catMuacDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catMuacCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;categoryMuac&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oMuac.code<b> as </b><span style="color: maroon">codeMuac</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeMuac.coding<b> as </b><span style="color: maroon">codeMuacCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeMuacCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeMuacSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeMuacCoding.code = <span style="color: blue">'9847-5'</span> <i>&quot;codeMuacCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeMuacCoding.display = <span style="color: blue">'Circumference'</span> <i>&quot;codeMuacDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeMuacCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;codeMuac&quot;</i><span style="color: navy">;</span>
            aMuac.value<b> as </b><span style="color: maroon">hv</span><span style="color: navy"><b> -&gt; </b></span>oMuac.valueQuantity<b> as </b><span style="color: maroon">vMuac</span><b> then</b><span style="color: navy"> {
    </span>          hv<span style="color: navy"><b> -&gt; </b></span>vMuac.value = <span style="color: maroon">hv</span> <i>&quot;setVal&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vMuac.system = <span style="color: blue">'http://unitsofmeasure.org'</span> <i>&quot;setSys&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vMuac.code = <span style="color: blue">'mm'</span> <i>&quot;setCode&quot;</i><span style="color: navy">;</span>
              qr<span style="color: navy"><b> -&gt; </b></span>vMuac.unit = <span style="color: blue">'millimeter'</span> <i>&quot;setUnit&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;valMuac&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;muacObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;muacAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;muacRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">MUAC</span>
      qr.item<b> as </b><span style="color: maroon">itCC</span><b> where </b>(linkId = '10154-3')<b> then</b><span style="color: navy"> {
    </span>    itCC.answer first<b> as </b><span style="color: maroon">aCC</span><b> then</b><span style="color: navy"> {
    </span>      aCC<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eCC</span><span style="color: navy">, </span> eCC.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oCC</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oCC</span><span style="color: navy">, </span> <span style="color: maroon">eCC</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oCC</span><span style="color: navy">, </span><span style="color: maroon">eCC</span><span style="color: navy">)</span> <i>&quot;chiefComplaintBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.category<b> as </b><span style="color: maroon">catCC</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catCC.coding<b> as </b><span style="color: maroon">catCCCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catCCCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catCCSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catCCCoding.code = <span style="color: blue">'social-history'</span> <i>&quot;catCCCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catCCCoding.display = <span style="color: blue">'Social History'</span> <i>&quot;catCCDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catCCCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;chiefComplaintCategory&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.code<b> as </b><span style="color: maroon">codeCC</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeCC.coding<b> as </b><span style="color: maroon">codeCCCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeCCCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeCCSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeCCCoding.code = <span style="color: blue">'10154-3'</span> <i>&quot;codeCCCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeCCCoding.display = <span style="color: blue">'Chief complaint Narrative - Reported'</span> <i>&quot;codeCCDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeCCCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;chiefComplaintCode&quot;</i><span style="color: navy">;</span>
            aCC.value<b> as </b><span style="color: maroon">textVal</span><span style="color: navy"><b> -&gt; </b></span>oCC.valueString = <span style="color: maroon">textVal</span> <i>&quot;chiefComplaintValue&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;chiefComplaintObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;chiefComplaintAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;chiefComplaintRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Chief Complaint</span>
      qr.item<b> as </b><span style="color: maroon">hpiCC</span><b> where </b>(linkId = '8684-3')<b> then</b><span style="color: navy"> {
    </span>    hpiCC.answer first<b> as </b><span style="color: maroon">aCC</span><b> then</b><span style="color: navy"> {
    </span>      aCC<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eCC</span><span style="color: navy">, </span> eCC.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oCC</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oCC</span><span style="color: navy">, </span> <span style="color: maroon">eCC</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oCC</span><span style="color: navy">, </span><span style="color: maroon">eCC</span><span style="color: navy">)</span> <i>&quot;historyOfPIBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.category<b> as </b><span style="color: maroon">catHPI</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catHPI.coding<b> as </b><span style="color: maroon">catHPICoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catHPICoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catHPISys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catHPICoding.code = <span style="color: blue">'social-history'</span> <i>&quot;catHPICode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catHPICoding.display = <span style="color: blue">'Social History'</span> <i>&quot;catHPIDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catHPICodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;historyOfPICategory&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.code<b> as </b><span style="color: maroon">codeHPI</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeHPI.coding<b> as </b><span style="color: maroon">codeHPICoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeHPICoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeHPISys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeHPICoding.code = <span style="color: blue">'8684-3'</span> <i>&quot;codeHPICode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeHPICoding.display = <span style="color: blue">'History of Present illness'</span> <i>&quot;codeHPIDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeHPICodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;historyOfPICode&quot;</i><span style="color: navy">;</span>
            aCC.value<b> as </b><span style="color: maroon">textVal</span><span style="color: navy"><b> -&gt; </b></span>oCC.valueString = <span style="color: maroon">textVal</span> <i>&quot;historyOfPIValue&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;historyOfPIObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;historyOfPIAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;historyOfPIRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">History of Presenting Illness</span>
      qr.item<b> as </b><span style="color: maroon">hPastCC</span><b> where </b>(linkId = '11349-8')<b> then</b><span style="color: navy"> {
    </span>    hPastCC.answer first<b> as </b><span style="color: maroon">aCC</span><b> then</b><span style="color: navy"> {
    </span>      aCC<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eCC</span><span style="color: navy">, </span> eCC.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oCC</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oCC</span><span style="color: navy">, </span> <span style="color: maroon">eCC</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oCC</span><span style="color: navy">, </span><span style="color: maroon">eCC</span><span style="color: navy">)</span> <i>&quot;historyOfPastIBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.category<b> as </b><span style="color: maroon">catPastI</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catPastI.coding<b> as </b><span style="color: maroon">catPastICoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catPastICoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catPastISys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catPastICoding.code = <span style="color: blue">'social-history'</span> <i>&quot;catPastICode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catPastICoding.display = <span style="color: blue">'Social History'</span> <i>&quot;catPastIDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catPastICodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;historyOfPastICategory&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.code<b> as </b><span style="color: maroon">codePastI</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codePastI.coding<b> as </b><span style="color: maroon">codePastICoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codePastICoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codePastISys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codePastICoding.code = <span style="color: blue">'11349-8'</span> <i>&quot;codePastICode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codePastICoding.display = <span style="color: blue">'History of Past illness'</span> <i>&quot;codePastIDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codePastICodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;historyOfPastICode&quot;</i><span style="color: navy">;</span>
            aCC.value<b> as </b><span style="color: maroon">textVal</span><span style="color: navy"><b> -&gt; </b></span>oCC.valueString = <span style="color: maroon">textVal</span> <i>&quot;historyOfPastIValue&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;historyOfPastIObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;historyOfPastIAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;historyOfPastIRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">History of Past Illness / Past Medical History</span>
      qr.item<b> as </b><span style="color: maroon">hFH</span><b> where </b>(linkId = '8670-2')<b> then</b><span style="color: navy"> {
    </span>    hFH.answer first<b> as </b><span style="color: maroon">aCC</span><b> then</b><span style="color: navy"> {
    </span>      aCC<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eCC</span><span style="color: navy">, </span> eCC.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oCC</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oCC</span><span style="color: navy">, </span> <span style="color: maroon">eCC</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oCC</span><span style="color: navy">, </span><span style="color: maroon">eCC</span><span style="color: navy">)</span> <i>&quot;familyFHIBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.category<b> as </b><span style="color: maroon">catFH</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catFH.coding<b> as </b><span style="color: maroon">catFHCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catFHCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catFHSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catFHCoding.code = <span style="color: blue">'social-history'</span> <i>&quot;catFHCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catFHCoding.display = <span style="color: blue">'Social History'</span> <i>&quot;catFHDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catFHCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;familyHICategory&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.code<b> as </b><span style="color: maroon">codeFH</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeFH.coding<b> as </b><span style="color: maroon">codeFHCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeFHCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeFHSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeFHCoding.code = <span style="color: blue">'8670-2'</span> <i>&quot;codeFHCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeFHCoding.display = <span style="color: blue">'History of family member diseases'</span> <i>&quot;codeFHDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeFHCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;familyHICode&quot;</i><span style="color: navy">;</span>
            aCC.value<b> as </b><span style="color: maroon">textVal</span><span style="color: navy"><b> -&gt; </b></span>oCC.valueString = <span style="color: maroon">textVal</span> <i>&quot;familyHIValue&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;familyHIObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;familyHIAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;familyHIRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Family History</span>
      qr.item<b> as </b><span style="color: maroon">hSH</span><b> where </b>(linkId = '29762-2')<b> then</b><span style="color: navy"> {
    </span>    hSH.answer first<b> as </b><span style="color: maroon">aCC</span><b> then</b><span style="color: navy"> {
    </span>      aCC<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eCC</span><span style="color: navy">, </span> eCC.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oCC</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oCC</span><span style="color: navy">, </span> <span style="color: maroon">eCC</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oCC</span><span style="color: navy">, </span><span style="color: maroon">eCC</span><span style="color: navy">)</span> <i>&quot;socialHistoryIBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.category<b> as </b><span style="color: maroon">catSH</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catSH.coding<b> as </b><span style="color: maroon">catSHCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catSHCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catSHSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catSHCoding.code = <span style="color: blue">'social-history'</span> <i>&quot;catSHCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catSHCoding.display = <span style="color: blue">'Social History'</span> <i>&quot;catSHDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catSHCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;socialHistoryCategory&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.code<b> as </b><span style="color: maroon">codeSH</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeSH.coding<b> as </b><span style="color: maroon">codeSHCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeSHCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeSHSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeSHCoding.code = <span style="color: blue">'29762-2'</span> <i>&quot;codeSHCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeSHCoding.display = <span style="color: blue">'Social history note'</span> <i>&quot;codeSHDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeSHCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;socialHistoryCode&quot;</i><span style="color: navy">;</span>
            aCC.value<b> as </b><span style="color: maroon">textVal</span><span style="color: navy"><b> -&gt; </b></span>oCC.valueString = <span style="color: maroon">textVal</span> <i>&quot;socialHistoryIValue&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;socialHistoryIObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;socialHistoryIAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;socialHistoryIRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Social History</span>
      qr.item<b> as </b><span style="color: maroon">medicationH</span><b> where </b>(linkId = '10160-0')<b> then</b><span style="color: navy"> {
    </span>    medicationH.answer first<b> as </b><span style="color: maroon">aCC</span><b> then</b><span style="color: navy"> {
    </span>      aCC<span style="color: navy"><b> -&gt; </b></span> bundle.entry<b> as </b><span style="color: maroon">eCC</span><span style="color: navy">, </span> eCC.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Observation'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">oCC</span><b> then</b><span style="color: navy"> {
    </span>        qr<span style="color: navy"><b> -&gt; </b></span> <span style="color: maroon">oCC</span><span style="color: navy">, </span> <span style="color: maroon">eCC</span><b> then </b>BuildBaseObs<span style="color: navy">(</span><span style="color: maroon">qr</span><span style="color: navy">, </span><span style="color: maroon">oCC</span><span style="color: navy">, </span><span style="color: maroon">eCC</span><span style="color: navy">)</span> <i>&quot;medicationHIBase&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.category<b> as </b><span style="color: maroon">catMedH</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>catMedH.coding<b> as </b><span style="color: maroon">catMedHCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>catMedHCoding.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/observation-category'</span> <i>&quot;catMedHSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catMedHCoding.code = <span style="color: blue">'therapy'</span> <i>&quot;catMedHCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>catMedHCoding.display = <span style="color: blue">'Therapy'</span> <i>&quot;catMedHDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;catMedHCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;medicationHCategory&quot;</i><span style="color: navy">;</span>
            qr<span style="color: navy"><b> -&gt; </b></span>oCC.code<b> as </b><span style="color: maroon">codeMedH</span><b> then</b><span style="color: navy"> {
    </span>          qr<span style="color: navy"><b> -&gt; </b></span>codeMedH.coding<b> as </b><span style="color: maroon">codeMedHCoding</span><b> then</b><span style="color: navy"> {
    </span>            qr<span style="color: navy"><b> -&gt; </b></span>codeMedHCoding.system = <span style="color: blue">'http://loinc.org'</span> <i>&quot;codeMedHSys&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeMedHCoding.code = <span style="color: blue">'10160-0'</span> <i>&quot;codeMedHCode&quot;</i><span style="color: navy">;</span>
                qr<span style="color: navy"><b> -&gt; </b></span>codeMedHCoding.display = <span style="color: blue">'History of Medication use Narrative'</span> <i>&quot;codeMedHDisplay&quot;</i><span style="color: navy">;</span>
              <span style="color: navy">}</span> <i>&quot;codeMedHCodingRule&quot;</i><span style="color: navy">;</span>
            <span style="color: navy">}</span> <i>&quot;medicationHistoryCode&quot;</i><span style="color: navy">;</span>
            aCC.value<b> as </b><span style="color: maroon">textVal</span><span style="color: navy"><b> -&gt; </b></span>oCC.valueString = <span style="color: maroon">textVal</span> <i>&quot;medicationHistoryIValue&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;medicationHistoryIObs&quot;</i><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;medicationHistoryIAns&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;medicationHistoryIRule&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Medication History</span>
    <span style="color: navy">}

    </span><b>group </b>BuildBaseObs<span style="color: navy">(</span><b>source</b> <span style="color: maroon">qr</span><span style="color: navy"> : </span>QR, <b>target</b> <span style="color: maroon">obs</span><span style="color: navy"> : </span>Observation, <b>target</b> <span style="color: maroon">entry</span><span style="color: navy">)</span><span style="color: navy"> {
    </span>  qr<span style="color: navy"><b> -&gt; </b></span>obs.status = <span style="color: blue">'final'</span> <i>&quot;status&quot;</i><span style="color: navy">;</span>
      qr.subject<b> as </b><span style="color: maroon">s</span><span style="color: navy"><b> -&gt; </b></span>obs.subject = <span style="color: maroon">s</span><span style="color: navy">;</span>
      qr.encounter<b> as </b><span style="color: maroon">e</span><span style="color: navy"><b> -&gt; </b></span>obs.encounter = <span style="color: maroon">e</span><span style="color: navy">;</span>
      qr.authored<b> as </b><span style="color: maroon">t</span><span style="color: navy"><b> -&gt; </b></span>obs.effectiveDateTime = <span style="color: maroon">t</span> <i>&quot;effective&quot;</i><span style="color: navy">;</span>
      qr<span style="color: navy"><b> -&gt; </b></span>obs.id = <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span><b> then </b>SetObservationFullUrl<span style="color: navy">(</span><span style="color: maroon">obs</span><span style="color: navy">, </span><span style="color: maroon">entry</span><span style="color: navy">)</span> <i>&quot;setObsIdAndFullUrl&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Observation id and fullUrl</span>
      qr<span style="color: navy"><b> -&gt; </b></span>entry.request<b> as </b><span style="color: maroon">request</span><b> then</b><span style="color: navy"> {
    </span>    qr<span style="color: navy"><b> -&gt; </b></span>request.method = <span style="color: blue">'POST'</span> <i>&quot;reqMethod&quot;</i><span style="color: navy">;</span>
        qr<span style="color: navy"><b> -&gt; </b></span>request.url = <span style="color: blue">'Observation'</span> <i>&quot;reqUrl&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;entryRequest&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Bundle.entry.request (transaction POST Observation)</span>
      qr<span style="color: navy"><b> -&gt; </b></span>obs.derivedFrom = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">newRef</span><b> then</b><span style="color: navy"> {
    </span>    qr.id<b> as </b><span style="color: maroon">qid</span><span style="color: navy"><b> -&gt; </b></span>newRef.reference = <b>append</b><span style="color: navy">(</span><span style="color: blue">'QuestionnaireResponse/'</span><span style="color: navy">, </span><span style="color: maroon">qid</span><span style="color: navy">)</span> <i>&quot;setQRRef&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;linkQR&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Link Observation -&gt; QuestionnaireResponse</span>
    <span style="color: navy">}

    </span><b>group </b>SetObservationFullUrl<span style="color: navy">(</span><b>source</b> <span style="color: maroon">obs</span><span style="color: navy"> : </span>Observation, <b>target</b> <span style="color: maroon">entry</span><span style="color: navy">)</span><span style="color: navy"> {
    </span>  obs.id<b> as </b><span style="color: maroon">id</span><span style="color: navy"><b> -&gt; </b></span>entry.fullUrl = <b>append</b><span style="color: navy">(</span><span style="color: blue">'https://fhir.slade360.co.ke/fhir/Observation/'</span><span style="color: navy">, </span><span style="color: maroon">id</span><span style="color: navy">)</span> <i>&quot;assignFullUrl&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}

    </span></pre></div>
      </text>
      <url
           value="https://fhir.slade360.co.ke/fhir/StructureMap/ExtractVitalSigns"/>
      <version value="0.1.0"/>
      <name value="ExtractVitalSigns"/>
      <status value="draft"/>
      <date value="2026-04-27T09:21:43+00:00"/>
      <publisher value="Kathurima Kimathi"/>
      <contact>
        <name value="Kathurima Kimathi"/>
        <telecom>
          <system value="url"/>
          <value value="https://www.linkedin.com/in/kathurima-kimathi/"/>
        </telecom>
        <telecom>
          <system value="email"/>
          <value value="kathurimakimathi415@gmail.com"/>
        </telecom>
      </contact>
      <contact>
        <name value="Oscar John"/>
        <telecom>
          <system value="email"/>
          <value value="oscarjohnotieno@gmail.com"/>
          <use value="work"/>
        </telecom>
      </contact>
      <contact>
        <name value="Kennedy Omondi"/>
        <telecom>
          <system value="email"/>
          <value value="kennankole@gmail.com"/>
          <use value="work"/>
        </telecom>
      </contact>
      <structure>
        <url
             value="http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"/>
        <mode value="source"/>
        <alias value="QR"/>
      </structure>
      <structure>
        <url value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
        <mode value="target"/>
        <alias value="Bundle"/>
      </structure>
      <structure>
        <url value="http://hl7.org/fhir/StructureDefinition/Observation"/>
        <mode value="target"/>
        <alias value="Observation"/>
      </structure>
      <group>
        <name value="ExtractVitalSigns"/>
        <input>
          <name value="qr"/>
          <type value="QR"/>
          <mode value="source"/>
        </input>
        <input>
          <name value="bundle"/>
          <type value="Bundle"/>
          <mode value="target"/>
        </input>
        <rule>
          <name value="setBundleType"/>
          <source>
            <context value="qr"/>
          </source>
          <target>
            <context value="bundle"/>
            <element value="type"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="transaction"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="heightRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="itH"/>
            <condition value="(linkId = '8302-2')"/>
          </source>
          <rule>
            <name value="heightAns"/>
            <source>
              <context value="itH"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aH"/>
            </source>
            <rule>
              <name value="heightObs"/>
              <source>
                <context value="aH"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eH"/>
              </target>
              <target>
                <context value="eH"/>
                <element value="resource"/>
                <variable value="oH"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="heightBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oH"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eH"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oH"/>
                  </parameter>
                  <parameter>
                    <valueId value="eH"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="categoryH"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oH"/>
                  <element value="category"/>
                  <variable value="catH"/>
                </target>
                <rule>
                  <name value="catHCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catH"/>
                    <element value="coding"/>
                    <variable value="catHCoding"/>
                  </target>
                  <rule>
                    <name value="catHSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catHCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catHCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catHCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="vital-signs"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catHDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catHCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Vital Signs"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="codeH"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oH"/>
                  <element value="code"/>
                  <variable value="codeH"/>
                </target>
                <rule>
                  <name value="codeHCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeH"/>
                    <element value="coding"/>
                    <variable value="codeHCoding"/>
                  </target>
                  <rule>
                    <name value="codeHSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeHCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeHCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeHCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="8302-2"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeHDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeHCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Body Height"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="valH"/>
                <source>
                  <context value="aH"/>
                  <element value="value"/>
                  <variable value="hv"/>
                </source>
                <target>
                  <context value="oH"/>
                  <element value="valueQuantity"/>
                  <variable value="vH"/>
                </target>
                <rule>
                  <name value="setVal"/>
                  <source>
                    <context value="hv"/>
                  </source>
                  <target>
                    <context value="vH"/>
                    <element value="value"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="hv"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setSys"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vH"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="http://unitsofmeasure.org"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setCode"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vH"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="cm"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setUnit"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vH"/>
                    <element value="unit"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="centimeter"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
          </rule>
          <documentation value="Height"/>
        </rule>
        <rule>
          <name value="weightRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="itW"/>
            <condition value="(linkId = '29463-7')"/>
          </source>
          <rule>
            <name value="weightAns"/>
            <source>
              <context value="itW"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aW"/>
            </source>
            <rule>
              <name value="weightObs"/>
              <source>
                <context value="aW"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eW"/>
              </target>
              <target>
                <context value="eW"/>
                <element value="resource"/>
                <variable value="oW"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="weightBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oW"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eW"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oW"/>
                  </parameter>
                  <parameter>
                    <valueId value="eW"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="categoryW"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oW"/>
                  <element value="category"/>
                  <variable value="catW"/>
                </target>
                <rule>
                  <name value="catWCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catW"/>
                    <element value="coding"/>
                    <variable value="catWCoding"/>
                  </target>
                  <rule>
                    <name value="catWSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catWCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catWCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catWCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="vital-signs"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catWDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catWCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Vital Signs"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="codeW"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oW"/>
                  <element value="code"/>
                  <variable value="codeW"/>
                </target>
                <rule>
                  <name value="codeWCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeW"/>
                    <element value="coding"/>
                    <variable value="codeWCoding"/>
                  </target>
                  <rule>
                    <name value="codeWSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeWCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeWCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeWCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="29463-7"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeWDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeWCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Body Weight"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="valW"/>
                <source>
                  <context value="aW"/>
                  <element value="value"/>
                  <variable value="hv"/>
                </source>
                <target>
                  <context value="oW"/>
                  <element value="valueQuantity"/>
                  <variable value="vW"/>
                </target>
                <rule>
                  <name value="setVal"/>
                  <source>
                    <context value="hv"/>
                  </source>
                  <target>
                    <context value="vW"/>
                    <element value="value"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="hv"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setSys"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vW"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="http://unitsofmeasure.org"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setCode"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vW"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="kg"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setUnit"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vW"/>
                    <element value="unit"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="kilogram"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
          </rule>
          <documentation value="Weight"/>
        </rule>
        <rule>
          <name value="bmiRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="itBmi"/>
            <condition value="(linkId = '39156-5')"/>
          </source>
          <rule>
            <name value="bmiAns"/>
            <source>
              <context value="itBmi"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aBmi"/>
            </source>
            <rule>
              <name value="bmiObs"/>
              <source>
                <context value="aBmi"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eBmi"/>
              </target>
              <target>
                <context value="eBmi"/>
                <element value="resource"/>
                <variable value="oBmi"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="bmiBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oBmi"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eBmi"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oBmi"/>
                  </parameter>
                  <parameter>
                    <valueId value="eBmi"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="categoryBmi"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oBmi"/>
                  <element value="category"/>
                  <variable value="catBmi"/>
                </target>
                <rule>
                  <name value="catBmiCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catBmi"/>
                    <element value="coding"/>
                    <variable value="catBmiCoding"/>
                  </target>
                  <rule>
                    <name value="catBmiSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catBmiCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catBmiCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catBmiCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="vital-signs"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catBmiDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catBmiCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Vital Signs"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="codeBmi"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oBmi"/>
                  <element value="code"/>
                  <variable value="codeBmi"/>
                </target>
                <rule>
                  <name value="codeBmiCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeBmi"/>
                    <element value="coding"/>
                    <variable value="codeBmiCoding"/>
                  </target>
                  <rule>
                    <name value="codeBmiSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeBmiCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeBmiCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeBmiCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="39156-5"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeBmiDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeBmiCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Body mass index (BMI) [Ratio]"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="valBmi"/>
                <source>
                  <context value="aBmi"/>
                  <element value="value"/>
                  <variable value="hv"/>
                </source>
                <target>
                  <context value="oBmi"/>
                  <element value="valueQuantity"/>
                  <variable value="vBmi"/>
                </target>
                <rule>
                  <name value="setVal"/>
                  <source>
                    <context value="hv"/>
                  </source>
                  <target>
                    <context value="vBmi"/>
                    <element value="value"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="hv"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setSys"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vBmi"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="http://unitsofmeasure.org"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setCode"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vBmi"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="kg/m2"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setUnit"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vBmi"/>
                    <element value="unit"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="kilogram per square meter"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
              <rule>
                <name value="findBmiStatus"/>
                <source>
                  <context value="itBmi"/>
                  <element value="item"/>
                  <variable value="bmiStatusItem"/>
                  <condition value="(linkId = '39156-5_status')"/>
                </source>
                <rule>
                  <name value="setInterpBmi"/>
                  <source>
                    <context value="bmiStatusItem"/>
                    <element value="answer"/>
                    <listMode value="first"/>
                    <variable value="bmiStatusAns"/>
                  </source>
                  <target>
                    <context value="oBmi"/>
                    <element value="interpretation"/>
                    <variable value="iBmi"/>
                  </target>
                  <rule>
                    <name value="interpBmi"/>
                    <source>
                      <context value="bmiStatusAns"/>
                      <element value="value"/>
                      <variable value="statusText"/>
                    </source>
                    <target>
                      <context value="iBmi"/>
                      <element value="text"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueId value="statusText"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
                <documentation value="Interpretation 39156-5_status"/>
              </rule>
            </rule>
          </rule>
          <documentation value="BMI"/>
        </rule>
        <rule>
          <name value="pulseRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="itP"/>
            <condition value="(linkId = '8889-8')"/>
          </source>
          <rule>
            <name value="pulseAns"/>
            <source>
              <context value="itP"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aP"/>
            </source>
            <rule>
              <name value="pulseObs"/>
              <source>
                <context value="aP"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eP"/>
              </target>
              <target>
                <context value="eP"/>
                <element value="resource"/>
                <variable value="oP"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="pulseBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oP"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eP"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oP"/>
                  </parameter>
                  <parameter>
                    <valueId value="eP"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="categoryP"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oP"/>
                  <element value="category"/>
                  <variable value="catP"/>
                </target>
                <rule>
                  <name value="catPCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catP"/>
                    <element value="coding"/>
                    <variable value="catPCoding"/>
                  </target>
                  <rule>
                    <name value="catPSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catPCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catPCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catPCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="vital-signs"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catPDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catPCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Vital Signs"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="codeP"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oP"/>
                  <element value="code"/>
                  <variable value="codeP"/>
                </target>
                <rule>
                  <name value="codePCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeP"/>
                    <element value="coding"/>
                    <variable value="codePCoding"/>
                  </target>
                  <rule>
                    <name value="codePSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codePCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codePCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codePCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="8889-8"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codePDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codePCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Heart rate by Pulse oximetry"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="valP"/>
                <source>
                  <context value="aP"/>
                  <element value="value"/>
                  <variable value="hv"/>
                </source>
                <target>
                  <context value="oP"/>
                  <element value="valueQuantity"/>
                  <variable value="vP"/>
                </target>
                <rule>
                  <name value="setVal"/>
                  <source>
                    <context value="hv"/>
                  </source>
                  <target>
                    <context value="vP"/>
                    <element value="value"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="hv"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setSys"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vP"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="http://unitsofmeasure.org"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setCode"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vP"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="/min"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setUnit"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vP"/>
                    <element value="unit"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="per minute"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
          </rule>
          <documentation value="Pulse"/>
        </rule>
        <rule>
          <name value="bpRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="itBP"/>
            <condition value="(linkId = '55284-4')"/>
          </source>
          <rule>
            <name value="bpObs"/>
            <source>
              <context value="qr"/>
            </source>
            <target>
              <context value="bundle"/>
              <element value="entry"/>
              <variable value="eBP"/>
            </target>
            <target>
              <context value="eBP"/>
              <element value="resource"/>
              <variable value="oBP"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Observation"/>
              </parameter>
            </target>
            <rule>
              <name value="bpBase"/>
              <source>
                <context value="qr"/>
              </source>
              <target>
                <transform value="copy"/>
                <parameter>
                  <valueId value="oBP"/>
                </parameter>
              </target>
              <target>
                <transform value="copy"/>
                <parameter>
                  <valueId value="eBP"/>
                </parameter>
              </target>
              <dependent>
                <name value="BuildBaseObs"/>
                <parameter>
                  <valueId value="qr"/>
                </parameter>
                <parameter>
                  <valueId value="oBP"/>
                </parameter>
                <parameter>
                  <valueId value="eBP"/>
                </parameter>
              </dependent>
            </rule>
            <rule>
              <name value="categoryBP"/>
              <source>
                <context value="qr"/>
              </source>
              <target>
                <context value="oBP"/>
                <element value="category"/>
                <variable value="catBP"/>
              </target>
              <rule>
                <name value="catBPCodingRule"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="catBP"/>
                  <element value="coding"/>
                  <variable value="catBPCoding"/>
                </target>
                <rule>
                  <name value="catBPSys"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catBPCoding"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString
                                   value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="catBPCode"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catBPCoding"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="vital-signs"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="catBPDisplay"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catBPCoding"/>
                    <element value="display"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="Vital Signs"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="codeBP"/>
              <source>
                <context value="qr"/>
              </source>
              <target>
                <context value="oBP"/>
                <element value="code"/>
                <variable value="codeBP"/>
              </target>
              <rule>
                <name value="codeBPCodingRule"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="codeBP"/>
                  <element value="coding"/>
                  <variable value="codeBPCoding"/>
                </target>
                <rule>
                  <name value="codeBPSys"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeBPCoding"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="http://loinc.org"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="codeBPCode"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeBPCoding"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="55284-4"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="codeBPDisplay"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeBPCoding"/>
                    <element value="display"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="Blood pressure systolic and diastolic"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
            <rule>
              <name value="bpSysRule"/>
              <source>
                <context value="itBP"/>
                <element value="item"/>
                <variable value="itSys"/>
                <condition value="(linkId = '8480-6')"/>
              </source>
              <rule>
                <name value="bpSysComponent"/>
                <source>
                  <context value="itSys"/>
                  <element value="answer"/>
                  <listMode value="first"/>
                  <variable value="aSys"/>
                </source>
                <target>
                  <context value="oBP"/>
                  <element value="component"/>
                  <variable value="cSys"/>
                </target>
                <rule>
                  <name value="bpSysCode"/>
                  <source>
                    <context value="aSys"/>
                  </source>
                  <target>
                    <context value="cSys"/>
                    <element value="code"/>
                    <variable value="bpSysCC"/>
                  </target>
                  <rule>
                    <name value="bpSysCodingRule"/>
                    <source>
                      <context value="aSys"/>
                    </source>
                    <target>
                      <context value="bpSysCC"/>
                      <element value="coding"/>
                      <variable value="bpSysCoding"/>
                    </target>
                    <rule>
                      <name value="bpSysCodingSystem"/>
                      <source>
                        <context value="aSys"/>
                      </source>
                      <target>
                        <context value="bpSysCoding"/>
                        <element value="system"/>
                        <transform value="copy"/>
                        <parameter>
                          <valueString value="http://loinc.org"/>
                        </parameter>
                      </target>
                    </rule>
                    <rule>
                      <name value="bpSysCodingCode"/>
                      <source>
                        <context value="aSys"/>
                      </source>
                      <target>
                        <context value="bpSysCoding"/>
                        <element value="code"/>
                        <transform value="copy"/>
                        <parameter>
                          <valueString value="8480-6"/>
                        </parameter>
                      </target>
                    </rule>
                    <rule>
                      <name value="bpSysCodingDisplay"/>
                      <source>
                        <context value="aSys"/>
                      </source>
                      <target>
                        <context value="bpSysCoding"/>
                        <element value="display"/>
                        <transform value="copy"/>
                        <parameter>
                          <valueString value="Systolic blood pressure"/>
                        </parameter>
                      </target>
                    </rule>
                  </rule>
                </rule>
                <rule>
                  <name value="bpSysVal"/>
                  <source>
                    <context value="aSys"/>
                    <element value="value"/>
                    <variable value="hv"/>
                  </source>
                  <target>
                    <context value="cSys"/>
                    <element value="valueQuantity"/>
                    <variable value="vSys"/>
                  </target>
                  <rule>
                    <name value="setVal"/>
                    <source>
                      <context value="hv"/>
                    </source>
                    <target>
                      <context value="vSys"/>
                      <element value="value"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueId value="hv"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="setSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="vSys"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://unitsofmeasure.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="setCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="vSys"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="mm[Hg]"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="setUnit"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="vSys"/>
                      <element value="unit"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="millimeter of mercury"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <documentation value="Systolic 8480-6"/>
            </rule>
            <rule>
              <name value="bpDiaRule"/>
              <source>
                <context value="itBP"/>
                <element value="item"/>
                <variable value="itDia"/>
                <condition value="(linkId = '8462-4')"/>
              </source>
              <rule>
                <name value="bpDiaComponent"/>
                <source>
                  <context value="itDia"/>
                  <element value="answer"/>
                  <listMode value="first"/>
                  <variable value="aDia"/>
                </source>
                <target>
                  <context value="oBP"/>
                  <element value="component"/>
                  <variable value="cDia"/>
                </target>
                <rule>
                  <name value="bpDiaCode"/>
                  <source>
                    <context value="aDia"/>
                  </source>
                  <target>
                    <context value="cDia"/>
                    <element value="code"/>
                    <variable value="bpDiaCC"/>
                  </target>
                  <rule>
                    <name value="bpDiaCodingRule"/>
                    <source>
                      <context value="aDia"/>
                    </source>
                    <target>
                      <context value="bpDiaCC"/>
                      <element value="coding"/>
                      <variable value="bpDiaCoding"/>
                    </target>
                    <rule>
                      <name value="bpDiaCodingSystem"/>
                      <source>
                        <context value="aDia"/>
                      </source>
                      <target>
                        <context value="bpDiaCoding"/>
                        <element value="system"/>
                        <transform value="copy"/>
                        <parameter>
                          <valueString value="http://loinc.org"/>
                        </parameter>
                      </target>
                    </rule>
                    <rule>
                      <name value="bpDiaCodingCode"/>
                      <source>
                        <context value="aDia"/>
                      </source>
                      <target>
                        <context value="bpDiaCoding"/>
                        <element value="code"/>
                        <transform value="copy"/>
                        <parameter>
                          <valueString value="8462-4"/>
                        </parameter>
                      </target>
                    </rule>
                    <rule>
                      <name value="bpDiaCodingDisplay"/>
                      <source>
                        <context value="aDia"/>
                      </source>
                      <target>
                        <context value="bpDiaCoding"/>
                        <element value="display"/>
                        <transform value="copy"/>
                        <parameter>
                          <valueString value="Diastolic blood pressure"/>
                        </parameter>
                      </target>
                    </rule>
                  </rule>
                </rule>
                <rule>
                  <name value="bpDiaVal"/>
                  <source>
                    <context value="aDia"/>
                    <element value="value"/>
                    <variable value="hv"/>
                  </source>
                  <target>
                    <context value="cDia"/>
                    <element value="valueQuantity"/>
                    <variable value="vDia"/>
                  </target>
                  <rule>
                    <name value="setVal"/>
                    <source>
                      <context value="hv"/>
                    </source>
                    <target>
                      <context value="vDia"/>
                      <element value="value"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueId value="hv"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="setSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="vDia"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://unitsofmeasure.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="setCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="vDia"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="mm[Hg]"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="setUnit"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="vDia"/>
                      <element value="unit"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="millimeter of mercury"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <documentation value="Diastolic 8462-4"/>
            </rule>
          </rule>
          <documentation value="Blood Pressure"/>
        </rule>
        <rule>
          <name value="tempRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="itT"/>
            <condition value="(linkId = '8310-5')"/>
          </source>
          <rule>
            <name value="tempAns"/>
            <source>
              <context value="itT"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aT"/>
            </source>
            <rule>
              <name value="tempObs"/>
              <source>
                <context value="aT"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eT"/>
              </target>
              <target>
                <context value="eT"/>
                <element value="resource"/>
                <variable value="oT"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="tempBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oT"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eT"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oT"/>
                  </parameter>
                  <parameter>
                    <valueId value="eT"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="categoryT"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oT"/>
                  <element value="category"/>
                  <variable value="catT"/>
                </target>
                <rule>
                  <name value="catTCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catT"/>
                    <element value="coding"/>
                    <variable value="catTCoding"/>
                  </target>
                  <rule>
                    <name value="catTSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catTCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catTCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catTCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="vital-signs"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catTDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catTCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Vital Signs"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="codeT"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oT"/>
                  <element value="code"/>
                  <variable value="codeT"/>
                </target>
                <rule>
                  <name value="codeTCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeT"/>
                    <element value="coding"/>
                    <variable value="codeTCoding"/>
                  </target>
                  <rule>
                    <name value="codeTSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeTCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeTCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeTCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="8310-5"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeTDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeTCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Body Temperature"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="valT"/>
                <source>
                  <context value="aT"/>
                  <element value="value"/>
                  <variable value="hv"/>
                </source>
                <target>
                  <context value="oT"/>
                  <element value="valueQuantity"/>
                  <variable value="vT"/>
                </target>
                <rule>
                  <name value="setVal"/>
                  <source>
                    <context value="hv"/>
                  </source>
                  <target>
                    <context value="vT"/>
                    <element value="value"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="hv"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setSys"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vT"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="http://unitsofmeasure.org"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setCode"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vT"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="Cel"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setUnit"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vT"/>
                    <element value="unit"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="degree Celsius"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
              <rule>
                <name value="findTStatus"/>
                <source>
                  <context value="itT"/>
                  <element value="item"/>
                  <variable value="tStatusItem"/>
                  <condition value="(linkId = '8310-5_status')"/>
                </source>
                <rule>
                  <name value="setInterpT"/>
                  <source>
                    <context value="tStatusItem"/>
                    <element value="answer"/>
                    <listMode value="first"/>
                    <variable value="tStatusAns"/>
                  </source>
                  <target>
                    <context value="oT"/>
                    <element value="interpretation"/>
                    <variable value="iT"/>
                  </target>
                  <rule>
                    <name value="interpT"/>
                    <source>
                      <context value="tStatusAns"/>
                      <element value="value"/>
                      <variable value="statusText"/>
                    </source>
                    <target>
                      <context value="iT"/>
                      <element value="text"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueId value="statusText"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
                <documentation value="Interpretation 8310-5_status"/>
              </rule>
            </rule>
          </rule>
          <documentation value="Temperature"/>
        </rule>
        <rule>
          <name value="spo2Rule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="itO2"/>
            <condition value="(linkId = '20564-1')"/>
          </source>
          <rule>
            <name value="spo2Ans"/>
            <source>
              <context value="itO2"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aO2"/>
            </source>
            <rule>
              <name value="spo2Obs"/>
              <source>
                <context value="aO2"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eO2"/>
              </target>
              <target>
                <context value="eO2"/>
                <element value="resource"/>
                <variable value="oO2"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="spo2Base"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oO2"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eO2"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oO2"/>
                  </parameter>
                  <parameter>
                    <valueId value="eO2"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="categoryO2"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oO2"/>
                  <element value="category"/>
                  <variable value="catO2"/>
                </target>
                <rule>
                  <name value="catO2CodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catO2"/>
                    <element value="coding"/>
                    <variable value="catO2Coding"/>
                  </target>
                  <rule>
                    <name value="catO2Sys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catO2Coding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catO2Code"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catO2Coding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="vital-signs"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catO2Display"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catO2Coding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Vital Signs"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="codeO2"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oO2"/>
                  <element value="code"/>
                  <variable value="codeO2"/>
                </target>
                <rule>
                  <name value="codeO2CodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeO2"/>
                    <element value="coding"/>
                    <variable value="codeO2Coding"/>
                  </target>
                  <rule>
                    <name value="codeO2Sys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeO2Coding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeO2Code"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeO2Coding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="20564-1"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeO2Display"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeO2Coding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Oxygen saturation in Blood"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="valO2"/>
                <source>
                  <context value="aO2"/>
                  <element value="value"/>
                  <variable value="hv"/>
                </source>
                <target>
                  <context value="oO2"/>
                  <element value="valueQuantity"/>
                  <variable value="vO2"/>
                </target>
                <rule>
                  <name value="setVal"/>
                  <source>
                    <context value="hv"/>
                  </source>
                  <target>
                    <context value="vO2"/>
                    <element value="value"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="hv"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setSys"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vO2"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="http://unitsofmeasure.org"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setCode"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vO2"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="%"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setUnit"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vO2"/>
                    <element value="unit"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="%"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
              <rule>
                <name value="findO2Status"/>
                <source>
                  <context value="itO2"/>
                  <element value="item"/>
                  <variable value="o2StatusItem"/>
                  <condition value="(linkId = '20564-1_status')"/>
                </source>
                <rule>
                  <name value="setInterpO2"/>
                  <source>
                    <context value="o2StatusItem"/>
                    <element value="answer"/>
                    <listMode value="first"/>
                    <variable value="o2StatusAns"/>
                  </source>
                  <target>
                    <context value="oO2"/>
                    <element value="interpretation"/>
                    <variable value="iO2"/>
                  </target>
                  <rule>
                    <name value="interpO2"/>
                    <source>
                      <context value="o2StatusAns"/>
                      <element value="value"/>
                      <variable value="statusText"/>
                    </source>
                    <target>
                      <context value="iO2"/>
                      <element value="text"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueId value="statusText"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
                <documentation value="Interpretation of SpO2 20564-1_status"/>
              </rule>
            </rule>
          </rule>
          <documentation value="SpO2"/>
        </rule>
        <rule>
          <name value="rrRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="itRR"/>
            <condition value="(linkId = '9279-1')"/>
          </source>
          <rule>
            <name value="rrAns"/>
            <source>
              <context value="itRR"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aRR"/>
            </source>
            <rule>
              <name value="rrObs"/>
              <source>
                <context value="aRR"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eRR"/>
              </target>
              <target>
                <context value="eRR"/>
                <element value="resource"/>
                <variable value="oRR"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="rrBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oRR"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eRR"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oRR"/>
                  </parameter>
                  <parameter>
                    <valueId value="eRR"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="categoryRR"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oRR"/>
                  <element value="category"/>
                  <variable value="catRR"/>
                </target>
                <rule>
                  <name value="catRRCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catRR"/>
                    <element value="coding"/>
                    <variable value="catRRCoding"/>
                  </target>
                  <rule>
                    <name value="catRRSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catRRCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catRRCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catRRCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="vital-signs"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catRRDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catRRCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Vital Signs"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="codeRR"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oRR"/>
                  <element value="code"/>
                  <variable value="codeRR"/>
                </target>
                <rule>
                  <name value="codeRRCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeRR"/>
                    <element value="coding"/>
                    <variable value="codeRRCoding"/>
                  </target>
                  <rule>
                    <name value="codeRRSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeRRCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeRRCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeRRCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="9279-1"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeRRDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeRRCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Respiratory rate"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="valRR"/>
                <source>
                  <context value="aRR"/>
                  <element value="value"/>
                  <variable value="hv"/>
                </source>
                <target>
                  <context value="oRR"/>
                  <element value="valueQuantity"/>
                  <variable value="vRR"/>
                </target>
                <rule>
                  <name value="setVal"/>
                  <source>
                    <context value="hv"/>
                  </source>
                  <target>
                    <context value="vRR"/>
                    <element value="value"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="hv"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setSys"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vRR"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="http://unitsofmeasure.org"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setCode"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vRR"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="/min"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setUnit"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vRR"/>
                    <element value="unit"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="per minute"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
          </rule>
          <documentation value="Respiratory rate"/>
        </rule>
        <rule>
          <name value="muacRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="itMuac"/>
            <condition value="(linkId = '9847-5')"/>
          </source>
          <rule>
            <name value="muacAns"/>
            <source>
              <context value="itMuac"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aMuac"/>
            </source>
            <rule>
              <name value="muacObs"/>
              <source>
                <context value="aMuac"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eMuac"/>
              </target>
              <target>
                <context value="eMuac"/>
                <element value="resource"/>
                <variable value="oMuac"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="muacBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oMuac"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eMuac"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oMuac"/>
                  </parameter>
                  <parameter>
                    <valueId value="eMuac"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="categoryMuac"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oMuac"/>
                  <element value="category"/>
                  <variable value="catMuac"/>
                </target>
                <rule>
                  <name value="catMuacCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catMuac"/>
                    <element value="coding"/>
                    <variable value="catMuacCoding"/>
                  </target>
                  <rule>
                    <name value="catMuacSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catMuacCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catMuacCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catMuacCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="vital-signs"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catMuacDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catMuacCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Vital Signs"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="codeMuac"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oMuac"/>
                  <element value="code"/>
                  <variable value="codeMuac"/>
                </target>
                <rule>
                  <name value="codeMuacCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeMuac"/>
                    <element value="coding"/>
                    <variable value="codeMuacCoding"/>
                  </target>
                  <rule>
                    <name value="codeMuacSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeMuacCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeMuacCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeMuacCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="9847-5"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeMuacDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeMuacCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Circumference"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="valMuac"/>
                <source>
                  <context value="aMuac"/>
                  <element value="value"/>
                  <variable value="hv"/>
                </source>
                <target>
                  <context value="oMuac"/>
                  <element value="valueQuantity"/>
                  <variable value="vMuac"/>
                </target>
                <rule>
                  <name value="setVal"/>
                  <source>
                    <context value="hv"/>
                  </source>
                  <target>
                    <context value="vMuac"/>
                    <element value="value"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueId value="hv"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setSys"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vMuac"/>
                    <element value="system"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="http://unitsofmeasure.org"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setCode"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vMuac"/>
                    <element value="code"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="mm"/>
                    </parameter>
                  </target>
                </rule>
                <rule>
                  <name value="setUnit"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="vMuac"/>
                    <element value="unit"/>
                    <transform value="copy"/>
                    <parameter>
                      <valueString value="millimeter"/>
                    </parameter>
                  </target>
                </rule>
              </rule>
            </rule>
          </rule>
          <documentation value="MUAC"/>
        </rule>
        <rule>
          <name value="chiefComplaintRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="itCC"/>
            <condition value="(linkId = '10154-3')"/>
          </source>
          <rule>
            <name value="chiefComplaintAns"/>
            <source>
              <context value="itCC"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aCC"/>
            </source>
            <rule>
              <name value="chiefComplaintObs"/>
              <source>
                <context value="aCC"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eCC"/>
              </target>
              <target>
                <context value="eCC"/>
                <element value="resource"/>
                <variable value="oCC"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="chiefComplaintBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="chiefComplaintCategory"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="category"/>
                  <variable value="catCC"/>
                </target>
                <rule>
                  <name value="catCCCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catCC"/>
                    <element value="coding"/>
                    <variable value="catCCCoding"/>
                  </target>
                  <rule>
                    <name value="catCCSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catCCCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catCCCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catCCCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="social-history"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catCCDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catCCCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Social History"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="chiefComplaintCode"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="code"/>
                  <variable value="codeCC"/>
                </target>
                <rule>
                  <name value="codeCCCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeCC"/>
                    <element value="coding"/>
                    <variable value="codeCCCoding"/>
                  </target>
                  <rule>
                    <name value="codeCCSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeCCCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeCCCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeCCCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="10154-3"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeCCDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeCCCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="Chief complaint Narrative - Reported"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="chiefComplaintValue"/>
                <source>
                  <context value="aCC"/>
                  <element value="value"/>
                  <variable value="textVal"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="valueString"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="textVal"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
          <documentation value="Chief Complaint"/>
        </rule>
        <rule>
          <name value="historyOfPIRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="hpiCC"/>
            <condition value="(linkId = '8684-3')"/>
          </source>
          <rule>
            <name value="historyOfPIAns"/>
            <source>
              <context value="hpiCC"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aCC"/>
            </source>
            <rule>
              <name value="historyOfPIObs"/>
              <source>
                <context value="aCC"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eCC"/>
              </target>
              <target>
                <context value="eCC"/>
                <element value="resource"/>
                <variable value="oCC"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="historyOfPIBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="historyOfPICategory"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="category"/>
                  <variable value="catHPI"/>
                </target>
                <rule>
                  <name value="catHPICodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catHPI"/>
                    <element value="coding"/>
                    <variable value="catHPICoding"/>
                  </target>
                  <rule>
                    <name value="catHPISys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catHPICoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catHPICode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catHPICoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="social-history"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catHPIDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catHPICoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Social History"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="historyOfPICode"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="code"/>
                  <variable value="codeHPI"/>
                </target>
                <rule>
                  <name value="codeHPICodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeHPI"/>
                    <element value="coding"/>
                    <variable value="codeHPICoding"/>
                  </target>
                  <rule>
                    <name value="codeHPISys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeHPICoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeHPICode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeHPICoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="8684-3"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeHPIDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeHPICoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="History of Present illness"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="historyOfPIValue"/>
                <source>
                  <context value="aCC"/>
                  <element value="value"/>
                  <variable value="textVal"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="valueString"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="textVal"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
          <documentation value="History of Presenting Illness"/>
        </rule>
        <rule>
          <name value="historyOfPastIRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="hPastCC"/>
            <condition value="(linkId = '11349-8')"/>
          </source>
          <rule>
            <name value="historyOfPastIAns"/>
            <source>
              <context value="hPastCC"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aCC"/>
            </source>
            <rule>
              <name value="historyOfPastIObs"/>
              <source>
                <context value="aCC"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eCC"/>
              </target>
              <target>
                <context value="eCC"/>
                <element value="resource"/>
                <variable value="oCC"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="historyOfPastIBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="historyOfPastICategory"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="category"/>
                  <variable value="catPastI"/>
                </target>
                <rule>
                  <name value="catPastICodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catPastI"/>
                    <element value="coding"/>
                    <variable value="catPastICoding"/>
                  </target>
                  <rule>
                    <name value="catPastISys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catPastICoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catPastICode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catPastICoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="social-history"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catPastIDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catPastICoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Social History"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="historyOfPastICode"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="code"/>
                  <variable value="codePastI"/>
                </target>
                <rule>
                  <name value="codePastICodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codePastI"/>
                    <element value="coding"/>
                    <variable value="codePastICoding"/>
                  </target>
                  <rule>
                    <name value="codePastISys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codePastICoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codePastICode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codePastICoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="11349-8"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codePastIDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codePastICoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="History of Past illness"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="historyOfPastIValue"/>
                <source>
                  <context value="aCC"/>
                  <element value="value"/>
                  <variable value="textVal"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="valueString"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="textVal"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
          <documentation value="History of Past Illness / Past Medical History"/>
        </rule>
        <rule>
          <name value="familyHIRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="hFH"/>
            <condition value="(linkId = '8670-2')"/>
          </source>
          <rule>
            <name value="familyHIAns"/>
            <source>
              <context value="hFH"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aCC"/>
            </source>
            <rule>
              <name value="familyHIObs"/>
              <source>
                <context value="aCC"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eCC"/>
              </target>
              <target>
                <context value="eCC"/>
                <element value="resource"/>
                <variable value="oCC"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="familyFHIBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="familyHICategory"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="category"/>
                  <variable value="catFH"/>
                </target>
                <rule>
                  <name value="catFHCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catFH"/>
                    <element value="coding"/>
                    <variable value="catFHCoding"/>
                  </target>
                  <rule>
                    <name value="catFHSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catFHCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catFHCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catFHCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="social-history"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catFHDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catFHCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Social History"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="familyHICode"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="code"/>
                  <variable value="codeFH"/>
                </target>
                <rule>
                  <name value="codeFHCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeFH"/>
                    <element value="coding"/>
                    <variable value="codeFHCoding"/>
                  </target>
                  <rule>
                    <name value="codeFHSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeFHCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeFHCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeFHCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="8670-2"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeFHDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeFHCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="History of family member diseases"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="familyHIValue"/>
                <source>
                  <context value="aCC"/>
                  <element value="value"/>
                  <variable value="textVal"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="valueString"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="textVal"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
          <documentation value="Family History"/>
        </rule>
        <rule>
          <name value="socialHistoryIRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="hSH"/>
            <condition value="(linkId = '29762-2')"/>
          </source>
          <rule>
            <name value="socialHistoryIAns"/>
            <source>
              <context value="hSH"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aCC"/>
            </source>
            <rule>
              <name value="socialHistoryIObs"/>
              <source>
                <context value="aCC"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eCC"/>
              </target>
              <target>
                <context value="eCC"/>
                <element value="resource"/>
                <variable value="oCC"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="socialHistoryIBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="socialHistoryCategory"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="category"/>
                  <variable value="catSH"/>
                </target>
                <rule>
                  <name value="catSHCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catSH"/>
                    <element value="coding"/>
                    <variable value="catSHCoding"/>
                  </target>
                  <rule>
                    <name value="catSHSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catSHCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catSHCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catSHCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="social-history"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catSHDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catSHCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Social History"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="socialHistoryCode"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="code"/>
                  <variable value="codeSH"/>
                </target>
                <rule>
                  <name value="codeSHCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeSH"/>
                    <element value="coding"/>
                    <variable value="codeSHCoding"/>
                  </target>
                  <rule>
                    <name value="codeSHSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeSHCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeSHCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeSHCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="29762-2"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeSHDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeSHCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Social history note"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="socialHistoryIValue"/>
                <source>
                  <context value="aCC"/>
                  <element value="value"/>
                  <variable value="textVal"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="valueString"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="textVal"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
          <documentation value="Social History"/>
        </rule>
        <rule>
          <name value="medicationHistoryIRule"/>
          <source>
            <context value="qr"/>
            <element value="item"/>
            <variable value="medicationH"/>
            <condition value="(linkId = '10160-0')"/>
          </source>
          <rule>
            <name value="medicationHistoryIAns"/>
            <source>
              <context value="medicationH"/>
              <element value="answer"/>
              <listMode value="first"/>
              <variable value="aCC"/>
            </source>
            <rule>
              <name value="medicationHistoryIObs"/>
              <source>
                <context value="aCC"/>
              </source>
              <target>
                <context value="bundle"/>
                <element value="entry"/>
                <variable value="eCC"/>
              </target>
              <target>
                <context value="eCC"/>
                <element value="resource"/>
                <variable value="oCC"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Observation"/>
                </parameter>
              </target>
              <rule>
                <name value="medicationHIBase"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                </target>
                <target>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </target>
                <dependent>
                  <name value="BuildBaseObs"/>
                  <parameter>
                    <valueId value="qr"/>
                  </parameter>
                  <parameter>
                    <valueId value="oCC"/>
                  </parameter>
                  <parameter>
                    <valueId value="eCC"/>
                  </parameter>
                </dependent>
              </rule>
              <rule>
                <name value="medicationHCategory"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="category"/>
                  <variable value="catMedH"/>
                </target>
                <rule>
                  <name value="catMedHCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="catMedH"/>
                    <element value="coding"/>
                    <variable value="catMedHCoding"/>
                  </target>
                  <rule>
                    <name value="catMedHSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catMedHCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString
                                     value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catMedHCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catMedHCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="therapy"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="catMedHDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="catMedHCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="Therapy"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="medicationHistoryCode"/>
                <source>
                  <context value="qr"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="code"/>
                  <variable value="codeMedH"/>
                </target>
                <rule>
                  <name value="codeMedHCodingRule"/>
                  <source>
                    <context value="qr"/>
                  </source>
                  <target>
                    <context value="codeMedH"/>
                    <element value="coding"/>
                    <variable value="codeMedHCoding"/>
                  </target>
                  <rule>
                    <name value="codeMedHSys"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeMedHCoding"/>
                      <element value="system"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="http://loinc.org"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeMedHCode"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeMedHCoding"/>
                      <element value="code"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="10160-0"/>
                      </parameter>
                    </target>
                  </rule>
                  <rule>
                    <name value="codeMedHDisplay"/>
                    <source>
                      <context value="qr"/>
                    </source>
                    <target>
                      <context value="codeMedHCoding"/>
                      <element value="display"/>
                      <transform value="copy"/>
                      <parameter>
                        <valueString value="History of Medication use Narrative"/>
                      </parameter>
                    </target>
                  </rule>
                </rule>
              </rule>
              <rule>
                <name value="medicationHistoryIValue"/>
                <source>
                  <context value="aCC"/>
                  <element value="value"/>
                  <variable value="textVal"/>
                </source>
                <target>
                  <context value="oCC"/>
                  <element value="valueString"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueId value="textVal"/>
                  </parameter>
                </target>
              </rule>
            </rule>
          </rule>
          <documentation value="Medication History"/>
        </rule>
      </group>
      <group>
        <name value="BuildBaseObs"/>
        <input>
          <name value="qr"/>
          <type value="QR"/>
          <mode value="source"/>
        </input>
        <input>
          <name value="obs"/>
          <type value="Observation"/>
          <mode value="target"/>
        </input>
        <input>
          <name value="entry"/>
          <mode value="target"/>
        </input>
        <rule>
          <name value="status"/>
          <source>
            <context value="qr"/>
          </source>
          <target>
            <context value="obs"/>
            <element value="status"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="final"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="subject"/>
          <source>
            <context value="qr"/>
            <element value="subject"/>
            <variable value="s"/>
          </source>
          <target>
            <context value="obs"/>
            <element value="subject"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="s"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="encounter"/>
          <source>
            <context value="qr"/>
            <element value="encounter"/>
            <variable value="e"/>
          </source>
          <target>
            <context value="obs"/>
            <element value="encounter"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="e"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="effective"/>
          <source>
            <context value="qr"/>
            <element value="authored"/>
            <variable value="t"/>
          </source>
          <target>
            <context value="obs"/>
            <element value="effectiveDateTime"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="t"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="setObsIdAndFullUrl"/>
          <source>
            <context value="qr"/>
          </source>
          <target>
            <context value="obs"/>
            <element value="id"/>
            <transform value="uuid"/>
          </target>
          <dependent>
            <name value="SetObservationFullUrl"/>
            <parameter>
              <valueId value="obs"/>
            </parameter>
            <parameter>
              <valueId value="entry"/>
            </parameter>
          </dependent>
          <documentation value="Observation id and fullUrl"/>
        </rule>
        <rule>
          <name value="entryRequest"/>
          <source>
            <context value="qr"/>
          </source>
          <target>
            <context value="entry"/>
            <element value="request"/>
            <variable value="request"/>
          </target>
          <rule>
            <name value="reqMethod"/>
            <source>
              <context value="qr"/>
            </source>
            <target>
              <context value="request"/>
              <element value="method"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="POST"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="reqUrl"/>
            <source>
              <context value="qr"/>
            </source>
            <target>
              <context value="request"/>
              <element value="url"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Observation"/>
              </parameter>
            </target>
          </rule>
          <documentation
                         value="Bundle.entry.request (transaction POST Observation)"/>
        </rule>
        <rule>
          <name value="linkQR"/>
          <source>
            <context value="qr"/>
          </source>
          <target>
            <context value="obs"/>
            <element value="derivedFrom"/>
            <variable value="newRef"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <rule>
            <name value="setQRRef"/>
            <source>
              <context value="qr"/>
              <element value="id"/>
              <variable value="qid"/>
            </source>
            <target>
              <context value="newRef"/>
              <element value="reference"/>
              <transform value="append"/>
              <parameter>
                <valueString value="QuestionnaireResponse/"/>
              </parameter>
              <parameter>
                <valueId value="qid"/>
              </parameter>
            </target>
          </rule>
          <documentation value="Link Observation -&gt; QuestionnaireResponse"/>
        </rule>
      </group>
      <group>
        <name value="SetObservationFullUrl"/>
        <input>
          <name value="obs"/>
          <type value="Observation"/>
          <mode value="source"/>
        </input>
        <input>
          <name value="entry"/>
          <mode value="target"/>
        </input>
        <rule>
          <name value="assignFullUrl"/>
          <source>
            <context value="obs"/>
            <element value="id"/>
            <variable value="id"/>
          </source>
          <target>
            <context value="entry"/>
            <element value="fullUrl"/>
            <transform value="append"/>
            <parameter>
              <valueString value="https://fhir.slade360.co.ke/fhir/Observation/"/>
            </parameter>
            <parameter>
              <valueId value="id"/>
            </parameter>
          </target>
        </rule>
      </group>
    </StructureMap>