<?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="337">
         <a:s>/*
  * Library: IMMZD2DTHPVEncounterElements
  */
library IMMZD2DTHPVEncounterElements</a:s>
      </a:s>
   </annotation>
   <identifier id="IMMZD2DTHPVEncounterElements" 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:46" localIdentifier="HPVElements" path="http://smart.who.int/immunizations/IMMZD2DTHPVElements">
         <annotation xsi:type="a:Annotation">
            <a:s r="222">
               <a:s>include </a:s>
               <a:s>
                  <a:s>IMMZD2DTHPVElements</a:s>
               </a:s>
               <a:s> called HPVElements</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:44" name="HPV Doses Administered to Patient" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="internal" value="HPV containing Doses Administered to Patient"/>
            <a:s r="239">
               <a:s>/*
@internal: HPV containing Doses Administered to Patient
*/
define &quot;HPV 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;HPV vaccines&quot;</a:s>
                           </a:s>
                        </a:s>
                     </a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="251" locator="29:3-31:44" 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:44" 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:44" name="HPV vaccines" libraryName="Concepts" preserve="true"/>
            </where>
         </expression>
      </def>
      <def localId="254" locator="36:1-37:53" name="HPV Primary Series Doses Administered to Patient" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="internal" value="HPV containing Doses Administered to Patient that are in the Primary series"/>
            <a:s r="254">
               <a:s>/*
@internal: HPV containing Doses Administered to Patient that are in the Primary series
*/
define &quot;HPV Primary Series Doses Administered to Patient&quot;:
  </a:s>
               <a:s r="256">
                  <a:s r="255">
                     <a:s>&quot;HPV 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:53" name="seriesPrimary" libraryName="Common" xsi:type="FunctionRef">
            <operand localId="255" locator="37:3-37:37" name="HPV Doses Administered to Patient" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def localId="259" locator="42:1-43:59" name="Number of HPV Primary Series Doses Administered" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="internal" value="Number of HPV Primary Series doses"/>
            <a:s r="259">
               <a:s>/*
@internal: Number of HPV Primary Series doses
*/
define &quot;Number of HPV Primary Series Doses Administered&quot;:
  </a:s>
               <a:s r="263">
                  <a:s>Count(</a:s>
                  <a:s r="260">
                     <a:s>&quot;HPV 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:59" xsi:type="Count">
            <source localId="260" locator="43:9-43:58" name="HPV Primary Series Doses Administered to Patient" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def localId="266" locator="52:1-53:46" name="Client's age is less than 9 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is less than 9 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; &lt; 9 years"/>
            <a:t name="code" value="Client's age is less than 9 years-40"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="266">
               <a:s>/*
@input: Client's age is less than 9 years
@pseudocode: Today's date − &quot;Date of birth&quot; &lt; 9 years
@code: Client's age is less than 9 years-40
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;Client's age is less than 9 years&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 Years&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="270"> &lt; 9</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="267" locator="53:3-53:46" 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="53:3-53:42" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
            <operand localId="270" locator="53:46" valueType="t:Integer" value="9" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="275" locator="62:1-63:55" name="No HPV primary series doses were administered" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="No HPV primary series doses were administered"/>
            <a:t name="pseudocode" value="&quot;Vaccine type&quot; = &quot;HPV vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 0"/>
            <a:t name="code" value="No HPV primary series doses were administered-112"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="275">
               <a:s>/*
@input: No HPV primary series doses were administered
@pseudocode: Count of vaccines administered (where &quot;Vaccine type&quot; = &quot;HPV vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 0
@code: No HPV primary series doses were administered-112
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;No HPV primary series doses were administered&quot;:
  </a:s>
               <a:s r="276">
                  <a:s r="277">
                     <a:s>&quot;Number of HPV 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="63:3-63:55" 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="63:3-63:51" name="Number of HPV Primary Series Doses Administered" xsi:type="ExpressionRef"/>
            <operand localId="278" locator="63:55" valueType="t:Integer" value="0" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="283" locator="71:1-73:52" name="Client's age is between 9 and 14 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is between 9 and 14 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; ≤ 14 years"/>
            <a:t name="code" value="Client's age is between 9 and 14 years-51"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:s r="283">
               <a:s>/*
@input: Client's age is between 9 and 14 years
@pseudocode: 9 years ≤ Today's date − &quot;Date of birth&quot; ≤ 14 years
@code: Client's age is between 9 and 14 years-51
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
*/
define &quot;Client's age is between 9 and 14 years&quot;:
  </a:s>
               <a:s r="284">
                  <a:s r="285">
                     <a:s r="286">9 &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 Years&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;= 14</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="284" locator="72:3-73:52" xsi:type="And">
            <operand localId="285" locator="72:3-72:47" 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="72:3" valueType="t:Integer" value="9" xsi:type="Literal"/>
               <operand localId="288" locator="72:8-72:47" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
            </operand>
            <operand localId="291" locator="73:7-73:52" xsi:type="LessOrEqual">
               <signature localId="295" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <signature localId="296" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <operand localId="293" locator="73:7-73:46" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
               <operand localId="294" locator="73:51-73:52" valueType="t:Integer" value="14" xsi:type="Literal"/>
            </operand>
         </expression>
      </def>
      <def localId="299" locator="81:1-82:27" name="Client's biological sex is female" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's biological sex is female"/>
            <a:t name="pseudocode" value="&quot;Sex&quot; = &quot;Female&quot;"/>
            <a:t name="code" value="Client's biological sex is female-16"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:s r="299">
               <a:s>/*
@input: Client's biological sex is female
@pseudocode: &quot;Sex&quot; = &quot;Female&quot;
@code: Client's biological sex is female-16
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
*/
define &quot;Client's biological sex is female&quot;:
  </a:s>
               <a:s r="300">
                  <a:s r="302">
                     <a:s r="301">
                        <a:s>Patient</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="302">
                        <a:s>gender</a:s>
                     </a:s>
                  </a:s>
                  <a:s> = </a:s>
                  <a:s r="303">
                     <a:s>'female'</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="300" locator="82:3-82:27" xsi:type="Equal">
            <signature localId="307" name="t:String" xsi:type="NamedTypeSpecifier"/>
            <signature localId="308" name="t:String" xsi:type="NamedTypeSpecifier"/>
            <operand localId="305" name="ToString" libraryName="FHIRHelpers" xsi:type="FunctionRef">
               <signature localId="306" name="fhir:AdministrativeGender" xsi:type="NamedTypeSpecifier"/>
               <operand localId="302" locator="82:3-82:16" path="gender" xsi:type="Property">
                  <source localId="301" locator="82:3-82:9" name="Patient" xsi:type="ExpressionRef"/>
               </operand>
            </operand>
            <operand localId="303" locator="82:20-82:27" valueType="t:String" value="female" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="311" locator="90:1-91:48" name="Client's age more than or equal to 15 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age more than or equal to 15 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; ≥ 15 years"/>
            <a:t name="code" value="Client's age more than or equal to 15 years-41"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:s r="311">
               <a:s>/*
@input: Client's age more than or equal to 15 years
@pseudocode: Today's date − &quot;Date of birth&quot; ≥ 15 years
@code: Client's age more than or equal to 15 years-41
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
*/
define &quot;Client's age more than or equal to 15 years&quot;:
  </a:s>
               <a:s r="312">
                  <a:s r="314">
                     <a:s r="313">
                        <a:s>Encounter</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="314">
                        <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="315"> >= 15</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="312" locator="91:3-91:48" xsi:type="GreaterOrEqual">
            <signature localId="316" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="317" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="314" locator="91:3-91:42" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
            <operand localId="315" locator="91:47-91:48" valueType="t:Integer" value="15" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="320" locator="99:1-100:41" name="Client's biological sex is not female" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's biological sex is not female"/>
            <a:t name="pseudocode" value="&quot;Sex&quot; ≠ &quot;Female&quot;"/>
            <a:t name="code" value="Client's biological sex is not female-16"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:s r="320">
               <a:s>/*
@input: Client's biological sex is not female
@pseudocode: &quot;Sex&quot; ≠ &quot;Female&quot;
@code: Client's biological sex is not female-16
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
*/
define &quot;Client's biological sex is not female&quot;:
  </a:s>
               <a:s r="321">
                  <a:s>not </a:s>
                  <a:s r="322">
                     <a:s>&quot;Client's biological sex is female&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="321" locator="100:3-100:41" xsi:type="Not">
            <operand localId="322" locator="100:7-100:41" name="Client's biological sex is female" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def localId="325" locator="109:1-110:55" name="One HPV primary series dose was administered" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="One HPV primary series dose was administered"/>
            <a:t name="pseudocode" value="&quot;Vaccine type&quot; = &quot;HPV vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 1"/>
            <a:t name="code" value="One HPV primary series dose was administered-112"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="325">
               <a:s>/*
@input: One HPV primary series dose was administered
@pseudocode: Count of vaccines administered (where &quot;Vaccine type&quot; = &quot;HPV vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 1
@code: One HPV primary series dose was administered-112
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;One HPV primary series dose was administered&quot;:
  </a:s>
               <a:s r="326">
                  <a:s r="327">
                     <a:s>&quot;Number of HPV Primary Series Doses Administered&quot;</a:s>
                  </a:s>
                  <a:s r="328"> = 1</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="326" locator="110:3-110:55" xsi:type="Equal">
            <signature localId="329" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="330" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="327" locator="110:3-110:51" name="Number of HPV Primary Series Doses Administered" xsi:type="ExpressionRef"/>
            <operand localId="328" locator="110:55" valueType="t:Integer" value="1" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="337" locator="215:1-216:93" name="Date of Latest HPV Dose" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="internal" value="Date of Latest HPV Dose"/>
            <a:s r="337">
               <a:s>/*
@internal: Date of Latest HPV Dose
*/
define &quot;Date of Latest HPV Dose&quot;:
  </a:s>
               <a:s r="338">
                  <a:s>date from </a:s>
                  <a:s r="339">
                     <a:s>start of </a:s>
                     <a:s r="345">
                        <a:s r="344">
                           <a:s r="341">
                              <a:s r="340">
                                 <a:s>&quot;HPV Doses Administered to Patient&quot;</a:s>
                              </a:s>
                              <a:s>.</a:s>
                              <a:s r="341">
                                 <a:s>mostRecent()</a:s>
                              </a:s>
                           </a:s>
                           <a:s>.</a:s>
                           <a:s r="344">
                              <a:s>occurrence</a:s>
                           </a:s>
                        </a:s>
                        <a:s>.</a:s>
                        <a:s r="345">
                           <a:s>toInterval()</a:s>
                        </a:s>
                     </a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="338" locator="216:3-216:93" xsi:type="DateFrom">
            <operand localId="339" locator="216:13-216:93" xsi:type="Start">
               <operand localId="345" locator="216:22-216:93" name="toInterval" libraryName="WC" xsi:type="FunctionRef">
                  <operand localId="344" locator="216:22-216:80" path="occurrence" xsi:type="Property">
                     <source localId="341" locator="216:22-216:69" name="mostRecent" libraryName="WC" xsi:type="FunctionRef">
                        <signature localId="342" xsi:type="ListTypeSpecifier">
                           <elementType localId="343" name="fhir:Immunization" xsi:type="NamedTypeSpecifier"/>
                        </signature>
                        <operand localId="340" locator="216:22-216:56" name="HPV Doses Administered to Patient" xsi:type="ExpressionRef"/>
                     </source>
                  </operand>
               </operand>
            </operand>
         </expression>
      </def>
      <def localId="333" locator="119:1-121:74" name="The latest HPV dose was administered less than 6 months ago" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="The latest HPV dose was administered less than 6 months ago"/>
            <a:t name="pseudocode" value="&quot;Date and time of vaccination&quot; (where &quot;Vaccine type&quot; = &quot;HPV vaccines&quot;) &lt; 6 months"/>
            <a:t name="code" value="The latest HPV dose was administered less than 6 months ago-103"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="333">
               <a:s>/*
@input: The latest HPV dose was administered less than 6 months ago
@pseudocode: Today's date − latest &quot;Date and time of vaccination&quot; (where &quot;Vaccine type&quot; = &quot;HPV vaccines&quot;) &lt; 6 months
@code: The latest HPV dose was administered less than 6 months ago-103
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;The latest HPV dose was administered less than 6 months ago&quot;:
  </a:s>
               <a:s r="334">
                  <a:s r="348">
                     <a:s r="346">
                        <a:s>&quot;Date of Latest HPV Dose&quot;</a:s>
                     </a:s>
                     <a:s> is not null</a:s>
                  </a:s>
                  <a:s>
    and </a:s>
                  <a:s r="349">
                     <a:s r="350">
                        <a:s>duration in months between </a:s>
                        <a:s r="351">
                           <a:s>&quot;Date of Latest HPV Dose&quot;</a:s>
                        </a:s>
                        <a:s> and </a:s>
                        <a:s r="352">
                           <a:s>Today</a:s>
                        </a:s>
                     </a:s>
                     <a:s r="355"> &lt; 6</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="334" locator="120:3-121:74" xsi:type="And">
            <operand localId="348" locator="120:3-120:39" xsi:type="Not">
               <operand localId="347" locator="120:3-120:39" xsi:type="IsNull">
                  <operand localId="346" locator="120:3-120:27" name="Date of Latest HPV Dose" xsi:type="ExpressionRef"/>
               </operand>
            </operand>
            <operand localId="349" locator="121:9-121:74" xsi:type="Less">
               <signature localId="356" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <signature localId="357" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <operand localId="350" locator="121:9-121:70" precision="Month" xsi:type="DurationBetween">
                  <signature localId="353" name="t:Date" xsi:type="NamedTypeSpecifier"/>
                  <signature localId="354" name="t:Date" xsi:type="NamedTypeSpecifier"/>
                  <operand localId="351" locator="121:36-121:60" name="Date of Latest HPV Dose" xsi:type="ExpressionRef"/>
                  <operand localId="352" locator="121:66-121:70" name="Today" xsi:type="ParameterRef"/>
               </operand>
               <operand localId="355" locator="121:74" valueType="t:Integer" value="6" xsi:type="Literal"/>
            </operand>
         </expression>
      </def>
      <def localId="360" locator="130:1-131:67" name="The latest HPV dose was administered more than 6 months ago" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="The latest HPV dose was administered more than 6 months ago"/>
            <a:t name="pseudocode" value="&quot;Date and time of vaccination&quot; (where &quot;Vaccine type&quot; = &quot;HPV vaccines&quot;) ≥ 6 months"/>
            <a:t name="code" value="The latest HPV dose was administered more than 6 months ago-103"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="360">
               <a:s>/*
@input: The latest HPV dose was administered more than 6 months ago
@pseudocode: Today's date − latest &quot;Date and time of vaccination&quot; (where &quot;Vaccine type&quot; = &quot;HPV vaccines&quot;) ≥ 6 months
@code: The latest HPV dose was administered more than 6 months ago-103
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;The latest HPV dose was administered more than 6 months ago&quot;:
  </a:s>
               <a:s r="361">
                  <a:s>not </a:s>
                  <a:s r="362">
                     <a:s>&quot;The latest HPV dose was administered less than 6 months ago&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="361" locator="131:3-131:67" xsi:type="Not">
            <operand localId="362" locator="131:7-131:67" name="The latest HPV dose was administered less than 6 months ago" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def localId="365" locator="140:1-141:55" name="Two HPV primary series doses were administered" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Two HPV primary series doses were administered"/>
            <a:t name="pseudocode" value="&quot;Vaccine type&quot; = &quot;HPV vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 2"/>
            <a:t name="code" value="Two HPV primary series doses were administered-112"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="365">
               <a:s>/*
@input: Two HPV primary series doses were administered
@pseudocode: Count of vaccines administered (where &quot;Vaccine type&quot; = &quot;HPV vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 2
@code: Two HPV primary series doses were administered-112
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;Two HPV primary series doses were administered&quot;:
  </a:s>
               <a:s r="366">
                  <a:s r="367">
                     <a:s>&quot;Number of HPV Primary Series Doses Administered&quot;</a:s>
                  </a:s>
                  <a:s r="368"> = 2</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="366" locator="141:3-141:55" xsi:type="Equal">
            <signature localId="369" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="370" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="367" locator="141:3-141:51" name="Number of HPV Primary Series Doses Administered" xsi:type="ExpressionRef"/>
            <operand localId="368" locator="141:55" valueType="t:Integer" value="2" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="373" locator="150:1-151:45" name="Client's HIV status is positive" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's HIV status is positive"/>
            <a:t name="pseudocode" value="&quot;HIV status&quot; = &quot;HIV-positive&quot;"/>
            <a:t name="code" value="Client's HIV status is positive-29"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="373">
               <a:s>/*
@input: Client's HIV status is positive
@pseudocode: &quot;HIV status&quot; = &quot;HIV-positive&quot;
@code: Client's HIV status is positive-29
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;Client's HIV status is positive&quot;:
  </a:s>
               <a:s r="375">
                  <a:s r="374">
                     <a:s>Encounter</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="375">
                     <a:s>&quot;Client's HIV status is positive&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="375" locator="151:3-151:45" name="Client's HIV status is positive" libraryName="Encounter" xsi:type="ExpressionRef"/>
      </def>
      <def localId="378" locator="160:1-161:41" name="Client is immunocompromised" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client is immunocompromised"/>
            <a:t name="pseudocode" value="&quot;Immunocompromised&quot; = TRUE"/>
            <a:t name="code" value="Client is immunocompromised-26"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="378">
               <a:s>/*
@input: Client is immunocompromised
@pseudocode: &quot;Immunocompromised&quot; = TRUE
@code: Client is immunocompromised-26
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;Client is immunocompromised&quot;:
  </a:s>
               <a:s r="380">
                  <a:s r="379">
                     <a:s>Encounter</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="380">
                     <a:s>&quot;Client is immunocompromised&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="380" locator="161:3-161:41" name="Client is immunocompromised" libraryName="Encounter" xsi:type="ExpressionRef"/>
      </def>
      <def localId="383" locator="170:1-171:45" name="Client is not immunocompromised" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client is not immunocompromised"/>
            <a:t name="pseudocode" value="&quot;Immunocompromised&quot; ≠ TRUE"/>
            <a:t name="code" value="Client is not immunocompromised-26"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="383">
               <a:s>/*
@input: Client is not immunocompromised
@pseudocode: &quot;Immunocompromised&quot; ≠ TRUE
@code: Client is not immunocompromised-26
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;Client is not immunocompromised&quot;:
  </a:s>
               <a:s r="385">
                  <a:s r="384">
                     <a:s>Encounter</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="385">
                     <a:s>&quot;Client is not immunocompromised&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="385" locator="171:3-171:45" name="Client is not immunocompromised" libraryName="Encounter" xsi:type="ExpressionRef"/>
      </def>
      <def localId="388" locator="180:1-181:56" name="Client's HIV status is negative or unknown" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's HIV status is negative or unknown"/>
            <a:t name="pseudocode" value="&quot;HIV status&quot; ≠ &quot;HIV-positive&quot;"/>
            <a:t name="code" value="Client's HIV status is negative or unknown-29"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="388">
               <a:s>/*
@input: Client's HIV status is negative or unknown
@pseudocode: &quot;HIV status&quot; ≠ &quot;HIV-positive&quot;
@code: Client's HIV status is negative or unknown-29
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;Client's HIV status is negative or unknown&quot;:
  </a:s>
               <a:s r="390">
                  <a:s r="389">
                     <a:s>Encounter</a:s>
                  </a:s>
                  <a:s>.</a:s>
                  <a:s r="390">
                     <a:s>&quot;Client's HIV status is negative or unknown&quot;</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="390" locator="181:3-181:56" name="Client's HIV status is negative or unknown" libraryName="Encounter" xsi:type="ExpressionRef"/>
      </def>
      <def localId="393" locator="190:1-191:55" name="Three HPV primary series doses were administered" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Three HPV primary series doses were administered"/>
            <a:t name="pseudocode" value="&quot;Vaccine type&quot; = &quot;HPV vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 3"/>
            <a:t name="code" value="Three HPV primary series doses were administered-112"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.2 doses: 2-dose schedule"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="393">
               <a:s>/*
@input: Three HPV primary series doses were administered
@pseudocode: Count of vaccines administered (where &quot;Vaccine type&quot; = &quot;HPV vaccines&quot; and &quot;Type of dose&quot; = &quot;Primary series&quot;) = 3
@code: Three HPV primary series doses were administered-112
@decision: IMMZ.D2.DT.HPV.2 doses: 2-dose schedule
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;Three HPV primary series doses were administered&quot;:
  </a:s>
               <a:s r="394">
                  <a:s r="395">
                     <a:s>&quot;Number of HPV Primary Series Doses Administered&quot;</a:s>
                  </a:s>
                  <a:s r="396"> = 3</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="394" locator="191:3-191:55" xsi:type="Equal">
            <signature localId="397" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="398" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="395" locator="191:3-191:51" name="Number of HPV Primary Series Doses Administered" xsi:type="ExpressionRef"/>
            <operand localId="396" locator="191:55" valueType="t:Integer" value="3" xsi:type="Literal"/>
         </expression>
      </def>
      <def localId="401" locator="199:1-201:52" name="Client's age is between 9 and 20 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is between 9 and 20 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; ≤ 20 years"/>
            <a:t name="code" value="Client's age is between 9 and 20 years-51"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="401">
               <a:s>/*
@input: Client's age is between 9 and 20 years
@pseudocode: 9 years ≤ Today's date − &quot;Date of birth&quot; ≤ 20 years
@code: Client's age is between 9 and 20 years-51
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;Client's age is between 9 and 20 years&quot;:
  </a:s>
               <a:s r="402">
                  <a:s r="403">
                     <a:s r="404">9 &lt;= </a:s>
                     <a:s r="406">
                        <a:s r="405">
                           <a:s>Encounter</a:s>
                        </a:s>
                        <a:s>.</a:s>
                        <a:s r="406">
                           <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                        </a:s>
                     </a:s>
                  </a:s>
                  <a:s>
  and </a:s>
                  <a:s r="409">
                     <a:s r="411">
                        <a:s r="410">
                           <a:s>Encounter</a:s>
                        </a:s>
                        <a:s>.</a:s>
                        <a:s r="411">
                           <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                        </a:s>
                     </a:s>
                     <a:s r="412"> &lt;= 20</a:s>
                  </a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="402" locator="200:3-201:52" xsi:type="And">
            <operand localId="403" locator="200:3-200:47" xsi:type="LessOrEqual">
               <signature localId="407" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <signature localId="408" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <operand localId="404" locator="200:3" valueType="t:Integer" value="9" xsi:type="Literal"/>
               <operand localId="406" locator="200:8-200:47" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
            </operand>
            <operand localId="409" locator="201:7-201:52" xsi:type="LessOrEqual">
               <signature localId="413" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <signature localId="414" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
               <operand localId="411" locator="201:7-201:46" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
               <operand localId="412" locator="201:51-201:52" valueType="t:Integer" value="20" xsi:type="Literal"/>
            </operand>
         </expression>
      </def>
      <def localId="417" locator="209:1-210:47" name="Client's age is more than 20 years" context="Patient" accessLevel="Public">
         <annotation xsi:type="a:Annotation">
            <a:t name="input" value="Client's age is more than 20 years"/>
            <a:t name="pseudocode" value="&quot;Date of birth&quot; > 20 years"/>
            <a:t name="code" value="Client's age is more than 20 years-41"/>
            <a:t name="decision" value="IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule"/>
            <a:s r="417">
               <a:s>/*
@input: Client's age is more than 20 years
@pseudocode: Today's date − &quot;Date of birth&quot; > 20 years
@code: Client's age is more than 20 years-41
@decision: IMMZ.D2.DT.HPV.Single dose: Alternative single-dose schedule
*/
define &quot;Client's age is more than 20 years&quot;:
  </a:s>
               <a:s r="418">
                  <a:s r="420">
                     <a:s r="419">
                        <a:s>Encounter</a:s>
                     </a:s>
                     <a:s>.</a:s>
                     <a:s r="420">
                        <a:s>&quot;Current Patient Age In Years&quot;</a:s>
                     </a:s>
                  </a:s>
                  <a:s r="421"> > 20</a:s>
               </a:s>
            </a:s>
         </annotation>
         <expression localId="418" locator="210:3-210:47" xsi:type="Greater">
            <signature localId="422" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <signature localId="423" name="t:Integer" xsi:type="NamedTypeSpecifier"/>
            <operand localId="420" locator="210:3-210:42" name="Current Patient Age In Years" libraryName="Encounter" xsi:type="ExpressionRef"/>
            <operand localId="421" locator="210:46-210:47" valueType="t:Integer" value="20" xsi:type="Literal"/>
         </expression>
      </def>
   </statements>
</library>
