<?xml version="1.0" encoding="UTF-8"?>
<library xmlns="urn:hl7-org:elm:r1" xmlns:t="urn:hl7-org:elm-types:r1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fhir="http://hl7.org/fhir" xmlns:qdm43="urn:healthit-gov:qdm:v4_3" xmlns:qdm53="urn:healthit-gov:qdm:v5_3" xmlns:a="urn:hl7-org:cql-annotations:r1" localId="0">
   <annotation translatorOptions="EnableAnnotations,EnableLocators,DisableListDemotion,DisableListPromotion" signatureLevel="Overloads" xsi:type="a:CqlToElmInfo"/>
   <annotation message="An operand identifier reference is hiding another identifier of the same name." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation message="An operand identifier reference is hiding another identifier of the same name." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation message="An operand identifier reference is hiding another identifier of the same name." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation xsi:type="a:Annotation">
      <a:s r="273">
         <a:s>/*
  * Library: IMMZD5DTBCGElements
  */
library IMMZD5DTBCGElements</a:s>
      </a:s>
   </annotation>
   <identifier id="IMMZD5DTBCGElements" system="http://smart.who.int/immunizations"/>
   <schemaIdentifier id="urn:hl7-org:elm" version="r1"/>
   <usings>
      <def localId="1" localIdentifier="System" uri="urn:hl7-org:elm-types:r1" version="1.0.0"/>
      <def localId="206" locator="7:1-7:26" localIdentifier="FHIR" uri="http://hl7.org/fhir" version="4.0.1">
         <annotation xsi:type="a:Annotation">
            <a:s r="206">
               <a:s>using </a:s>
               <a:s>
                  <a:s>FHIR</a:s>
               </a:s>
               <a:s> version '4.0.1'</a:s>
            </a:s>
         </annotation>
      </def>
   </usings>
   <includes>
      <def localId="208" locator="8:1-8:35" localIdentifier="FHIRHelpers" path="http://hl7.org/fhir/FHIRHelpers" version="4.0.1">
         <annotation xsi:type="a:Annotation">
            <a:s r="208">
               <a:s>include </a:s>
               <a:s>
                  <a:s>FHIRHelpers</a:s>
               </a:s>
               <a:s> version '4.0.1'</a:s>
            </a:s>
         </annotation>
      </def>
      <def localId="210" locator="10:1-10:19" localIdentifier="WHOConcepts" path="http://smart.who.int/immunizations/WHOConcepts">
         <annotation xsi:type="a:Annotation">
            <a:s r="210">
               <a:s>include </a:s>
               <a:s>
                  <a:s>WHOConcepts</a:s>
               </a:s>
            </a:s>
         </annotation>
      </def>
      <def localId="212" locator="11:1-11:27" localIdentifier="WC" path="http://smart.who.int/immunizations/WHOCommon">
         <annotation xsi:type="a:Annotation">
            <a:s r="212">
               <a:s>include </a:s>
               <a:s>
                  <a:s>WHOCommon</a:s>
               </a:s>
               <a:s> called WC</a:s>
            </a:s>
         </annotation>
      </def>
      <def localId="214" locator="12:1-12:29" localIdentifier="WE" path="http://smart.who.int/immunizations/WHOElements">
         <annotation xsi:type="a:Annotation">
            <a:s r="214">
               <a:s>include </a:s>
               <a:s>
                  <a:s>WHOElements</a:s>
               </a:s>
               <a:s> called WE</a:s>
            </a:s>
         </annotation>
      </def>
      <def localId="216" locator="14:1-14:32" localIdentifier="Common" path="http://smart.who.int/immunizations/IMMZCommon">
         <annotation xsi:type="a:Annotation">
            <a:s r="216">
               <a:s>include </a:s>
               <a:s>
                  <a:s>IMMZCommon</a:s>
               </a:s>
               <a:s> called Common</a:s>
            </a:s>
         </annotation>
      </def>
      <def localId="218" locator="15:1-15:36" localIdentifier="Concepts" path="http://smart.who.int/immunizations/IMMZConcepts">
         <annotation xsi:type="a:Annotation">
            <a:s r="218">
               <a:s>include </a:s>
               <a:s>
                  <a:s>IMMZConcepts</a:s>
               </a:s>
               <a:s> called Concepts</a:s>
            </a:s>
         </annotation>
      </def>
      <def localId="220" locator="16:1-16:36" localIdentifier="Elements" path="http://smart.who.int/immunizations/IMMZElements">
         <annotation xsi:type="a:Annotation">
            <a:s r="220">
               <a:s>include </a:s>
               <a:s>
                  <a:s>IMMZElements</a:s>
               </a:s>
               <a:s> called Elements</a:s>
            </a:s>
         </annotation>
      </def>
   </includes>
   <contexts>
      <def localId="225" locator="18:1-18:15" name="Patient"/>
   </contexts>
   <statements>
      <def localId="223" locator="18:1-18:15" name="Patient" context="Patient">
         <expression localId="224" xsi:type="SingletonFrom">
            <operand localId="222" locator="18:1-18:15" dataType="fhir:Patient" templateId="http://hl7.org/fhir/StructureDefinition/Patient" xsi:type="Retrieve"/>
         </expression>
      </def>
      <def localId="228" locator="23:1-25:50" name="Draft Medication Request for BCG dose" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="internal" value="Draft Medication Request for BCG dose"/>
            <a:s r="228">
               <a:s>/*
@internal: Draft Medication Request for BCG dose
*/
define &quot;Draft Medication Request for BCG dose&quot;:
  </a:s>
               <a:s r="241">
                  <a:s>
                     <a:s r="229">
                        <a:s r="231">
                           <a:s>
                              <a:s>Elements.&quot;Draft Medication Request for Patient&quot;</a:s>
                           </a:s>
                        </a:s>
                        <a:s> MR</a:s>
                     </a:s>
                  </a:s>
                  <a:s>
    </a:s>
                  <a:s r="237">
                     <a:s>where </a:s>
                     <a:s r="237">
                        <a:s r="234">
                           <a:s r="233">
                              <a:s>MR</a:s>
                           </a:s>
                           <a:s>.</a:s>
                           <a:s r="234">
                              <a:s>medication</a:s>
                           </a:s>
                        </a:s>
                        <a:s> in </a:s>
                        <a:s r="236">
                           <a:s r="235">
                              <a:s>Concepts</a:s>
                           </a:s>
                           <a:s>.</a:s>
                           <a:s r="236">
                              <a:s>&quot;BCG vaccines&quot;</a:s>
                           </a:s>
                        </a:s>
                     </a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="241" locator="24:3-25:50" xsi:type="Query">
            <source localId="229" locator="24:3-24:52" alias="MR">
               <expression localId="231" locator="24:3-24:49" name="Draft Medication Request for Patient" libraryName="Elements" xsi:type="ExpressionRef"/>
            </source>
            <where localId="237" locator="25:5-25:50" xsi:type="InValueSet">
               <signature localId="240" name="t:Concept" xsi:type="NamedTypeSpecifier"/>
               <code localId="239" name="ToConcept" libraryName="FHIRHelpers" xsi:type="FunctionRef">
                  <operand localId="238" asType="fhir:CodeableConcept" xsi:type="As">
                     <operand localId="234" locator="25:11-25:23" path="medication" scope="MR" xsi:type="Property"/>
                  </operand>
               </code>
               <valueset localId="236" locator="25:28-25:50" name="BCG vaccines" libraryName="Concepts" preserve="true"/>
            </where>
         </expression>
      </def>
      <def localId="244" locator="33:1-34:35" name="The client is pregnant" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="The client is pregnant"/>
            <a:t name="pseudocode" value="&quot;Potential contraindications&quot; = &quot;Currently pregnant&quot;"/>
            <a:t name="code" value="The client is pregnant-52"/>
            <a:t name="decision" value="IMMZ.D5.DT.BCG contraindications"/>
            <a:s r="244">
               <a:s>/*
@input: The client is pregnant
@pseudocode: &quot;Potential contraindications&quot; = &quot;Currently pregnant&quot;
@code: The client is pregnant-52
@decision: IMMZ.D5.DT.BCG contraindications
*/
define &quot;The client is pregnant&quot;:
  </a:s>
               <a:s r="246">
                  <a:s r="245">
                     <a:s>Elements</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="246">
                     <a:s>&quot;The client is pregnant&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="246" locator="34:3-34:35" name="The client is pregnant" libraryName="Elements" xsi:type="ExpressionRef"/>
      </def>
      <def localId="249" locator="42:1-43:64" name="The client has history of severe allergic reactions" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="The client has history of severe allergic reactions"/>
            <a:t name="pseudocode" value="&quot;Potential contraindications&quot; = &quot;Severe allergic reactions&quot;"/>
            <a:t name="code" value="The client has history of severe allergic reactions-60"/>
            <a:t name="decision" value="IMMZ.D5.DT.BCG contraindications"/>
            <a:s r="249">
               <a:s>/*
@input: The client has history of severe allergic reactions
@pseudocode: '&quot;Potential contraindications&quot; = &quot;Severe allergic reactions&quot;
@code: The client has history of severe allergic reactions-60
@decision: IMMZ.D5.DT.BCG contraindications
*/
define &quot;The client has history of severe allergic reactions&quot;:
  </a:s>
               <a:s r="251">
                  <a:s r="250">
                     <a:s>Elements</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="251">
                     <a:s>&quot;The client has history of severe allergic reactions&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="251" locator="43:3-43:64" name="The client has history of severe allergic reactions" libraryName="Elements" xsi:type="ExpressionRef"/>
      </def>
      <def localId="254" locator="51:1-52:54" name="The client has immunodeficiency syndromes" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="The client has immunodeficiency syndromes"/>
            <a:t name="pseudocode" value="&quot;Potential contraindications&quot; = &quot;Immunodeficiency syndromes&quot;"/>
            <a:t name="code" value="The client has immunodeficiency syndromes-60"/>
            <a:t name="decision" value="IMMZ.D5.DT.BCG contraindications"/>
            <a:s r="254">
               <a:s>/*
@input: The client has immunodeficiency syndromes
@pseudocode: &quot;Potential contraindications&quot; = &quot;Immunodeficiency syndromes&quot;
@code: The client has immunodeficiency syndromes-60
@decision: IMMZ.D5.DT.BCG contraindications
*/
define &quot;The client has immunodeficiency syndromes&quot;:
  </a:s>
               <a:s r="256">
                  <a:s r="255">
                     <a:s>Elements</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="256">
                     <a:s>&quot;The client has immunodeficiency syndromes&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="256" locator="52:3-52:54" name="The client has immunodeficiency syndromes" libraryName="Elements" xsi:type="ExpressionRef"/>
      </def>
      <def localId="259" locator="60:1-61:65" name="The client is exposed to immunosuppressive treatment" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="The client is exposed to immunosuppressive treatment"/>
            <a:t name="pseudocode" value="&quot;Potential contraindications&quot; = &quot;Exposed to immunosuppressive treatment&quot;"/>
            <a:t name="code" value="The client is exposed to immunosuppressive treatment-72"/>
            <a:t name="decision" value="IMMZ.D5.DT.BCG contraindications"/>
            <a:s r="259">
               <a:s>/*
@input: The client is exposed to immunosuppressive treatment
@pseudocode: &quot;Potential contraindications&quot; = &quot;Exposed to immunosuppressive treatment&quot;
@code: The client is exposed to immunosuppressive treatment-72
@decision: IMMZ.D5.DT.BCG contraindications
*/
define &quot;The client is exposed to immunosuppressive treatment&quot;:
  </a:s>
               <a:s r="261">
                  <a:s r="260">
                     <a:s>Elements</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="261">
                     <a:s>&quot;The client is exposed to immunosuppressive treatment&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="261" locator="61:3-61:65" name="The client is exposed to immunosuppressive treatment" libraryName="Elements" xsi:type="ExpressionRef"/>
      </def>
      <def localId="264" locator="69:1-70:45" name="Client's age is less than 1 year" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is less than 1 year"/>
            <a:t name="pseudocode" value="&quot;Age&quot; &lt; 1 year"/>
            <a:t name="code" value="Client's age is less than 1 year-14"/>
            <a:t name="decision" value="IMMZ.D5.DT.BCG contraindications"/>
            <a:s r="264">
               <a:s>/*
@input: Client's age is less than 1 year
@pseudocode: &quot;Age&quot; &lt; 1 year
@code: Client's age is less than 1 year-14
@decision: IMMZ.D5.DT.BCG contraindications
*/
define &quot;Client's age is less than 1 year&quot;:
  </a:s>
               <a:s r="265">
                  <a:s r="267">
                     <a:s r="266">
                        <a:s>Elements</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="267">
                        <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="268"> &lt; 1</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="265" locator="70:3-70:45" xsi:type="Less">
            <signature localId="269" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="270" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="267" locator="70:3-70:41" name="Current Patient Age In Years" libraryName="Elements" xsi:type="ExpressionRef"/>
            <operand localId="268" locator="70:45" valueType="t:Integer" value="1" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="273" locator="78:1-79:46" name="Client's age is more than or equal to 1 year" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is more than or equal to 1 year"/>
            <a:t name="pseudocode" value="&quot;Age&quot; ≥ 1 year"/>
            <a:t name="code" value="Client's age is more than or equal to 1 year-14"/>
            <a:t name="decision" value="IMMZ.D5.DT.BCG contraindications"/>
            <a:s r="273">
               <a:s>/*
@input: Client's age is more than or equal to 1 year
@pseudocode: &quot;Age&quot; ≥ 1 year
@code: Client's age is more than or equal to 1 year-14
@decision: IMMZ.D5.DT.BCG contraindications
*/
define &quot;Client's age is more than or equal to 1 year&quot;:
  </a:s>
               <a:s r="274">
                  <a:s r="276">
                     <a:s r="275">
                        <a:s>Elements</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="276">
                        <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="277"> >= 1</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="274" locator="79:3-79:46" xsi:type="GreaterOrEqual">
            <signature localId="278" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="279" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="276" locator="79:3-79:41" name="Current Patient Age In Years" libraryName="Elements" xsi:type="ExpressionRef"/>
            <operand localId="277" locator="79:46" valueType="t:Integer" value="1" xsi:type="Literal"/>
         </expression>
      </def>
   </statements>
</library>
