<?xml version="1.0" encoding="UTF-8"?><library xmlns="urn:hl7-org:elm:r1" xmlns:a="urn:hl7-org:cql-annotations:r1" xmlns:fhir="http://hl7.org/fhir" xmlns:t="urn:hl7-org:elm-types:r1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" localId="0"><annotation signatureLevel="Overloads" translatorOptions="EnableAnnotations,EnableLocators,DisableListDemotion,DisableListPromotion" translatorVersion="4.9.0" xsi:type="a:CqlToElmInfo"/><annotation errorSeverity="warning" errorType="semantic" message="An operand identifier reference is hiding another identifier of the same name." xsi:type="a:CqlToElmError"/><annotation errorSeverity="warning" errorType="semantic" message="An operand identifier reference is hiding another identifier of the same name." xsi:type="a:CqlToElmError"/><annotation errorSeverity="warning" errorType="semantic" message="An operand identifier reference is hiding another identifier of the same name." xsi:type="a:CqlToElmError"/><annotation xsi:type="a:Annotation"><a:s r="320"><a:s>/*
 * Library: IMMZD18STyphoidTCVLogic (IMMZ.D18.S.Typhoid.TCV schedule)
 * Schedule Table: Typhoid conjugate vaccine (TCV), 1 dose schedule
 */
