<?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="338">
         <a:s>/*
  * Library: IMMZD2DTTyphoidEncounterElements
  */
library IMMZD2DTTyphoidEncounterElements</a:s>
      </a:s>
   </annotation>
   <identifier id="IMMZD2DTTyphoidEncounterElements" 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:46" localIdentifier="Encounter" path="http://smart.who.int/immunizations/IMMZEncounterElements">
         <annotation xsi:type="a:Annotation">
            <a:s r="220">
               <a:s>include </a:s>
               <a:s>
                  <a:s>IMMZEncounterElements</a:s>
               </a:s>
               <a:s> called Encounter</a:s>
            </a:s>
         </annotation>
      </def>
      <def localId="222" locator="18:1-18:54" localIdentifier="TyphoidElements" path="http://smart.who.int/immunizations/IMMZD2DTTyphoidElements">
         <annotation xsi:type="a:Annotation">
            <a:s r="222">
               <a:s>include </a:s>
               <a:s>
                  <a:s>IMMZD2DTTyphoidElements</a:s>
               </a:s>
               <a:s> called TyphoidElements</a:s>
            </a:s>
         </annotation>
      </def>
   </includes>
   <parameters>
      <def localId="224" locator="20:1-20:36" name="Today" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:s r="224">
               <a:s>parameter Today </a:s>
               <a:s r="228">
                  <a:s>Date</a:s>
               </a:s>
               <a:s> default </a:s>
               <a:s r="227">
                  <a:s>Today()</a:s>
               </a:s>
            </a:s>
         </annotation>
         <default localId="227" locator="20:30-20:36" xsi:type="Today"/>
         <parameterTypeSpecifier localId="228" locator="20:17-20:20" name="t:Date" xsi:type="NamedTypeSpecifier"/>
      </def>
      <def localId="230" locator="21:1-21:28" name="EncounterId" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:s r="230">
               <a:s>parameter EncounterId </a:s>
               <a:s r="231">
                  <a:s>String</a:s>
               </a:s>
            </a:s>
         </annotation>
         <parameterTypeSpecifier localId="231" locator="21:23-21:28" name="t:String" xsi:type="NamedTypeSpecifier"/>
      </def>
   </parameters>
   <contexts>
      <def localId="236" locator="23:1-23:15" name="Patient"/>
   </contexts>
   <statements>
      <def localId="234" locator="23:1-23:15" name="Patient" context="Patient">
         <expression localId="235" xsi:type="SingletonFrom">
            <operand localId="233" locator="23:1-23:15" dataType="fhir:Patient" templateId="http://hl7.org/fhir/StructureDefinition/Patient" xsi:type="Retrieve"/>
         </expression>
      </def>
      <def localId="239" locator="28:1-31:48" name="Typhoid Doses Administered to Patient" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="internal" value="Typhoid containing Doses Administered to Patient"/>
            <a:s r="239">
               <a:s>/*
@internal: Typhoid containing Doses Administered to Patient
*/
define &quot;Typhoid Doses Administered to Patient&quot;:
  </a:s>
               <a:s r="251">
                  <a:s>
                     <a:s r="240">
                        <a:s r="242">
                           <a:s>
                              <a:s>Encounter.&quot;Doses Administered to Patient&quot;</a:s>
                           </a:s>
                        </a:s>
                        <a:s> I</a:s>
                     </a:s>
                  </a:s>
                  <a:s>
  </a:s>
                  <a:s r="248">
                     <a:s>where
    </a:s>
                     <a:s r="248">
                        <a:s r="245">
                           <a:s r="244">
                              <a:s>I</a:s>
                           </a:s>
                           <a:s>.</a:s>
                           <a:s r="245">
                              <a:s>vaccineCode</a:s>
                           </a:s>
                        </a:s>
                        <a:s> in </a:s>
                        <a:s r="247">
                           <a:s r="246">
                              <a:s>Concepts</a:s>
                           </a:s>
                           <a:s>.</a:s>
                           <a:s r="247">
                              <a:s>&quot;Typhoid vaccines&quot;</a:s>
                           </a:s>
                        </a:s>
                     </a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="251" locator="29:3-31:48" xsi:type="Query">
            <source localId="240" locator="29:3-29:45" alias="I">
               <expression localId="242" locator="29:3-29:43" name="Doses Administered to Patient" libraryName="Encounter" xsi:type="ExpressionRef"/>
            </source>
            <where localId="248" locator="30:3-31:48" xsi:type="InValueSet">
               <signature localId="250" name="t:Concept" xsi:type="NamedTypeSpecifier"/>
               <code localId="249" name="ToConcept" libraryName="FHIRHelpers" xsi:type="FunctionRef">
                  <operand localId="245" locator="31:5-31:17" path="vaccineCode" scope="I" xsi:type="Property"/>
               </code>
               <valueset localId="247" locator="31:22-31:48" name="Typhoid vaccines" libraryName="Concepts" preserve="true"/>
            </where>
         </expression>
      </def>
      <def localId="254" locator="36:1-37:57" name="Typhoid Primary Series Doses Administered to Patient" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="internal" value="Typhoid containing Doses Administered to Patient that are in the Primary series"/>
            <a:s r="254">
               <a:s>/*
@internal: Typhoid containing Doses Administered to Patient that are in the Primary series
*/
define &quot;Typhoid Primary Series Doses Administered to Patient&quot;:
  </a:s>
               <a:s r="256">
                  <a:s r="255">
                     <a:s>&quot;Typhoid Doses Administered to Patient&quot;</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="256">
                     <a:s>seriesPrimary()</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="256" locator="37:3-37:57" name="seriesPrimary" libraryName="Common" xsi:type="FunctionRef">
            <operand localId="255" locator="37:3-37:41" name="Typhoid Doses Administered to Patient" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def localId="259" locator="42:1-43:63" name="Number of Typhoid Primary Series Doses Administered" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="internal" value="Number of Typhoid Primary Series doses"/>
            <a:s r="259">
               <a:s>/*
@internal: Number of Typhoid Primary Series doses
*/
define &quot;Number of Typhoid Primary Series Doses Administered&quot;:
  </a:s>
               <a:s r="263">
                  <a:s>Count(</a:s>
                  <a:s r="260">
                     <a:s>&quot;Typhoid Primary Series Doses Administered to Patient&quot;</a:s>
                  </a:s>
                  <a:s>)</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="263" locator="43:3-43:63" xsi:type="Count">
            <source localId="260" locator="43:9-43:62" name="Typhoid Primary Series Doses Administered to Patient" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def localId="266" locator="51:1-52:47" name="Client's age is less than 6 months" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is less than 6 months"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; &lt; 6 months"/>
            <a:t name="code" value="Client's age is less than 6 months-41"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.TCV: Typhoid conjugate vaccine (TCV) schedule"/>
            <a:s r="266">
               <a:s>/*
@input: Client's age is less than 6 months
@pseudocode: Today's date − &quot;Date of birth&quot; &lt; 6 months
@code: Client's age is less than 6 months-41
@decision: IMMZ.D2.DT.Typhoid.TCV: Typhoid conjugate vaccine (TCV) schedule
*/
define &quot;Client's age is less than 6 months&quot;:
  </a:s>
               <a:s r="267">
                  <a:s r="269">
                     <a:s r="268">
                        <a:s>Encounter</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="269">
                        <a:s>&quot;Current Patient Age In Months&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="270"> &lt; 6</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="267" locator="52:3-52:47" xsi:type="Less">
            <signature localId="271" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="272" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="269" locator="52:3-52:43" name="Current Patient Age In Months" libraryName="Encounter" xsi:type="ExpressionRef"/>
            <operand localId="270" locator="52:47" valueType="t:Integer" value="6" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="275" locator="61:1-62:59" name="No typhoid primary series doses were administered" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="No typhoid primary series doses were administered"/>
            <a:t name="pseudocode" value="&quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 0"/>
            <a:t name="code" value="No typhoid primary series doses were administered-116"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.TCV: Typhoid conjugate vaccine (TCV) schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule"/>
            <a:s r="275">
               <a:s>/*
@input: No typhoid primary series doses were administered
@pseudocode: Count of vaccines administered (where &quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 0
@code: No typhoid primary series doses were administered-116
@decision: IMMZ.D2.DT.Typhoid.TCV: Typhoid conjugate vaccine (TCV) schedule
@decision: IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule
*/
define &quot;No typhoid primary series doses were administered&quot;:
  </a:s>
               <a:s r="276">
                  <a:s r="277">
                     <a:s>&quot;Number of Typhoid Primary Series Doses Administered&quot;</a:s>
                  </a:s>
                  <a:s r="278"> = 0</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="276" locator="62:3-62:59" xsi:type="Equal">
            <signature localId="279" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="280" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="277" locator="62:3-62:55" name="Number of Typhoid Primary Series Doses Administered" xsi:type="ExpressionRef"/>
            <operand localId="278" locator="62:59" valueType="t:Integer" value="0" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="283" locator="70:1-72:51" name="Client's age is between 6 months and 45 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is between 6 months and 45 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; &lt; 45 years"/>
            <a:t name="code" value="Client's age is between 6 months and 45 years-52"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.TCV: Typhoid conjugate vaccine (TCV) schedule"/>
            <a:s r="283">
               <a:s>/*
@input: Client's age is between 6 months and 45 years
@pseudocode: 6 months ≤ Today's date − &quot;Date of birth&quot; &lt; 45 years
@code: Client's age is between 6 months and 45 years-52
@decision: IMMZ.D2.DT.Typhoid.TCV: Typhoid conjugate vaccine (TCV) schedule
*/
define &quot;Client's age is between 6 months and 45 years&quot;:
  </a:s>
               <a:s r="284">
                  <a:s r="285">
                     <a:s r="286">6 &lt;= </a:s>
                     <a:s r="288">
                        <a:s r="287">
                           <a:s>Encounter</a:s>
                        </a:s>
                        <a:s>.</a:s>
                        <a:s r="288">
                           <a:s>&quot;Current Patient Age In Months&quot;</a:s>
                        </a:s>
                     </a:s>
                  </a:s>
                  <a:s>
  and </a:s>
                  <a:s r="291">
                     <a:s r="293">
                        <a:s r="292">
                           <a:s>Encounter</a:s>
                        </a:s>
                        <a:s>.</a:s>
                        <a:s r="293">
                           <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                        </a:s>
                     </a:s>
                     <a:s r="294"> &lt; 45</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="284" locator="71:3-72:51" xsi:type="And">
            <operand localId="285" locator="71:3-71:48" xsi:type="LessOrEqual">
               <signature localId="289" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <signature localId="290" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <operand localId="286" locator="71:3" valueType="t:Integer" value="6" xsi:type="Literal"/>
               <operand localId="288" locator="71:8-71:48" name="Current Patient Age In Months" libraryName="Encounter" xsi:type="ExpressionRef"/>
            </operand>
            <operand localId="291" locator="72:7-72:51" xsi:type="Less">
               <signature localId="295" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <signature localId="296" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <operand localId="293" locator="72:7-72:46" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
               <operand localId="294" locator="72:50-72:51" valueType="t:Integer" value="45" xsi:type="Literal"/>
            </operand>
         </expression>
      </def>
      <def localId="299" locator="80:1-81:48" name="Client's age is more than or equal to 45 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is more than or equal to 45 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; ≥ 45 years"/>
            <a:t name="code" value="Client's age is more than or equal to 45 years-41"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.TCV: Typhoid conjugate vaccine (TCV) schedule"/>
            <a:s r="299">
               <a:s>/*
@input: Client's age is more than or equal to 45 years
@pseudocode: Today's date − &quot;Date of birth&quot; ≥ 45 years
@code: Client's age is more than or equal to 45 years-41
@decision: IMMZ.D2.DT.Typhoid.TCV: Typhoid conjugate vaccine (TCV) schedule
*/
define &quot;Client's age is more than or equal to 45 years&quot;:
  </a:s>
               <a:s r="300">
                  <a:s r="302">
                     <a:s r="301">
                        <a:s>Encounter</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="302">
                        <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="303"> >= 45</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="300" locator="81:3-81:48" xsi:type="GreaterOrEqual">
            <signature localId="304" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="305" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="302" locator="81:3-81:42" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
            <operand localId="303" locator="81:47-81:48" valueType="t:Integer" value="45" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="308" locator="90:1-91:59" name="One typhoid primary series dose was administered" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="One typhoid primary series dose was administered"/>
            <a:t name="pseudocode" value="&quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 1"/>
            <a:t name="code" value="One typhoid primary series dose was administered-116"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.TCV: Typhoid conjugate vaccine (TCV) schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule"/>
            <a:s r="308">
               <a:s>/*
@input: One typhoid primary series dose was administered
@pseudocode: Count of vaccines administered (where &quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 1
@code: One typhoid primary series dose was administered-116
@decision: IMMZ.D2.DT.Typhoid.TCV: Typhoid conjugate vaccine (TCV) schedule
@decision: IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule
*/
define &quot;One typhoid primary series dose was administered&quot;:
  </a:s>
               <a:s r="309">
                  <a:s r="310">
                     <a:s>&quot;Number of Typhoid Primary Series Doses Administered&quot;</a:s>
                  </a:s>
                  <a:s r="311"> = 1</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="309" locator="91:3-91:59" xsi:type="Equal">
            <signature localId="312" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="313" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="310" locator="91:3-91:55" name="Number of Typhoid Primary Series Doses Administered" xsi:type="ExpressionRef"/>
            <operand localId="311" locator="91:59" valueType="t:Integer" value="1" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="316" locator="99:1-100:46" name="Client's age is less than 2 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is less than 2 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; &lt; 2 years"/>
            <a:t name="code" value="Client's age is less than 2 years-40"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule"/>
            <a:s r="316">
               <a:s>/*
@input: Client's age is less than 2 years
@pseudocode: Today's date − &quot;Date of birth&quot; &lt; 2 years
@code: Client's age is less than 2 years-40
@decision: IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule
*/
define &quot;Client's age is less than 2 years&quot;:
  </a:s>
               <a:s r="317">
                  <a:s r="319">
                     <a:s r="318">
                        <a:s>Encounter</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="319">
                        <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="320"> &lt; 2</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="317" locator="100:3-100:46" xsi:type="Less">
            <signature localId="321" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="322" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="319" locator="100:3-100:42" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
            <operand localId="320" locator="100:46" valueType="t:Integer" value="2" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="325" locator="108:1-109:47" name="Client's age is more than or equal to 2 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is more than or equal to 2 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; ≥ 2 years"/>
            <a:t name="code" value="Client's age is more than or equal to 2 years-40"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule"/>
            <a:s r="325">
               <a:s>/*
@input: Client's age is more than or equal to 2 years
@pseudocode: Today's date − &quot;Date of birth&quot; ≥ 2 years
@code: Client's age is more than or equal to 2 years-40
@decision: IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule
*/
define &quot;Client's age is more than or equal to 2 years&quot;:
  </a:s>
               <a:s r="326">
                  <a:s r="328">
                     <a:s r="327">
                        <a:s>Encounter</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="328">
                        <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="329"> >= 2</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="326" locator="109:3-109:47" xsi:type="GreaterOrEqual">
            <signature localId="330" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="331" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="328" locator="109:3-109:42" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
            <operand localId="329" locator="109:47" valueType="t:Integer" value="2" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="338" locator="193:1-194:97" name="Date of Latest Typhoid Dose" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="internal" value="Date of Latest Typhoid Dose"/>
            <a:s r="338">
               <a:s>/*
@internal: Date of Latest Typhoid Dose
*/
define &quot;Date of Latest Typhoid Dose&quot;:
  </a:s>
               <a:s r="339">
                  <a:s>date from </a:s>
                  <a:s r="340">
                     <a:s>start of </a:s>
                     <a:s r="346">
                        <a:s r="345">
                           <a:s r="342">
                              <a:s r="341">
                                 <a:s>&quot;Typhoid Doses Administered to Patient&quot;</a:s>
                              </a:s>
                              <a:s>.</a:s>
                              <a:s r="342">
                                 <a:s>mostRecent()</a:s>
                              </a:s>
                           </a:s>
                           <a:s>.</a:s>
                           <a:s r="345">
                              <a:s>occurrence</a:s>
                           </a:s>
                        </a:s>
                        <a:s>.</a:s>
                        <a:s r="346">
                           <a:s>toInterval()</a:s>
                        </a:s>
                     </a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="339" locator="194:3-194:97" xsi:type="DateFrom">
            <operand localId="340" locator="194:13-194:97" xsi:type="Start">
               <operand localId="346" locator="194:22-194:97" name="toInterval" libraryName="WC" xsi:type="FunctionRef">
                  <operand localId="345" locator="194:22-194:84" path="occurrence" xsi:type="Property">
                     <source localId="342" locator="194:22-194:73" name="mostRecent" libraryName="WC" xsi:type="FunctionRef">
                        <signature localId="343" xsi:type="ListTypeSpecifier">
                           <elementType localId="344" name="fhir:Immunization" xsi:type="NamedTypeSpecifier"/>
                        </signature>
                        <operand localId="341" locator="194:22-194:60" name="Typhoid Doses Administered to Patient" xsi:type="ExpressionRef"/>
                     </source>
                  </operand>
               </operand>
            </operand>
         </expression>
      </def>
      <def localId="334" locator="118:1-120:77" name="The latest typhoid dose was administered less than 3 years ago" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="The latest typhoid dose was administered less than 3 years ago"/>
            <a:t name="pseudocode" value="&quot;Date and time of vaccination&quot; (where &quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot;) &lt; 3 years"/>
            <a:t name="code" value="The latest typhoid dose was administered less than 3 years ago-106"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule"/>
            <a:s r="334">
               <a:s>/*
@input: The latest typhoid dose was administered less than 3 years ago
@pseudocode: Today's date − latest &quot;Date and time of vaccination&quot; (where &quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot;) &lt; 3 years
@code: The latest typhoid dose was administered less than 3 years ago-106
@decision: IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule
@decision: IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule
*/
define &quot;The latest typhoid dose was administered less than 3 years ago&quot;:
  </a:s>
               <a:s r="335">
                  <a:s r="349">
                     <a:s r="347">
                        <a:s>&quot;Date of Latest Typhoid Dose&quot;</a:s>
                     </a:s>
                     <a:s> is not null</a:s>
                  </a:s>
                  <a:s>
    and </a:s>
                  <a:s r="350">
                     <a:s r="351">
                        <a:s>duration in years between </a:s>
                        <a:s r="352">
                           <a:s>&quot;Date of Latest Typhoid Dose&quot;</a:s>
                        </a:s>
                        <a:s> and </a:s>
                        <a:s r="353">
                           <a:s>Today</a:s>
                        </a:s>
                     </a:s>
                     <a:s r="356"> &lt; 3</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="335" locator="119:3-120:77" xsi:type="And">
            <operand localId="349" locator="119:3-119:43" xsi:type="Not">
               <operand localId="348" locator="119:3-119:43" xsi:type="IsNull">
                  <operand localId="347" locator="119:3-119:31" name="Date of Latest Typhoid Dose" xsi:type="ExpressionRef"/>
               </operand>
            </operand>
            <operand localId="350" locator="120:9-120:77" xsi:type="Less">
               <signature localId="357" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <signature localId="358" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <operand localId="351" locator="120:9-120:73" precision="Year" xsi:type="DurationBetween">
                  <signature localId="354" name="t:Date" xsi:type="NamedTypeSpecifier"/>
                  <signature localId="355" name="t:Date" xsi:type="NamedTypeSpecifier"/>
                  <operand localId="352" locator="120:35-120:63" name="Date of Latest Typhoid Dose" xsi:type="ExpressionRef"/>
                  <operand localId="353" locator="120:69-120:73" name="Today" xsi:type="ParameterRef"/>
               </operand>
               <operand localId="356" locator="120:77" valueType="t:Integer" value="3" xsi:type="Literal"/>
            </operand>
         </expression>
      </def>
      <def localId="361" locator="129:1-130:70" name="The latest typhoid dose was administered more than 3 years ago" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="The latest typhoid dose was administered more than 3 years ago"/>
            <a:t name="pseudocode" value="&quot;Date and time of vaccination&quot; (where &quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot;) ≥ 3 years"/>
            <a:t name="code" value="The latest typhoid dose was administered more than 3 years ago-106"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule"/>
            <a:s r="361">
               <a:s>/*
@input: The latest typhoid dose was administered more than 3 years ago
@pseudocode: Today's date − latest &quot;Date and time of vaccination&quot; (where &quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot;) ≥ 3 years
@code: The latest typhoid dose was administered more than 3 years ago-106
@decision: IMMZ.D2.DT.Typhoid.ViPS: Unconjugated Vi polysaccharide (ViPS) schedule
@decision: IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule
*/
define &quot;The latest typhoid dose was administered more than 3 years ago&quot;:
  </a:s>
               <a:s r="362">
                  <a:s>not </a:s>
                  <a:s r="363">
                     <a:s>&quot;The latest typhoid dose was administered less than 3 years ago&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="362" locator="130:3-130:70" xsi:type="Not">
            <operand localId="363" locator="130:7-130:70" name="The latest typhoid dose was administered less than 3 years ago" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def localId="366" locator="138:1-139:46" name="Client's age is less than 6 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is less than 6 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; &lt; 6 years"/>
            <a:t name="code" value="Client's age is less than 6 years-40"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule"/>
            <a:s r="366">
               <a:s>/*
@input: Client's age is less than 6 years
@pseudocode: Today's date − &quot;Date of birth&quot; &lt; 6 years
@code: Client's age is less than 6 years-40
@decision: IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule
*/
define &quot;Client's age is less than 6 years&quot;:
  </a:s>
               <a:s r="367">
                  <a:s r="369">
                     <a:s r="368">
                        <a:s>Encounter</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="369">
                        <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="370"> &lt; 6</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="367" locator="139:3-139:46" xsi:type="Less">
            <signature localId="371" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="372" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="369" locator="139:3-139:42" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
            <operand localId="370" locator="139:46" valueType="t:Integer" value="6" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="375" locator="147:1-148:47" name="Client's age is more than or equal to 6 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is more than or equal to 6 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; ≥ 6 years"/>
            <a:t name="code" value="Client's age is more than or equal to 6 years-40"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule"/>
            <a:s r="375">
               <a:s>/*
@input: Client's age is more than or equal to 6 years
@pseudocode: Today's date − &quot;Date of birth&quot; ≥ 6 years
@code: Client's age is more than or equal to 6 years-40
@decision: IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule
*/
define &quot;Client's age is more than or equal to 6 years&quot;:
  </a:s>
               <a:s r="376">
                  <a:s r="378">
                     <a:s r="377">
                        <a:s>Encounter</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="378">
                        <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="379"> >= 6</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="376" locator="148:3-148:47" xsi:type="GreaterOrEqual">
            <signature localId="380" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="381" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="378" locator="148:3-148:42" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
            <operand localId="379" locator="148:47" valueType="t:Integer" value="6" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="388" locator="183:1-188:11" name="Primary series is complete" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Primary series is complete"/>
            <a:t name="pseudocode" value="&quot;Completed the primary vaccination series&quot; (where &quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot;) = TRUE"/>
            <a:t name="code" value="Primary series is complete-93"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule"/>
            <a:s r="388">
               <a:s>/*
@input: Primary series is complete
@pseudocode: &quot;Completed the primary vaccination series&quot; (where &quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot;) = TRUE
@code: Primary series is complete-93
@decision: IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule
*/
define &quot;Primary series is complete&quot;:
  </a:s>
               <a:s r="389">
                  <a:s r="390">
                     <a:s>&quot;One typhoid primary series dose was administered&quot;</a:s>
                  </a:s>
                  <a:s>
  or </a:s>
                  <a:s r="421">
                     <a:s>Coalesce(
    </a:s>
                     <a:s r="417">
                        <a:s>
                           <a:s r="391">
                              <a:s r="392">
                                 <a:s>
                                    <a:s>&quot;Typhoid Doses Administered to Patient&quot;</a:s>
                                 </a:s>
                              </a:s>
                              <a:s> Dose</a:s>
                           </a:s>
                        </a:s>
                        <a:s>
    </a:s>
                        <a:s r="394">
                           <a:s>aggregate Result: </a:s>
                           <a:s r="397">
                              <a:s r="411">
                                 <a:s r="409">
                                    <a:s r="399">
                                       <a:s r="398">
                                          <a:s>Encounter</a:s>
                                       </a:s>
                                       <a:s>.</a:s>
                                       <a:s r="399">
                                          <a:s>&quot;Completed the primary vaccination series Observation&quot;</a:s>
                                       </a:s>
                                    </a:s>
                                    <a:s>.</a:s>
                                    <a:s r="409">
                                       <a:s>partOf</a:s>
                                    </a:s>
                                 </a:s>
                                 <a:s>.</a:s>
                                 <a:s r="411">
                                    <a:s>references(</a:s>
                                    <a:s r="410">
                                       <a:s>Dose</a:s>
                                    </a:s>
                                    <a:s>)</a:s>
                                 </a:s>
                              </a:s>
                              <a:s> or </a:s>
                              <a:s r="415">
                                 <a:s>Result</a:s>
                              </a:s>
                           </a:s>
                        </a:s>
                     </a:s>
                     <a:s r="418">,
    false )</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="389" locator="184:3-188:11" xsi:type="Or">
            <operand localId="390" locator="184:3-184:52" name="One typhoid primary series dose was administered" xsi:type="ExpressionRef"/>
            <operand localId="421" locator="185:6-188:11" xsi:type="Coalesce">
               <operand localId="417" locator="186:5-187:120" xsi:type="Query">
                  <source localId="391" locator="186:5-186:48" alias="Dose">
                     <expression localId="392" locator="186:5-186:43" name="Typhoid Doses Administered to Patient" xsi:type="ExpressionRef"/>
                  </source>
                  <aggregate localId="394" locator="187:5-187:120" identifier="Result">
                     <expression localId="397" locator="187:23-187:120" xsi:type="Or">
                        <operand localId="411" locator="187:23-187:110" name="references" libraryName="WC" xsi:type="FunctionRef">
                           <signature localId="412" xsi:type="ListTypeSpecifier">
                              <elementType localId="413" name="fhir:Reference" xsi:type="NamedTypeSpecifier"/>
                           </signature>
                           <signature localId="414" name="fhir:Resource" xsi:type="NamedTypeSpecifier"/>
                           <operand localId="409" locator="187:23-187:93" xsi:type="Flatten">
                              <operand localId="407" xsi:type="Query">
                                 <source localId="406" alias="$this">
                                    <expression localId="399" locator="187:23-187:86" name="Completed the primary vaccination series Observation" libraryName="Encounter" xsi:type="ExpressionRef"/>
                                 </source>
                                 <where localId="403" xsi:type="Not">
                                    <operand localId="402" xsi:type="IsNull">
                                       <operand localId="401" path="partOf" xsi:type="Property">
                                          <source localId="400" name="$this" xsi:type="AliasRef"/>
                                       </operand>
                                    </operand>
                                 </where>
                                 <return localId="408" distinct="false">
                                    <expression localId="405" path="partOf" xsi:type="Property">
                                       <source localId="404" name="$this" xsi:type="AliasRef"/>
                                    </expression>
                                 </return>
                              </operand>
                           </operand>
                           <operand localId="410" locator="187:106-187:109" name="Dose" xsi:type="AliasRef"/>
                        </operand>
                        <operand localId="416" asType="t:Boolean" xsi:type="As">
                           <operand localId="415" locator="187:115-187:120" name="Result" xsi:type="QueryLetRef"/>
                        </operand>
                     </expression>
                     <starting localId="395" xsi:type="Null"/>
                  </aggregate>
               </operand>
               <operand localId="418" locator="188:5-188:9" valueType="t:Boolean" value="false" xsi:type="Literal"/>
            </operand>
         </expression>
      </def>
      <def localId="384" locator="156:1-157:34" name="Primary series is not complete" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Primary series is not complete"/>
            <a:t name="pseudocode" value="&quot;Completed the primary vaccination series&quot; (where &quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot;) ≠ TRUE"/>
            <a:t name="code" value="Primary series is not complete-93"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule"/>
            <a:s r="384">
               <a:s>/*
@input: Primary series is not complete
@pseudocode: &quot;Completed the primary vaccination series&quot; (where &quot;Vaccine type&quot; = &quot;Typhoid vaccines&quot;) ≠ TRUE
@code: Primary series is not complete-93
@decision: IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule
*/
define &quot;Primary series is not complete&quot;:
  </a:s>
               <a:s r="385">
                  <a:s>not </a:s>
                  <a:s r="422">
                     <a:s>&quot;Primary series is complete&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="385" locator="157:3-157:34" xsi:type="Not">
            <operand localId="422" locator="157:7-157:34" name="Primary series is complete" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def localId="425" locator="165:1-166:66" name="No live vaccine, other than typhoid, was administered in the past 4 weeks" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="No live vaccine, other than typhoid, was administered in the past 4 weeks"/>
            <a:t name="pseudocode" value="&quot;Date and time of vaccination&quot; (where &quot;Live vaccine&quot; = TRUE AND &quot;Vaccine type&quot; ≠ &quot;Typhoid vaccines&quot;) ≥ 4 weeks"/>
            <a:t name="code" value="No live vaccine, other than typhoid, was administered in the past 4 weeks-132"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule"/>
            <a:s r="425">
               <a:s>/*
@input: No live vaccine, other than typhoid, was administered in the past 4 weeks
@pseudocode: Today's date − latest &quot;Date and time of vaccination&quot; (where &quot;Live vaccine&quot; = TRUE AND &quot;Vaccine type&quot; ≠ &quot;Typhoid vaccines&quot;) ≥ 4 weeks
@code: No live vaccine, other than typhoid, was administered in the past 4 weeks-132
@decision: IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule
*/
define &quot;No live vaccine, other than typhoid, was administered in the past 4 weeks&quot;:
  </a:s>
               <a:s r="427">
                  <a:s r="426">
                     <a:s>Encounter</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="427">
                     <a:s>&quot;No live vaccine was administered in the last 4 weeks&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="427" locator="166:3-166:66" name="No live vaccine was administered in the last 4 weeks" libraryName="Encounter" xsi:type="ExpressionRef"/>
      </def>
      <def localId="430" locator="174:1-175:63" name="Live vaccine, other than typhoid, was administered in the past 4 weeks" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Live vaccine, other than typhoid, was administered in the past 4 weeks"/>
            <a:t name="pseudocode" value="&quot;Date and time of vaccination&quot; (where &quot;Live vaccine&quot; = TRUE AND &quot;Vaccine type&quot; ≠ &quot;Typhoid vaccines&quot;) &lt; 4 weeks"/>
            <a:t name="code" value="Live vaccine, other than typhoid, was administered in the past 4 weeks-132"/>
            <a:t name="decision" value="IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule"/>
            <a:s r="430">
               <a:s>/*
@input: Live vaccine, other than typhoid, was administered in the past 4 weeks
@pseudocode: Today's date − latest &quot;Date and time of vaccination&quot; (where &quot;Live vaccine&quot; = TRUE AND &quot;Vaccine type&quot; ≠ &quot;Typhoid vaccines&quot;) &lt; 4 weeks
@code: Live vaccine, other than typhoid, was administered in the past 4 weeks-132
@decision: IMMZ.D2.DT.Typhoid.Ty21a: Live attenuated Ty21a vaccine schedule
*/
define &quot;Live vaccine, other than typhoid, was administered in the past 4 weeks&quot;:
  </a:s>
               <a:s r="432">
                  <a:s r="431">
                     <a:s>Encounter</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="432">
                     <a:s>&quot;Live vaccine was administered in the last 4 weeks&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="432" locator="175:3-175:63" name="Live vaccine was administered in the last 4 weeks" libraryName="Encounter" xsi:type="ExpressionRef"/>
      </def>
   </statements>
</library>
