<?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="312"><a:s>/*
 * Library: IMMZD18SHepatitisBBirthDoseLogic (IMMZ.D18.S.Hepatitis B.Birth dose schedule)
 * Schedule Table: Birth dose schedule
 */
library IMMZD18SHepatitisBBirthDoseLogic</a:s></a:s></annotation><identifier id="IMMZD18SHepatitisBBirthDoseLogic" 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:60" path="http://smart.who.int/immunizations/IMMZD2DTHepatitisBEncounterElements"><annotation xsi:type="a:Annotation"><a:s r="218"><a:s>include </a:s><a:s><a:s>IMMZD2DTHepatitisBEncounterElements</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="236" locator="77:1-78:53" name="Hepatitis B birth dose was administered"><annotation xsi:type="a:Annotation"><a:t name="complete" value="Hepatitis B birth dose was administered"/><a:t name="pseudocode" value="&#34;Vaccine type&#34; = &#34;Hepatitis B-containing vaccines&#34; and &#34;Birth Dose&#34; = TRUE) = 1"/><a:s r="236"><a:s>/*
@complete: Hepatitis B birth dose was administered
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Hepatitis B-containing vaccines" and "Birth Dose" = TRUE) = 1
*/
define "Hepatitis B birth dose was administered":
  </a:s><a:s r="238"><a:s r="237"><a:s>Encounter</a:s></a:s><a:s>.</a:s><a:s r="238"><a:s>"Hepatitis B birth dose was administered"</a:s></a:s></a:s></a:s></annotation><expression libraryName="Encounter" localId="238" locator="78:3-78:53" name="Hepatitis B birth dose was administered" xsi:type="ExpressionRef"/></def><def accessLevel="Public" context="Patient" localId="232" locator="31:1-32:47" name="Hepatitis B birth dose"><annotation xsi:type="a:Annotation"><a:t name="output" value="Hepatitis B birth dose"/><a:t name="description" value="Provision of hepatitis B birth dose"/><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: Hepatitis B birth dose