library IMMZD18STyphoidTCVLogic</a:s></a:s></annotation><identifier id="IMMZD18STyphoidTCVLogic" 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" localIdentifier="FHIR" locator="7:1-7:26" 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" localIdentifier="FHIRHelpers" locator="8:1-8:35" 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" localIdentifier="WC" locator="10:1-10:27" path="http://smart.who.int/immunizations/WHOCommon"><annotation xsi:type="a:Annotation"><a:s r="210"><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="212" localIdentifier="Common" locator="12:1-12:32" path="http://smart.who.int/immunizations/IMMZCommon"><annotation xsi:type="a:Annotation"><a:s r="212"><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="214" localIdentifier="Concepts" locator="13:1-13:36" path="http://smart.who.int/immunizations/IMMZConcepts"><annotation xsi:type="a:Annotation"><a:s r="214"><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="216" localIdentifier="IE" locator="15:1-15:39" path="http://smart.who.int/immunizations/IMMZEncounterElements"><annotation xsi:type="a:Annotation"><a:s r="216"><a:s>include </a:s><a:s><a:s>IMMZEncounterElements</a:s></a:s><a:s> called IE</a:s></a:s></annotation></def><def localId="218" localIdentifier="Encounter" locator="16:1-16:57" path="http://smart.who.int/immunizations/IMMZD2DTTyphoidEncounterElements"><annotation xsi:type="a:Annotation"><a:s r="218"><a:s>include </a:s><a:s><a:s>IMMZD2DTTyphoidEncounterElements</a:s></a:s><a:s> called Encounter</a:s></a:s></annotation></def></includes><parameters><def accessLevel="Public" localId="220" locator="18:1-18:36" name="Today"><annotation xsi:type="a:Annotation"><a:s r="220"><a:s>parameter Today </a:s><a:s r="224"><a:s>Date</a:s></a:s><a:s> default </a:s><a:s r="223"><a:s>Today()</a:s></a:s></a:s></annotation><default localId="223" locator="18:30-18:36" xsi:type="Today"/><parameterTypeSpecifier localId="224" locator="18:17-18:20" name="t:Date" xsi:type="NamedTypeSpecifier"/></def></parameters><contexts><def localId="229" locator="21:1-21:15" name="Patient"/></contexts><statements><def context="Patient" localId="227" locator="21:1-21:15" name="Patient"><expression localId="228" xsi:type="SingletonFrom"><operand dataType="fhir:Patient" localId="226" locator="21:1-21:15" templateId="http://hl7.org/fhir/StructureDefinition/Patient" xsi:type="Retrieve"/></expression></def><def accessLevel="Public" context="Patient" localId="240" locator="78:1-79:62" name="One typhoid dose from primary series was administered. The primary series has been completed"><annotation xsi:type="a:Annotation"><a:t name="complete" value="One typhoid dose from primary series was administered. The primary series has been completed"/><a:t name="pseudocode" value="&#34;Completed the primary vaccination series&#34; = TRUE (where &#34;Vaccine type&#34; = &#34;Typhoid vaccines&#34;)"/><a:s r="240"><a:s>/*
@complete: One typhoid dose from primary series was administered. The primary series has been completed
@pseudocode: "Completed the primary vaccination series" = TRUE (where "Vaccine type" = "Typhoid vaccines")
*/
define "One typhoid dose from primary series was administered. The primary series has been completed":
  </a:s><a:s r="242"><a:s r="241"><a:s>Encounter</a:s></a:s><a:s>.</a:s><a:s r="242"><a:s>"One typhoid primary series dose was administered"</a:s></a:s></a:s></a:s></annotation><expression libraryName="Encounter" localId="242" locator="79:3-79:62" name="One typhoid primary series dose was administered" xsi:type="ExpressionRef"/></def><def accessLevel="Public" context="Patient" localId="246" locator="70:1-71:30" name="TCV dose 1 Expiration"><annotation xsi:type="a:Annotation"><a:t name="dynamicValue" value="TCV dose 1 Expiration"/><a:t name="pseudocode" value="&#34;Date of birth&#34; + 45 years"/><a:s r="246"><a:s>/*
@dynamicValue: TCV dose 1 Expiration
@pseudocode: "Date of birth" + 45 years
*/
define "TCV dose 1 Expiration":
  </a:s><a:s r="247"><a:s r="249"><a:s r="248"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="249"><a:s>birthDate</a:s></a:s></a:s><a:s> + </a:s><a:s r="250"><a:s>45 years</a:s></a:s></a:s></a:s></annotation><expression localId="247" locator="71:3-71:30" xsi:type="Add"><signature localId="252" name="t:Date" xsi:type="NamedTypeSpecifier"/><signature localId="253" name="t:Quantity" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="251" name="ToDate" xsi:type="FunctionRef"><operand localId="249" locator="71:3-71:19" path="birthDate" xsi:type="Property"><source localId="248" locator="71:3-71:9" name="Patient" xsi:type="ExpressionRef"/></operand></operand><operand localId="250" locator="71:23-71:30" unit="years" value="45" xsi:type="Quantity"/></expression></def><def accessLevel="Public" context="Patient" localId="232" locator="31:1-34:48" name="TCV dose 1"><annotation xsi:type="a:Annotation"><a:t name="output" value="TCV dose 1"/><a:t name="description" value="Provision of the TCV dose 1"/><a:t name="trigger" value="Child's birth"/><a:t name="pseudo"/><a:t name="triggerDate" value="&#34;Date of birth&#34;"/><a:s r="232"><a:s>/*
@output: TCV dose 1
@description: Provision of the TCV dose 1
@trigger: Child's birth
@pseudo: 
@triggerDate: "Date of birth"
*/
define "TCV dose 1":
  </a:s><a:s r="233"><a:s r="234"><a:s r="236"><a:s r="235"><a:s>Encounter</a:s></a:s><a:s>.</a:s><a:s r="236"><a:s>"No typhoid primary series doses were administered"</a:s></a:s></a:s><a:s>
  and </a:s><a:s r="237"><a:s>not </a:s><a:s r="243"><a:s>"One typhoid dose from primary series was administered. The primary series has been completed"</a:s></a:s></a:s></a:s><a:s>
  and </a:s><a:s r="256"><a:s r="254"><a:s>"TCV dose 1 Expiration"</a:s></a:s><a:s r="256"> after day of </a:s><a:s r="255"><a:s>Today</a:s></a:s></a:s></a:s></a:s></annotation><expression localId="233" locator="32:3-34:48" xsi:type="And"><operand localId="234" locator="32:3-33:104" xsi:type="And"><operand libraryName="Encounter" localId="236" locator="32:3-32:63" name="No typhoid primary series doses were administered" xsi:type="ExpressionRef"/><operand localId="237" locator="33:7-33:104" xsi:type="Not"><operand localId="243" locator="33:11-33:104" name="One typhoid dose from primary series was administered. The primary series has been completed" xsi:type="ExpressionRef"/></operand></operand><operand localId="256" locator="34:7-34:48" precision="Day" xsi:type="After"><signature localId="257" name="t:Date" xsi:type="NamedTypeSpecifier"/><signature localId="258" name="t:Date" xsi:type="NamedTypeSpecifier"/><operand localId="254" locator="34:7-34:29" name="TCV dose 1 Expiration" xsi:type="ExpressionRef"/><operand localId="255" locator="34:44-34:48" name="Today" xsi:type="ParameterRef"/></operand></expression></def><def accessLevel="Public" context="Patient" localId="277" locator="53:1-55:11" name="TCV dose 1 Due Date"><annotation xsi:type="a:Annotation"><a:t name="dynamicValue" value="TCV dose 1 Due Date"/><a:t name="pseudocode" value="&#34;Date of birth&#34; + 6 months"/><a:s r="277"><a:s>/*
@dynamicValue: TCV dose 1 Due Date
@pseudocode: "Date of birth" + 6 months
*/
define "TCV dose 1 Due Date":
  </a:s><a:s r="278"><a:s>if </a:s><a:s r="279"><a:s>"TCV dose 1"</a:s></a:s><a:s> then </a:s><a:s r="280"><a:s r="282"><a:s r="281"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="282"><a:s>birthDate</a:s></a:s></a:s><a:s> + </a:s><a:s r="283"><a:s>6 months</a:s></a:s></a:s><a:s r="287">
  else null</a:s></a:s></a:s></annotation><expression localId="278" locator="54:3-55:11" xsi:type="If"><condition localId="279" locator="54:6-54:17" name="TCV dose 1" xsi:type="ExpressionRef"/><then localId="280" locator="54:24-54:51" xsi:type="Add"><signature localId="285" name="t:Date" xsi:type="NamedTypeSpecifier"/><signature localId="286" name="t:Quantity" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="284" name="ToDate" xsi:type="FunctionRef"><operand localId="282" locator="54:24-54:40" path="birthDate" xsi:type="Property"><source localId="281" locator="54:24-54:30" name="Patient" xsi:type="ExpressionRef"/></operand></operand><operand localId="283" locator="54:44-54:51" unit="months" value="6" xsi:type="Quantity"/></then><else asType="t:Date" localId="288" xsi:type="As"><operand localId="287" locator="55:8-55:11" xsi:type="Null"/></else></expression></def><def accessLevel="Public" context="Patient" localId="261" locator="41:1-46:9" name="TCV dose 1 Create"><annotation xsi:type="a:Annotation"><a:t name="output" value="TCV dose 1 Create"/><a:t name="create" value="TCV dose 1 should be provided if the client's age is over 6 months, and the region recommends typhoid vaccination."/><a:s r="261"><a:s>/*
@output: TCV dose 1 Create
@create: TCV dose 1 should be provided if the client's age is over 6 months, and the region recommends typhoid vaccination.
*/
define "TCV dose 1 Create":
  </a:s><a:s r="262"><a:s>if </a:s><a:s r="263"><a:s>"TCV dose 1"</a:s></a:s><a:s>
  then </a:s><a:s r="311"><a:s r="302"><a:s r="297"><a:s r="274"><a:s r="268"><a:s>'TCV dose 1 should be provided if the client\'s age is over 6 months, and the region recommends typhoid vaccination.'</a:s></a:s><a:s> + </a:s><a:s r="270"><a:s>'
