<?xml version="1.0" encoding="UTF-8"?>

<Library xmlns="http://hl7.org/fhir">
  <id value="IMMZD18SHepatitisAInactivatedHAV1DoseLogic"/>
  <meta>
    <profile value="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary"/>
    <profile value="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary"/>
    <profile value="http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library"/>
    <profile value="http://hl7.org/fhir/uv/cql/StructureDefinition/cql-module"/>
  </meta>
  <text>
    <status value="extensions"/><div xmlns="http://www.w3.org/1999/xhtml">
<div>
    <table class="grid dict">
        
        
        <tr>
            <th scope="row"><b>Title: </b></th>
            <td style="padding-left: 4px;">IMMZD18SHepatitisAInactivatedHAV1DoseLogic</td>
        </tr>
        

        
        
        <tr>
            <th scope="row"><b>Id: </b></th>
            <td style="padding-left: 4px;">IMMZD18SHepatitisAInactivatedHAV1DoseLogic</td>
        </tr>
        

        
        
        <tr>
            <th scope="row"><b>Version: </b></th>
            <td style="padding-left: 4px;">1.0.0</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Url: </b></th>
            <td style="padding-left: 4px;"><a href="Library-IMMZD18SHepatitisAInactivatedHAV1DoseLogic.html">IMMZD18SHepatitisAInactivatedHAV1DoseLogic</a></td>
        </tr>
        

        

        

        
        <tr>
            <th scope="row"><b>Status: </b></th>
            <td style="padding-left: 4px;">draft</td>
        </tr>
        

        

        
        <tr>
            <th scope="row"><b>Type: </b></th>
            <td style="padding-left: 4px;">
                
                    
                        
                        <p style="margin-bottom: 5px;">
                            <b>system: </b> <span><a href="http://terminology.hl7.org/7.1.0/CodeSystem-library-type.html">http://terminology.hl7.org/CodeSystem/library-type</a></span>
                        </p>
                        
                        
                        <p style="margin-bottom: 5px;">
                            <b>code: </b> <span>logic-library</span>
                        </p>
                        
                        
                    
                
                
            </td>
        </tr>
        

        

        
        <tr>
            <th scope="row"><b>Date: </b></th>
            <td style="padding-left: 4px;">2026-03-31 13:54:17+0000</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Publisher: </b></th>
            <td style="padding-left: 4px;">WHO</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Description: </b></th>
            <td style="padding-left: 4px;"><div><p>This library defines decision support logic for the IMMZ.D18.S.Hepatitis A.Inactivated HAV 1-dose schedule table in the Immunization CPG</p>
</div></td>
        </tr>
        

        

        

        

        

        

        

        

        

        

        

        
        <tr>
            <th scope="row"><b>Related Artifacts: </b></th>
            <td style="padding-left: 4px;">
                
                
                
                <p><b>Dependencies</b></p>
                <ul>
                  
                    <li><a href="Library-WHOCommon.html">WHOCommon</a></li>
                  
                    <li><a href="Library-IMMZCommon.html">IMMZCommon</a></li>
                  
                    <li><a href="Library-IMMZConcepts.html">IMMZConcepts</a></li>
                  
                    <li><a href="Library-IMMZEncounterElements.html">IMMZEncounterElements</a></li>
                  
                    <li><a href="Library-IMMZD2DTHepatitisAEncounterElements.html">IMMZD2DTHepatitisAEncounterElements</a></li>
                  
                </ul>
                
                
                
                
                
            </td>
        </tr>
        

        
        <tr>
          <th scope="row"><b>Parameters: </b></th>
          <td style="padding-left: 4px;">
            <table class="grid-dict">
              <tr><th><b>Name</b></th><th><b>Type</b></th><th><b>Min</b></th><th><b>Max</b></th><th><b>In/Out</b></th></tr>
              
                <tr><th>Today</th><th>date</th><th>0</th><th>1</th><th>In</th></tr>
              
                <tr><th>Patient</th><th>Patient</th><th>0</th><th>1</th><th>Out</th></tr>
              
                <tr><th>First hepatitis A dose from the primary series was administered. The primary series has been completed</th><th>boolean</th><th>0</th><th>1</th><th>Out</th></tr>
              
                <tr><th>Hepatitis A dose 1</th><th>boolean</th><th>0</th><th>1</th><th>Out</th></tr>
              
                <tr><th>Hepatitis A dose 1 Due Date</th><th>date</th><th>0</th><th>1</th><th>Out</th></tr>
              
                <tr><th>Hepatitis A dose 1 Create</th><th>string</th><th>0</th><th>1</th><th>Out</th></tr>
              
                <tr><th>Hepatitis A dose 1 Overdue</th><th>Resource</th><th>0</th><th>1</th><th>Out</th></tr>
              
                <tr><th>Hepatitis A dose 1 Expiration</th><th>Resource</th><th>0</th><th>1</th><th>Out</th></tr>
              
                <tr><th>Test Validation</th><th>Resource</th><th>0</th><th>1</th><th>Out</th></tr>
              
            </table>
          </td>
        </tr>
        

        

        
        
        <tr>
          <td colspan="2">
            <table>
              <tr><th><a id="cql-content"><b>Content: </b></a> text/cql</th></tr>
              <tr><td><pre><code class="language-cql">/*
 * Library: IMMZD18SHepatitisAInactivatedHAV1DoseLogic (IMMZ.D18.S.Hepatitis A.Inactivated HAV 1-dose schedule)
 * Schedule Table: Inactivated hepatitis A virus (HAV), 1-dose schedule
 */
