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 - TTL Representation

Draft as of 2026-05-21

Raw ttl | Download

    @prefix fhir: <http://hl7.org/fhir/> .
    @prefix owl: <http://www.w3.org/2002/07/owl#> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

    # - resource -------------------------------------------------------------------

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