<?xml version='1.0' encoding='UTF-8'?>
<Library xmlns="http://hl7.org/fhir" xmlns:html="http://www.w3.org/1999/xhtml">
  <id value="IMMZD18SMeningococcalMenAConjugateVaccine1DoseLogic" />
  <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" /><html:div>
<html:div>
    <html:table class="grid dict">
        
        
        <html:tr>
            <html:th scope="row"><html:b>Title: </html:b></html:th>
            <html:td style="padding-left: 4px;">IMMZD18SMeningococcalMenAConjugateVaccine1DoseLogic</html:td>
        </html:tr>
        

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

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

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

        

        

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

        

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

        

        
        <html:tr>
            <html:th scope="row"><html:b>Date: </html:b></html:th>
            <html:td style="padding-left: 4px;">2026-11-19 08:10:32+0000</html:td>
        </html:tr>
        

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

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

        

        

        

        

        

        

        

        

        

        

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

        

        

        
        
        <html:tr>
          <html:td colspan="2">
            <html:table>
              <html:tr><html:th><html:a id="cql-content"><html:b>Content: </html:b></html:a> text/cql</html:th></html:tr>
              <html:tr><html:td><html:pre><html:code class="language-cql">/*
 * Library: IMMZD18SMeningococcalMenAConjugateVaccine1DoseLogic (IMMZ.D18.S.Meningococcal.MenA conjugate vaccine 1-dose schedule)
 * Schedule Table: MenA conjugate vaccine, 1-dose schedule
 */
library IMMZD18SMeningococcalMenAConjugateVaccine1DoseLogic

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 IMMZD2DTMeningococcalEncounterElements called Encounter

parameter Today Date default Today()


context Patient


/*
@output: Meningococcal dose 1
@description: Provision of the meningococcal dose 1
@trigger: Child's birth
@pseudo: 
@triggerDate: "Date of birth"
*/
define "Meningococcal dose 1":
  Encounter."No meningococcal primary series dose was administered"
  and not "One meningococcal dose from the primary series was administered. The primary series has been completed"


/*
@output: Meningococcal dose 1 Create
@create: For MenA conjugate vaccine (5µg), a 1-dose schedule is recommended at 9–18 months of age
*/
define "Meningococcal dose 1 Create":
  if "Meningococcal dose 1"
  then 'For MenA conjugate vaccine (5µg), a 1-dose schedule is recommended at 9–18 months of age' + '
Due Date: ' + ToString("Meningococcal dose 1 Due Date") + '
Overdue: ' + ToString("Meningococcal dose 1 Overdue")
  else ''


/*
@dynamicValue: Meningococcal dose 1 Due Date
@pseudocode: "Date of birth" + 9 months
*/
define "Meningococcal dose 1 Due Date":
  if "Meningococcal dose 1" then Patient.birthDate + 9 months
  else null


/*
@dynamicValue: Meningococcal dose 1 Overdue
@pseudocode: "Date of birth" + 18 months
*/
define "Meningococcal dose 1 Overdue":
  if "Meningococcal dose 1" then Patient.birthDate + 18 months
  else null


/*
@dynamicValue: Meningococcal 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 "Meningococcal dose 1 Expiration":
  null

  
/*
@complete: One meningococcal dose from the primary series was administered. The primary series has been completed
@pseudocode: "Completed the primary vaccination series" = TRUE (where "Vaccine type" = "Meningococcal vaccines")
*/
define "One meningococcal dose from the primary series was administered. The primary series has been completed":
  Encounter."One meningococcal primary series dose was administered"



/*
@test: Test expected results based on example patients
*/
define "Test Validation":
  case
    when Patient.id = 'Meningococcal08.1' then "Meningococcal dose 1"
    when Patient.id = 'Meningococcal09.2' then "Meningococcal dose 1"
    when Patient.id = 'Meningococcal10.1' then "One meningococcal dose from the primary series was administered. The primary series has been completed"
    else 'No test case set'
  end
</html:code></html:pre></html:td></html:tr>
            </html:table>
          </html:td>
        </html:tr>
        
        
        
        
        
        <html:tr>
          <html:td colspan="2">
            <html:table>
              <html:tr><html:th><html:b>Content: </html:b> application/elm+xml</html:th></html:tr>
              <html:tr><html:td><html:pre><html:code>Encoded data (25444 characters)</html:code></html:pre></html:td></html:tr>
            </html:table>
          </html:td>
        </html:tr>
        
        
    </html:table>
</html:div>
</html:div>
  </text>
  <extension url="http://hl7.org/fhir/StructureDefinition/cqf-knowledgeCapability">
    <valueCode value="computable" />
  </extension>
  <url value="http://smart.who.int/immunizations/Library/IMMZD18SMeningococcalMenAConjugateVaccine1DoseLogic" />
  <version value="0.2.0" />
  <name value="IMMZD18SMeningococcalMenAConjugateVaccine1DoseLogic" />
  <title value="IMMZD18SMeningococcalMenAConjugateVaccine1DoseLogic" />
  <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-11-19T08:10:32+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.Meningococcal.MenA conjugate vaccine 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/IMMZD2DTMeningococcalEncounterElements" />
  </relatedArtifact>
  <content>
    <contentType value="text/cql" />
    <url value="Library-IMMZD18SMeningococcalMenAConjugateVaccine1DoseLogic.cql" /></content>
  <content>
    <contentType value="application/elm+xml" />
    <url value="Library-IMMZD18SMeningococcalMenAConjugateVaccine1DoseLogic.elm.xml" /></content>
</Library>