library IMMZD18SHepatitisAInactivatedHAV1DoseLogic

using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1'

include WHOCommon called WC

include IMMZCommon called Common
include IMMZConcepts called Concepts

include IMMZEncounterElements called IE
include IMMZD2DTHepatitisAEncounterElements called Encounter

parameter Today Date default Today()


context Patient


/*
@output: Hepatitis A dose 1
@description: Provision of the hepatitis A dose 1
@trigger: Child's birth
@pseudo: 
@triggerDate: &quot;Date of birth&quot;
*/
define &quot;Hepatitis A dose 1&quot;:
  Encounter.&quot;No hepatitis A primary series dose was administered&quot;
  and not &quot;First hepatitis A dose from the primary series was administered. The primary series has been completed&quot;


/*
@output: Hepatitis A dose 1 Create
@create: WHO recommends that vaccination against HAV be introduced into national immunization schedules for individuals aged ≥ 12 months.
*/
define &quot;Hepatitis A dose 1 Create&quot;:
  if &quot;Hepatitis A dose 1&quot;
  then 'WHO recommends that vaccination against HAV be introduced into national immunization schedules for individuals aged ≥ 12 months.' + '
Due Date: ' + ToString(&quot;Hepatitis A dose 1 Due Date&quot;)
  else ''


/*
@dynamicValue: Hepatitis A dose 1 Due Date
@pseudocode: &quot;Date of birth&quot; + 12 months
*/
define &quot;Hepatitis A dose 1 Due Date&quot;:
  if &quot;Hepatitis A dose 1&quot; then Patient.birthDate + 12 months
  else null


/*
@dynamicValue: Hepatitis A 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 &quot;Hepatitis A dose 1 Overdue&quot;:
  null


/*
@dynamicValue: Hepatitis A dose 1 Expiration
@pseudocode: To be determined by Member States; however, there is no recommended expiration date and individuals are always eligible to be vaccinated.
*/
define &quot;Hepatitis A dose 1 Expiration&quot;:
  null

  
/*
@complete: First hepatitis A dose from the primary series was administered. The primary series has been completed
@pseudocode: &quot;Completed the primary vaccination series&quot; = TRUE (where &quot;Vaccine type&quot; = &quot;Hepatitis A-containing vaccines&quot;)
*/
define &quot;First hepatitis A dose from the primary series was administered. The primary series has been completed&quot;:
  Encounter.&quot;One hepatitis A primary series dose was administered&quot;



/*
@test: Test expected results based on example patients
*/
define &quot;Test Validation&quot;:
  case
    when Patient.id = 'HepatitisA20.1' then &quot;Hepatitis A dose 1&quot;
    when Patient.id = 'HepatitisA21.2' then &quot;Hepatitis A dose 1&quot;
    when Patient.id = 'HepatitisA22.1' then &quot;First hepatitis A dose from the primary series was administered. The primary series has been completed&quot;
    else 'No test case set'
  end
</code></pre></td></tr>
            </table>
          </td>
        </tr>
        
        
        
    </table>