@description: Provision of hepatitis B birth dose
@trigger: Child's birth
@pseudo: 
@triggerDate: "Date of birth"
*/
define "Hepatitis B birth dose":
  </a:s><a:s r="233"><a:s>not </a:s><a:s r="239"><a:s>"Hepatitis B birth dose was administered"</a:s></a:s></a:s></a:s></annotation><expression localId="233" locator="32:3-32:47" xsi:type="Not"><operand localId="239" locator="32:7-32:47" name="Hepatitis B birth dose was administered" xsi:type="ExpressionRef"/></expression></def><def accessLevel="Public" context="Patient" localId="258" locator="51:1-53:11" name="Hepatitis B birth dose Due Date"><annotation xsi:type="a:Annotation"><a:t name="dynamicValue" value="Hepatitis B birth dose Due Date"/><a:t name="pseudocode" value="&#34;Date of birth&#34;"/><a:s r="258"><a:s>/*
@dynamicValue: Hepatitis B birth dose Due Date
@pseudocode: "Date of birth"
*/
define "Hepatitis B birth dose Due Date":
  </a:s><a:s r="259"><a:s>if </a:s><a:s r="260"><a:s>"Hepatitis B birth dose"</a:s></a:s><a:s> then </a:s><a:s r="262"><a:s r="261"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="262"><a:s>birthDate</a:s></a:s></a:s><a:s r="263">
  else null</a:s></a:s></a:s></annotation><expression localId="259" locator="52:3-53:11" xsi:type="If"><condition localId="260" locator="52:6-52:29" name="Hepatitis B birth dose" xsi:type="ExpressionRef"/><then localId="262" locator="52:36-52:52" path="birthDate" xsi:type="Property"><source localId="261" locator="52:36-52:42" name="Patient" xsi:type="ExpressionRef"/></then><else asType="fhir:date" localId="264" xsi:type="As"><operand localId="263" locator="53:8-53:11" xsi:type="Null"/></else></expression></def><def accessLevel="Public" context="Patient" localId="283" locator="60:1-62:11" name="Hepatitis B birth dose Overdue"><annotation xsi:type="a:Annotation"><a:t name="dynamicValue" value="Hepatitis B birth dose Overdue"/><a:t name="pseudocode" value="&#34;Date of birth&#34; + 24 hours"/><a:s r="283"><a:s>/*
@dynamicValue: Hepatitis B birth dose Overdue
@pseudocode: "Date of birth" + 24 hours
*/
define "Hepatitis B birth dose Overdue":
  </a:s><a:s r="284"><a:s>if </a:s><a:s r="285"><a:s>"Hepatitis B birth dose"</a:s></a:s><a:s> then </a:s><a:s r="286"><a:s r="288"><a:s r="287"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="288"><a:s>birthDate</a:s></a:s></a:s><a:s> + </a:s><a:s r="289"><a:s>24 hours</a:s></a:s></a:s><a:s r="293">
  else null</a:s></a:s></a:s></annotation><expression localId="284" locator="61:3-62:11" xsi:type="If"><condition localId="285" locator="61:6-61:29" name="Hepatitis B birth dose" xsi:type="ExpressionRef"/><then localId="286" locator="61:36-61:63" xsi:type="Add"><signature localId="291" name="t:Date" xsi:type="NamedTypeSpecifier"/><signature localId="292" name="t:Quantity" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="290" name="ToDate" xsi:type="FunctionRef"><operand localId="288" locator="61:36-61:52" path="birthDate" xsi:type="Property"><source localId="287" locator="61:36-61:42" name="Patient" xsi:type="ExpressionRef"/></operand></operand><operand localId="289" locator="61:56-61:63" unit="hours" value="24" xsi:type="Quantity"/></then><else asType="t:Date" localId="294" xsi:type="As"><operand localId="293" locator="62:8-62:11" xsi:type="Null"/></else></expression></def><def accessLevel="Public" context="Patient" localId="242" locator="39:1-44:9" name="Hepatitis B birth dose Create"><annotation xsi:type="a:Annotation"><a:t name="output" value="Hepatitis B birth dose Create"/><a:t name="create" value="All infants should receive a first dose of the hepatitis B-containing vaccine as soon as possible after birth, ideally within 24 hours"/><a:s r="242"><a:s>/*
@output: Hepatitis B birth dose Create
@create: All infants should receive a first dose of the hepatitis B-containing vaccine as soon as possible after birth, ideally within 24 hours
*/
define "Hepatitis B birth dose Create":
  </a:s><a:s r="243"><a:s>if </a:s><a:s r="244"><a:s>"Hepatitis B birth dose"</a:s></a:s><a:s>
  then </a:s><a:s r="303"><a:s r="280"><a:s r="275"><a:s r="255"><a:s r="249"><a:s>'All infants should receive a first dose of the hepatitis B-containing vaccine as soon as possible after birth, ideally within 24 hours'</a:s></a:s><a:s> + </a:s><a:s r="251"><a:s>'