Due Date: '</a:s></a:s></a:s><a:s> + </a:s><a:s r="293"><a:s>ToString(</a:s><a:s r="289"><a:s>"TCV dose 1 Due Date"</a:s></a:s><a:s>)</a:s></a:s></a:s><a:s> + </a:s><a:s r="298"><a:s>'
Expiration: '</a:s></a:s></a:s><a:s> + </a:s><a:s r="307"><a:s>ToString(</a:s><a:s r="303"><a:s>"TCV dose 1 Expiration"</a:s></a:s><a:s>)</a:s></a:s></a:s><a:s>
  else </a:s><a:s r="312"><a:s>''</a:s></a:s></a:s></a:s></annotation><expression localId="262" locator="42:3-46:9" xsi:type="If"><condition localId="263" locator="42:6-42:17" name="TCV dose 1" xsi:type="ExpressionRef"/><then localId="311" locator="43:8-45:49" xsi:type="Concatenate"><operand localId="302" locator="43:8-44:63" xsi:type="Concatenate"><operand localId="297" locator="43:8-44:45" xsi:type="Concatenate"><operand localId="274" locator="43:8-43:140" xsi:type="Concatenate"><operand localId="268" locator="43:8-43:124" value="TCV dose 1 should be provided if the client's age is over 6 months, and the region recommends typhoid vaccination." valueType="t:String" xsi:type="Literal"/><operand localId="270" locator="43:128-43:140" value="&#xA;Due Date: " valueType="t:String" xsi:type="Literal"/></operand><operand localId="293" locator="44:15-44:45" xsi:type="ToString"><signature localId="294" name="t:Date" xsi:type="NamedTypeSpecifier"/><operand localId="289" locator="44:24-44:44" name="TCV dose 1 Due Date" xsi:type="ExpressionRef"/></operand></operand><operand localId="298" locator="44:49-44:63" value="&#xA;Expiration: " valueType="t:String" xsi:type="Literal"/></operand><operand localId="307" locator="45:17-45:49" xsi:type="ToString"><signature localId="308" name="t:Date" xsi:type="NamedTypeSpecifier"/><operand localId="303" locator="45:26-45:48" name="TCV dose 1 Expiration" xsi:type="ExpressionRef"/></operand></then><else localId="312" locator="46:8-46:9" value="" valueType="t:String" xsi:type="Literal"/></expression></def><def accessLevel="Public" context="Patient" localId="316" locator="62:1-63:6" name="TCV dose 1 Overdue"><annotation xsi:type="a:Annotation"><a:t name="dynamicValue" value="TCV dose 1 Overdue"/><a:t name="pseudocode" value="To be determined by Member States; however, there is no recommended overdue date and individuals are always eligible to be vaccinated."/><a:s r="316"><a:s r="317">/*
@dynamicValue: TCV dose 1 Overdue
@pseudocode: To be determined by Member States; however, there is no recommended overdue date and individuals are always eligible to be vaccinated.
*/
define "TCV dose 1 Overdue":
  null</a:s></a:s></annotation><expression localId="317" locator="63:3-63:6" xsi:type="Null"/></def><def accessLevel="Public" context="Patient" localId="320" locator="86:1-93:5" name="Test Validation"><annotation xsi:type="a:Annotation"><a:t name="test" value="Test expected results based on example patients"/><a:s r="320"><a:s>/*
@test: Test expected results based on example patients
*/
define "Test Validation":
  </a:s><a:s r="321"><a:s>case
    </a:s><a:s r="322"><a:s>when </a:s><a:s r="323"><a:s r="325"><a:s r="324"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="325"><a:s>id</a:s></a:s></a:s><a:s> = </a:s><a:s r="326"><a:s>'Typhoid08.1'</a:s></a:s></a:s><a:s> then </a:s><a:s r="332"><a:s>"TCV dose 1"</a:s></a:s></a:s><a:s>
    </a:s><a:s r="333"><a:s>when </a:s><a:s r="334"><a:s r="336"><a:s r="335"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="336"><a:s>id</a:s></a:s></a:s><a:s> = </a:s><a:s r="337"><a:s>'Typhoid09.2'</a:s></a:s></a:s><a:s> then </a:s><a:s r="343"><a:s>"TCV dose 1"</a:s></a:s></a:s><a:s>
    </a:s><a:s r="344"><a:s>when </a:s><a:s r="345"><a:s r="347"><a:s r="346"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="347"><a:s>id</a:s></a:s></a:s><a:s> = </a:s><a:s r="348"><a:s>'Typhoid10.2'</a:s></a:s></a:s><a:s> then </a:s><a:s r="354"><a:s>not </a:s><a:s r="355"><a:s>"TCV dose 1"</a:s></a:s></a:s></a:s><a:s>
    </a:s><a:s r="356"><a:s>when </a:s><a:s r="357"><a:s r="359"><a:s r="358"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="359"><a:s>id</a:s></a:s></a:s><a:s> = </a:s><a:s r="360"><a:s>'Typhoid11.1'</a:s></a:s></a:s><a:s> then </a:s><a:s r="366"><a:s>"One typhoid dose from primary series was administered. The primary series has been completed"</a:s></a:s></a:s><a:s>
    else </a:s><a:s r="367"><a:s>'No test case set'</a:s></a:s><a:s>
  end</a:s></a:s></a:s></annotation><expression localId="321" locator="87:3-93:5" xsi:type="Case"><caseItem localId="322" locator="88:5-88:53"><when localId="323" locator="88:10-88:35" xsi:type="Equal"><signature localId="330" name="t:String" xsi:type="NamedTypeSpecifier"/><signature localId="331" name="t:String" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="328" name="ToString" xsi:type="FunctionRef"><signature localId="329" name="fhir:string" xsi:type="NamedTypeSpecifier"/><operand localId="325" locator="88:10-88:19" path="id" xsi:type="Property"><source localId="324" locator="88:10-88:16" name="Patient" xsi:type="ExpressionRef"/></operand></operand><operand localId="326" locator="88:23-88:35" value="Typhoid08.1" valueType="t:String" xsi:type="Literal"/></when><then localId="369" xsi:type="As"><operand localId="332" locator="88:42-88:53" name="TCV dose 1" xsi:type="ExpressionRef"/><asTypeSpecifier localId="370" xsi:type="ChoiceTypeSpecifier"><choice localId="371" name="t:Boolean" xsi:type="NamedTypeSpecifier"/><choice localId="372" name="t:String" xsi:type="NamedTypeSpecifier"/></asTypeSpecifier></then></caseItem><caseItem localId="333" locator="89:5-89:53"><when localId="334" locator="89:10-89:35" xsi:type="Equal"><signature localId="341" name="t:String" xsi:type="NamedTypeSpecifier"/><signature localId="342" name="t:String" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="339" name="ToString" xsi:type="FunctionRef"><signature localId="340" name="fhir:string" xsi:type="NamedTypeSpecifier"/><operand localId="336" locator="89:10-89:19" path="id" xsi:type="Property"><source localId="335" locator="89:10-89:16" name="Patient" xsi:type="ExpressionRef"/></operand></operand><operand localId="337" locator="89:23-89:35" value="Typhoid09.2" valueType="t:String" xsi:type="Literal"/></when><then localId="373" xsi:type="As"><operand localId="343" locator="89:42-89:53" name="TCV dose 1" xsi:type="ExpressionRef"/><asTypeSpecifier localId="374" xsi:type="ChoiceTypeSpecifier"><choice localId="375" name="t:Boolean" xsi:type="NamedTypeSpecifier"/><choice localId="376" name="t:String" xsi:type="NamedTypeSpecifier"/></asTypeSpecifier></then></caseItem><caseItem localId="344" locator="90:5-90:57"><when localId="345" locator="90:10-90:35" xsi:type="Equal"><signature localId="352" name="t:String" xsi:type="NamedTypeSpecifier"/><signature localId="353" name="t:String" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="350" name="ToString" xsi:type="FunctionRef"><signature localId="351" name="fhir:string" xsi:type="NamedTypeSpecifier"/><operand localId="347" locator="90:10-90:19" path="id" xsi:type="Property"><source localId="346" locator="90:10-90:16" name="Patient" xsi:type="ExpressionRef"/></operand></operand><operand localId="348" locator="90:23-90:35" value="Typhoid10.2" valueType="t:String" xsi:type="Literal"/></when><then localId="377" xsi:type="As"><operand localId="354" locator="90:42-90:57" xsi:type="Not"><operand localId="355" locator="90:46-90:57" name="TCV dose 1" xsi:type="ExpressionRef"/></operand><asTypeSpecifier localId="378" xsi:type="ChoiceTypeSpecifier"><choice localId="379" name="t:Boolean" xsi:type="NamedTypeSpecifier"/><choice localId="380" name="t:String" xsi:type="NamedTypeSpecifier"/></asTypeSpecifier></then></caseItem><caseItem localId="356" locator="91:5-91:135"><when localId="357" locator="91:10-91:35" xsi:type="Equal"><signature localId="364" name="t:String" xsi:type="NamedTypeSpecifier"/><signature localId="365" name="t:String" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="362" name="ToString" xsi:type="FunctionRef"><signature localId="363" name="fhir:string" xsi:type="NamedTypeSpecifier"/><operand localId="359" locator="91:10-91:19" path="id" xsi:type="Property"><source localId="358" locator="91:10-91:16" name="Patient" xsi:type="ExpressionRef"/></operand></operand><operand localId="360" locator="91:23-91:35" value="Typhoid11.1" valueType="t:String" xsi:type="Literal"/></when><then localId="381" xsi:type="As"><operand localId="366" locator="91:42-91:135" name="One typhoid dose from primary series was administered. The primary series has been completed" xsi:type="ExpressionRef"/><asTypeSpecifier localId="382" xsi:type="ChoiceTypeSpecifier"><choice localId="383" name="t:Boolean" xsi:type="NamedTypeSpecifier"/><choice localId="384" name="t:String" xsi:type="NamedTypeSpecifier"/></asTypeSpecifier></then></caseItem><else localId="385" xsi:type="As"><operand localId="367" locator="92:10-92:27" value="No test case set" valueType="t:String" xsi:type="Literal"/><asTypeSpecifier localId="386" xsi:type="ChoiceTypeSpecifier"><choice localId="387" name="t:Boolean" xsi:type="NamedTypeSpecifier"/><choice localId="388" name="t:String" xsi:type="NamedTypeSpecifier"/></asTypeSpecifier></else></expression></def></statements></library>