</div>
</div>
  </text>
  <extension url="http://hl7.org/fhir/StructureDefinition/cqf-knowledgeCapability">
    <valueCode value="computable"/>
  </extension>
  <url value="http://smart.who.int/immunizations/Library/IMMZD18SHepatitisAInactivatedHAV1DoseLogic"/>
  <version value="1.0.0"/>
  <name value="IMMZD18SHepatitisAInactivatedHAV1DoseLogic"/>
  <title value="IMMZD18SHepatitisAInactivatedHAV1DoseLogic"/>
  <status value="draft"/>
  <experimental value="false"/>
  <type>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/library-type"/>
      <code value="logic-library"/>
    </coding>
  </type>
  <date value="2026-03-31T13:54:17+00:00"/>
  <publisher value="WHO"/>
  <contact>
    <name value="WHO"/>
    <telecom>
      <system value="url"/>
      <value value="http://who.int"/>
    </telecom>
  </contact>
  <description value="This library defines decision support logic for the IMMZ.D18.S.Hepatitis A.Inactivated HAV 1-dose schedule table in the Immunization CPG"/>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Library WC"/>
    <resource value="http://smart.who.int/immunizations/Library/WHOCommon"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Library Common"/>
    <resource value="http://smart.who.int/immunizations/Library/IMMZCommon"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Library Concepts"/>
    <resource value="http://smart.who.int/immunizations/Library/IMMZConcepts"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Library IE"/>
    <resource value="http://smart.who.int/immunizations/Library/IMMZEncounterElements"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Library Encounter"/>
    <resource value="http://smart.who.int/immunizations/Library/IMMZD2DTHepatitisAEncounterElements"/>
  </relatedArtifact>
  <parameter>
    <name value="Today"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <type value="date"/>
  </parameter>
  <parameter>
    <name value="Patient"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="First hepatitis A dose from the primary series was administered. The primary series has been completed"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="boolean"/>
  </parameter>
  <parameter>
    <name value="Hepatitis A dose 1"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="boolean"/>
  </parameter>
  <parameter>
    <name value="Hepatitis A dose 1 Due Date"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="date"/>
  </parameter>
  <parameter>
    <name value="Hepatitis A dose 1 Create"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="string"/>
  </parameter>
  <parameter>
    <name value="Hepatitis A dose 1 Overdue"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Resource"/>
  </parameter>
  <parameter>
    <name value="Hepatitis A dose 1 Expiration"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Resource"/>
  </parameter>
  <parameter>
    <name value="Test Validation"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Resource"/>
  </parameter>
  <content>
    <contentType value="text/cql"/>
    <data value="LyoKICogTGlicmFyeTogSU1NWkQxOFNIZXBhdGl0aXNBSW5hY3RpdmF0ZWRIQVYxRG9zZUxvZ2ljIChJTU1aLkQxOC5TLkhlcGF0aXRpcyBBLkluYWN0aXZhdGVkIEhBViAxLWRvc2Ugc2NoZWR1bGUpCiAqIFNjaGVkdWxlIFRhYmxlOiBJbmFjdGl2YXRlZCBoZXBhdGl0aXMgQSB2aXJ1cyAoSEFWKSwgMS1kb3NlIHNjaGVkdWxlCiAqLwpsaWJyYXJ5IElNTVpEMThTSGVwYXRpdGlzQUluYWN0aXZhdGVkSEFWMURvc2VMb2dpYwoKdXNpbmcgRkhJUiB2ZXJzaW9uICc0LjAuMScKaW5jbHVkZSBGSElSSGVscGVycyB2ZXJzaW9uICc0LjAuMScKCmluY2x1ZGUgV0hPQ29tbW9uIGNhbGxlZCBXQwoKaW5jbHVkZSBJTU1aQ29tbW9uIGNhbGxlZCBDb21tb24KaW5jbHVkZSBJTU1aQ29uY2VwdHMgY2FsbGVkIENvbmNlcHRzCgppbmNsdWRlIElNTVpFbmNvdW50ZXJFbGVtZW50cyBjYWxsZWQgSUUKaW5jbHVkZSBJTU1aRDJEVEhlcGF0aXRpc0FFbmNvdW50ZXJFbGVtZW50cyBjYWxsZWQgRW5jb3VudGVyCgpwYXJhbWV0ZXIgVG9kYXkgRGF0ZSBkZWZhdWx0IFRvZGF5KCkKCgpjb250ZXh0IFBhdGllbnQKCgovKgpAb3V0cHV0OiBIZXBhdGl0aXMgQSBkb3NlIDEKQGRlc2NyaXB0aW9uOiBQcm92aXNpb24gb2YgdGhlIGhlcGF0aXRpcyBBIGRvc2UgMQpAdHJp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