Due Date: '</a:s></a:s></a:s><a:s> + </a:s><a:s r="270"><a:s>ToString(</a:s><a:s r="265"><a:s>"Hepatitis B birth dose Due Date"</a:s></a:s><a:s>)</a:s></a:s></a:s><a:s> + </a:s><a:s r="276"><a:s>'
Overdue: '</a:s></a:s></a:s><a:s> + </a:s><a:s r="299"><a:s>ToString(</a:s><a:s r="295"><a:s>"Hepatitis B birth dose Overdue"</a:s></a:s><a:s>)</a:s></a:s></a:s><a:s>
  else </a:s><a:s r="304"><a:s>''</a:s></a:s></a:s></a:s></annotation><expression localId="243" locator="40:3-44:9" xsi:type="If"><condition localId="244" locator="40:6-40:29" name="Hepatitis B birth dose" xsi:type="ExpressionRef"/><then localId="303" locator="41:8-43:55" xsi:type="Concatenate"><operand localId="280" locator="41:8-42:72" xsi:type="Concatenate"><operand localId="275" locator="41:8-42:57" xsi:type="Concatenate"><operand localId="255" locator="41:8-41:159" xsi:type="Concatenate"><operand localId="249" locator="41:8-41:143" value="All infants should receive a first dose of the hepatitis B-containing vaccine as soon as possible after birth, ideally within 24 hours" valueType="t:String" xsi:type="Literal"/><operand localId="251" locator="41:147-41:159" value="&#xA;Due Date: " valueType="t:String" xsi:type="Literal"/></operand><operand localId="270" locator="42:15-42:57" xsi:type="ToString"><signature localId="272" name="t:Date" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="271" name="ToDate" xsi:type="FunctionRef"><operand localId="265" locator="42:24-42:56" name="Hepatitis B birth dose Due Date" xsi:type="ExpressionRef"/></operand></operand></operand><operand localId="276" locator="42:61-42:72" value="&#xA;Overdue: " valueType="t:String" xsi:type="Literal"/></operand><operand localId="299" locator="43:14-43:55" xsi:type="ToString"><signature localId="300" name="t:Date" xsi:type="NamedTypeSpecifier"/><operand localId="295" locator="43:23-43:54" name="Hepatitis B birth dose Overdue" xsi:type="ExpressionRef"/></operand></then><else localId="304" locator="44:8-44:9" value="" valueType="t:String" xsi:type="Literal"/></expression></def><def accessLevel="Public" context="Patient" localId="308" locator="69:1-70:6" name="Hepatitis B birth dose Expiration"><annotation xsi:type="a:Annotation"><a:t name="dynamicValue" value="Hepatitis B birth dose Expiration"/><a:t name="pseudocode" value="To be determined by Member States"/><a:s r="308"><a:s r="309">/*
@dynamicValue: Hepatitis B birth dose Expiration
@pseudocode: To be determined by Member States
*/
define "Hepatitis B birth dose Expiration":
  null</a:s></a:s></annotation><expression localId="309" locator="70:3-70:6" xsi:type="Null"/></def><def accessLevel="Public" context="Patient" localId="312" locator="85:1-91:5" name="Test Validation"><annotation xsi:type="a:Annotation"><a:t name="test" value="Test expected results based on example patients"/><a:s r="312"><a:s>/*
@test: Test expected results based on example patients
*/
define "Test Validation":
  </a:s><a:s r="313"><a:s>case
    </a:s><a:s r="314"><a:s>when </a:s><a:s r="315"><a:s r="317"><a:s r="316"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="317"><a:s>id</a:s></a:s></a:s><a:s> = </a:s><a:s r="318"><a:s>'HepatitisB08.2'</a:s></a:s></a:s><a:s> then </a:s><a:s r="324"><a:s>"Hepatitis B birth dose"</a:s></a:s></a:s><a:s>
    </a:s><a:s r="325"><a:s>when </a:s><a:s r="326"><a:s r="328"><a:s r="327"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="328"><a:s>id</a:s></a:s></a:s><a:s> = </a:s><a:s r="329"><a:s>'HepatitisB09.2'</a:s></a:s></a:s><a:s> then </a:s><a:s r="335"><a:s>"Hepatitis B birth dose"</a:s></a:s></a:s><a:s>
    </a:s><a:s r="336"><a:s>when </a:s><a:s r="337"><a:s r="339"><a:s r="338"><a:s>Patient</a:s></a:s><a:s>.</a:s><a:s r="339"><a:s>id</a:s></a:s></a:s><a:s> = </a:s><a:s r="340"><a:s>'HepatitisB10.1'</a:s></a:s></a:s><a:s> then </a:s><a:s r="346"><a:s r="347"><a:s>not </a:s><a:s r="348"><a:s>"Hepatitis B birth dose"</a:s></a:s></a:s><a:s> and </a:s><a:s r="349"><a:s>"Hepatitis B birth dose was administered"</a:s></a:s></a:s></a:s><a:s>
    else </a:s><a:s r="350"><a:s>'No test case set'</a:s></a:s><a:s>
  end</a:s></a:s></a:s></annotation><expression localId="313" locator="86:3-91:5" xsi:type="Case"><caseItem localId="314" locator="87:5-87:68"><when localId="315" locator="87:10-87:38" xsi:type="Equal"><signature localId="322" name="t:String" xsi:type="NamedTypeSpecifier"/><signature localId="323" name="t:String" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="320" name="ToString" xsi:type="FunctionRef"><signature localId="321" name="fhir:string" xsi:type="NamedTypeSpecifier"/><operand localId="317" locator="87:10-87:19" path="id" xsi:type="Property"><source localId="316" locator="87:10-87:16" name="Patient" xsi:type="ExpressionRef"/></operand></operand><operand localId="318" locator="87:23-87:38" value="HepatitisB08.2" valueType="t:String" xsi:type="Literal"/></when><then localId="352" xsi:type="As"><operand localId="324" locator="87:45-87:68" name="Hepatitis B birth dose" xsi:type="ExpressionRef"/><asTypeSpecifier localId="353" xsi:type="ChoiceTypeSpecifier"><choice localId="354" name="t:Boolean" xsi:type="NamedTypeSpecifier"/><choice localId="355" name="t:String" xsi:type="NamedTypeSpecifier"/></asTypeSpecifier></then></caseItem><caseItem localId="325" locator="88:5-88:68"><when localId="326" locator="88:10-88:38" xsi:type="Equal"><signature localId="333" name="t:String" xsi:type="NamedTypeSpecifier"/><signature localId="334" name="t:String" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="331" name="ToString" xsi:type="FunctionRef"><signature localId="332" name="fhir:string" xsi:type="NamedTypeSpecifier"/><operand localId="328" locator="88:10-88:19" path="id" xsi:type="Property"><source localId="327" locator="88:10-88:16" name="Patient" xsi:type="ExpressionRef"/></operand></operand><operand localId="329" locator="88:23-88:38" value="HepatitisB09.2" valueType="t:String" xsi:type="Literal"/></when><then localId="356" xsi:type="As"><operand localId="335" locator="88:45-88:68" name="Hepatitis B birth dose" xsi:type="ExpressionRef"/><asTypeSpecifier localId="357" xsi:type="ChoiceTypeSpecifier"><choice localId="358" name="t:Boolean" xsi:type="NamedTypeSpecifier"/><choice localId="359" name="t:String" xsi:type="NamedTypeSpecifier"/></asTypeSpecifier></then></caseItem><caseItem localId="336" locator="89:5-89:118"><when localId="337" locator="89:10-89:38" xsi:type="Equal"><signature localId="344" name="t:String" xsi:type="NamedTypeSpecifier"/><signature localId="345" name="t:String" xsi:type="NamedTypeSpecifier"/><operand libraryName="FHIRHelpers" localId="342" name="ToString" xsi:type="FunctionRef"><signature localId="343" name="fhir:string" xsi:type="NamedTypeSpecifier"/><operand localId="339" locator="89:10-89:19" path="id" xsi:type="Property"><source localId="338" locator="89:10-89:16" name="Patient" xsi:type="ExpressionRef"/></operand></operand><operand localId="340" locator="89:23-89:38" value="HepatitisB10.1" valueType="t:String" xsi:type="Literal"/></when><then localId="360" xsi:type="As"><operand localId="346" locator="89:45-89:118" xsi:type="And"><operand localId="347" locator="89:45-89:72" xsi:type="Not"><operand localId="348" locator="89:49-89:72" name="Hepatitis B birth dose" xsi:type="ExpressionRef"/></operand><operand localId="349" locator="89:78-89:118" name="Hepatitis B birth dose was administered" xsi:type="ExpressionRef"/></operand><asTypeSpecifier localId="361" xsi:type="ChoiceTypeSpecifier"><choice localId="362" name="t:Boolean" xsi:type="NamedTypeSpecifier"/><choice localId="363" name="t:String" xsi:type="NamedTypeSpecifier"/></asTypeSpecifier></then></caseItem><else localId="364" xsi:type="As"><operand localId="350" locator="90:10-90:27" value="No test case set" valueType="t:String" xsi:type="Literal"/><asTypeSpecifier localId="365" xsi:type="ChoiceTypeSpecifier"><choice localId="366" name="t:Boolean" xsi:type="NamedTypeSpecifier"/><choice localId="367" name="t:String" xsi:type="NamedTypeSpecifier"/></asTypeSpecifier></else></expression></def></statements></library>