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

<Measure xmlns="http://hl7.org/fhir">
  <id value="IMMZIND45"/>
  <meta>
    <profile value="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/proportion-measure-cqfm"/>
  </meta>
  <text>
    <status value="extensions"/><div xmlns="http://www.w3.org/1999/xhtml">
  <table class="narrative-table">
    <tbody>
<tr>

<th colspan="2" scope="row" class="row-header">Knowledge Artifact Metadata</th>

</tr>

<tr>

<th scope="row" class="row-header">Name (machine-readable)</th>

<td class="content-container">IMMZIND45</td>
</tr>


<tr>

<th scope="row" class="row-header">Title (human-readable)</th>

<td class="content-container">IMMZIND45</td>
</tr>



<tr>

<th scope="row" class="row-header">Status</th>

<td class="content-container">Draft</td>
</tr>


<tr>

<th scope="row" class="row-header">Experimental</th>

<td class="content-container">false</td>
</tr>


<tr>

<th scope="row" class="row-header">Description</th>

<td class="content-container"><div><p>IMMZ.IND.45 Immunization session completion rate</p>
</div></td>
</tr>












<tr>

<th scope="row" class="row-header">Measure Steward</th>

<td class="content-container">WHO</td>
</tr>


<tr>

<th scope="row" class="row-header">Steward Contact Details</th>

<td class="content-container">WHO: <a href="http://who.int">http://who.int</a></td>
</tr>











<tr>

<th colspan="2" scope="row" class="row-header">Measure Metadata</th>

</tr>






<tr>

<th scope="row" class="row-header">Version Number</th>

<td class="content-container">1.0.0</td>
</tr>


<tr>

<th scope="row" class="row-header">Measure Scoring</th>

<td class="content-container"><span title="Codes:{http://terminology.hl7.org/CodeSystem/measure-scoring proportion}">Proportion</span></td>
</tr>















  
    <tr>

<th colspan="2" scope="row" class="row-header">Measure Population Criteria</th>

</tr>
  
  
  
  
    <tr>
      
        
<th scope="row" class="row-header">Initial Population</th>

      
      <td class="content-container">
        
        <em>ID</em>: IMMZ.IND.45.IP
        <br/>
        
        
          <em>Description</em>:
          <p style="white-space: pre-line" class="tab-one">Initial Population</p>
        
        
          
            
            <em>Logic Definition</em>: <a href="#immzind45logic-initial-population">Initial Population</a> 
          
        
      </td>
    </tr>
  

  
    <tr>
      
        
<th scope="row" class="row-header">Denominator</th>

      
      <td class="content-container">
        
        <em>ID</em>: IMMZ.IND.45.D
        <br/>
        
        
          <em>Description</em>:
          <p style="white-space: pre-line" class="tab-one">Denominator</p>
        
        
          
            
            <em>Logic Definition</em>: <a href="#immzind45logic-denominator">Denominator</a> 
          
        
      </td>
    </tr>
  

  
    <tr>
      
        
<th scope="row" class="row-header">Numerator</th>

      
      <td class="content-container">
        
        <em>ID</em>: IMMZ.IND.45.N
        <br/>
        
        
          <em>Description</em>:
          <p style="white-space: pre-line" class="tab-one">Numerator</p>
        
        
          
            
            <em>Logic Definition</em>: <a href="#immzind45logic-numerator">Numerator</a> 
          
        
      </td>
    </tr>
  

  
<tr>
  
<th scope="row" class="row-header">Stratifier</th>

  <td class="content-container">
    
      <em>ID</em>: {idprefix}.S1
      
        <br/>
      
    
    
      
        <em>Code</em>: By-Administrative Area
      
      
    
    
  </td>
</tr>

<tr>
  
<th scope="row" class="row-header">Stratifier</th>

  <td class="content-container">
    
      <em>ID</em>: {idprefix}.S2
      
        <br/>
      
    
    
      
        <em>Code</em>: By-Administrative Area
      
      
    
    
  </td>
</tr>

  
  
<tr>

<th scope="row" class="row-header">Population Basis</th>

<td class="content-container">boolean</td>
</tr>















<tr>

<th colspan="2" scope="row" class="row-header">Measure Logic</th>

</tr>

<tr>

<th scope="row" class="row-header">Primary Library</th>

<td class="content-container"><a href="Library-IMMZIND45Logic.html">IMMZIND45Logic</a></td>
</tr>




  
  

<tr>
  
  
  
  
  
<th scope="row" class="row-header">Dependency</th>

  
  <td class="content-container">
    
    <em>Description</em>: FHIR model information
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="http://fhir.org/guides/cqf/common/4.0.1/4.0.1/Library-FHIR-ModelInfo.html">http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1</tt>
    
  </td>
</tr>

<tr>
  
  
  
  
  
<th scope="row" class="row-header">Dependency</th>

  
  <td class="content-container">
    
    <em>Description</em>: Library WC
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="Library-WHOCommon.html">WHOCommon</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://smart.who.int/immunizations/Library/WHOCommon</tt>
    
  </td>
</tr>

<tr>
  
  
  
  
  
<th scope="row" class="row-header">Dependency</th>

  
  <td class="content-container">
    
    <em>Description</em>: Library FHIRHelpers
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="http://fhir.org/guides/cqf/common/4.0.1/4.0.1/Library-FHIRHelpers.html">http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1</tt>
    
  </td>
</tr>

<tr>
  
  
  
  
  
<th scope="row" class="row-header">Dependency</th>

  
  <td class="content-container">
    
    <em>Description</em>: Library Elements
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <code>http://smart.who.int/immunizations/Library/IMMZIndicatorElements</code>
    <br/>
    <em>Canonical URL</em>: <tt>http://smart.who.int/immunizations/Library/IMMZIndicatorElements</tt>
    
  </td>
</tr>


  
  
  <tr>
  
<th scope="row" class="row-header">Parameter</th>

  <td class="content-container">
    <em>Name</em>: Measurement Period
    <br/>
    <em>Use</em>: In
    <br/>
    <em>Min Cardinality</em>: 0
    <br/>
    <em>Max Cardinality</em>: 1
    <br/>
    <em>Type</em>: Period
  </td>
</tr>
  
  <tr>
  
<th scope="row" class="row-header">Parameter</th>

  <td class="content-container">
    <em>Name</em>: Numerator
    <br/>
    <em>Use</em>: Out
    <br/>
    <em>Min Cardinality</em>: 0
    <br/>
    <em>Max Cardinality</em>: 1
    <br/>
    <em>Type</em>: boolean
  </td>
</tr>
  
  <tr>
  
<th scope="row" class="row-header">Parameter</th>

  <td class="content-container">
    <em>Name</em>: Stratification 2
    <br/>
    <em>Use</em>: Out
    <br/>
    <em>Min Cardinality</em>: 0
    <br/>
    <em>Max Cardinality</em>: 1
    <br/>
    <em>Type</em>: string
  </td>
</tr>
  
  <tr>
  
<th scope="row" class="row-header">Parameter</th>

  <td class="content-container">
    <em>Name</em>: Stratification 1
    <br/>
    <em>Use</em>: Out
    <br/>
    <em>Min Cardinality</em>: 0
    <br/>
    <em>Max Cardinality</em>: 1
    <br/>
    <em>Type</em>: string
  </td>
</tr>
  
  <tr>
  
<th scope="row" class="row-header">Parameter</th>

  <td class="content-container">
    <em>Name</em>: Denominator
    <br/>
    <em>Use</em>: Out
    <br/>
    <em>Min Cardinality</em>: 0
    <br/>
    <em>Max Cardinality</em>: 1
    <br/>
    <em>Type</em>: boolean
  </td>
</tr>
  
  <tr>
  
<th scope="row" class="row-header">Parameter</th>

  <td class="content-container">
    <em>Name</em>: Initial Population
    <br/>
    <em>Use</em>: Out
    <br/>
    <em>Min Cardinality</em>: 0
    <br/>
    <em>Max Cardinality</em>: 1
    <br/>
    <em>Type</em>: boolean
  </td>
</tr>
  
  
  <tr>
    <th colspan="2" scope="row" class="section-header"><a name="effective-data-requirements"> </a>Measure Logic Data Requirements</th>
  </tr>
  
  
<tr>
  <th scope="row" class="row-header">Data Requirement</th>
  <td class="content-container">
    <em>Type</em>: Immunization
    <br/>
  
    <em>Profile(s)</em>: 
  
    <a href="http://hl7.org/fhir/R4/immunization.html">Immunization</a>
    <br/>        
  
   
   
    <em>Must Support Elements</em>: occurrence, status, location
    <br/>
   
   
  </td>
</tr>

<tr>
  <th scope="row" class="row-header">Data Requirement</th>
  <td class="content-container">
    <em>Type</em>: Patient
    <br/>
  
    <em>Profile(s)</em>: 
  
    <a href="http://hl7.org/fhir/R4/patient.html">Patient</a>
    <br/>        
  
   
   
    <em>Must Support Elements</em>: birthDate
    <br/>
   
   
  </td>
</tr>

<tr>
  <th scope="row" class="row-header">Data Requirement</th>
  <td class="content-container">
    <em>Type</em>: Resource
    <br/>
  
    <em>Profile(s)</em>: 
  
    <a href="http://hl7.org/fhir/R4/resource.html">Resource</a>
    <br/>        
  
   
   
    <em>Must Support Elements</em>: id
    <br/>
   
   
  </td>
</tr>

<tr>
  <th scope="row" class="row-header">Data Requirement</th>
  <td class="content-container">
    <em>Type</em>: Location
    <br/>
  
    <em>Profile(s)</em>: 
  
    <a href="http://hl7.org/fhir/R4/location.html">Location</a>
    <br/>        
  
   
   
    <em>Must Support Elements</em>: address, address.state, name
    <br/>
   
   
  </td>
</tr>

  
  <tr>

<th colspan="2" scope="row" class="row-header">Measure Logic Definitions</th>

</tr>
  
          
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="immzind45logic-initial-population"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> IMMZIND45Logic</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
 * As defined by Member State
 */
define &quot;Initial Population&quot;:
  Immunization.occurrence is not null
  and Immunization.occurrence.toInterval() starts during &quot;Measurement Period&quot;</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="immzind45logic-denominator"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> IMMZIND45Logic</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
@denominator: Number of planned immunization sessions at the vaccination location during the reporting period
@pseudocode: COUNT number of planned sessions during the reporting period
*/
define &quot;Denominator&quot;:
  &quot;Initial Population&quot;</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="immzind45logic-numerator"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> IMMZIND45Logic</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
@numerator: Number of immunization sessions completed at the vaccination location during the reporting period
@pseudocode: COUNT of immunization events WHERE &quot;Immunization event status&quot; = &quot;Completed&quot; during the reporting period
*/
define &quot;Numerator&quot;:
  &quot;Denominator&quot;
    and Immunization.status = 'completed'</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="immzind45logic-stratification-2"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> IMMZIND45Logic</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Stratification 2&quot;:
  Elements.GetGeographicRegionForImmunization( Immunization )</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="immzind45logic-stratification-1"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> IMMZIND45Logic</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
@disaggregation: Vaccination location
                 Administrative area
*/
define &quot;Stratification 1&quot;:
  Elements.GetLocationNameForImmunization( Immunization )</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="whocommon-tointerval"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> WHOCommon</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
From FHIRCommon 4.1.0:
*/

/*
@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
@comment: Normalizes a choice type of FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instance, FHIR.string, FHIR.Age, or FHIR.Range types
to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible
representations for timing-valued elements in FHIR, allowing this function to be used across any resource.

The input can be provided as a dateTime, Period, Timing, instant, string, Age, or Range.
The intent of this function is to provide a clear and concise mechanism to treat single
elements that have multiple possible representations as intervals so that logic doesn't have to account
for the variability. More complex calculations (such as medication request period or dispense period
calculation) need specific guidance and consideration. That guidance may make use of this function, but
the focus of this function is on single element calculations where the semantics are unambiguous.
If the input is a dateTime, the result a DateTime Interval beginning and ending on that dateTime.
If the input is a Period, the result is a DateTime Interval.
If the input is a Timing, an error is raised indicating a single interval cannot be computed from a Timing.
If the input is an instant, the result is a DateTime Interval beginning and ending on that instant.
If the input is a string, an error is raised indicating a single interval cannot be computed from a string.
If the input is an Age, the result is a DateTime Interval beginning when the patient was the given Age,
and ending immediately prior to when the patient was the given Age plus one year.
If the input is a Range, the result is a DateTime Interval beginning when the patient was the Age given
by the low end of the Range, and ending immediately prior to when the patient was the Age given by the
high end of the Range plus one year.

NOTE: Due to the
complexity of determining a single interval from a Timing or String type, this function will throw a run-time exception if it is used
with a Timing or String.
*/
define fluent function toInterval(choice Choice&lt;FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range&gt;):
  case
    when choice is FHIR.dateTime then
      Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]
    when choice is FHIR.Period then
      FHIRHelpers.ToInterval(choice as FHIR.Period)
    when choice is FHIR.instant then
      Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)]
    when choice is FHIR.Age then
      Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age),
        FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year)
    when choice is FHIR.Range then
      Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low),
        FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year)
    when choice is FHIR.Timing then
      Message(null as Interval&lt;DateTime&gt;, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported')
    when choice is FHIR.string then
      Message(null as Interval&lt;DateTime&gt;, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a String value is not supported')
    else
      null as Interval&lt;DateTime&gt;
  end</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="fhirhelpers-todatetime"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToDateTime(value dateTime): value.value</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="fhirhelpers-tointerval"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToInterval(period FHIR.Period):
    if period is null then
        null
    else
        if period.&quot;start&quot; is null then
            Interval(period.&quot;start&quot;.value, period.&quot;end&quot;.value]
        else
            Interval[period.&quot;start&quot;.value, period.&quot;end&quot;.value]</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="fhirhelpers-todatetime"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToDateTime(value instant): value.value</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="fhirhelpers-todate"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToDate(value date): value.value</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="fhirhelpers-toquantity"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToQuantity(quantity FHIR.Quantity):
    case
        when quantity is null then null
        when quantity.value is null then null
        when quantity.comparator is not null then
            Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.')
        when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'
              or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then
            System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }
        else
            Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' &amp; quantity.unit.value &amp; ' (' &amp; quantity.system.value &amp; '|' &amp; quantity.code.value &amp; ')')
    end</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="fhirhelpers-tocalendarunit"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToCalendarUnit(unit System.String):
    case unit
        when 'ms' then 'millisecond'
        when 's' then 'second'
        when 'min' then 'minute'
        when 'h' then 'hour'
        when 'd' then 'day'
        when 'wk' then 'week'
        when 'mo' then 'month'
        when 'a' then 'year'
        else unit
    end</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="fhirhelpers-tostring"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToString(value ImmunizationStatus): value.value</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="immzindicatorelements-getgeographicregionforimmunization"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> IMMZIndicatorElements</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/** 
 * @function
 * @param immunization The immunization record for which the location should be retrieved
 * @return FHIR.address The location that the immunization event occurred
 */
define function GetGeographicRegionForImmunization(immunization Immunization):
  (
    [Location] L
        where immunization.location.references(L)
  ).only().address.state</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="whocommon-only"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> WHOCommon</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define fluent function only(locations List&lt;Location&gt;):
  singleton from locations</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="whocommon-references"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> WHOCommon</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
@description: Returns true if the given reference is to the given resource
@comment: Returns true if the `id` element of the given resource exactly equals the tail of the given reference.
NOTE: This function assumes resources from the same source server.
*/
define fluent function references(reference FHIR.Reference, resource FHIR.Resource):
  resource.id = Last(Split(reference.reference, '/'))</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="fhirhelpers-tostring"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToString(value string): value.value</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="immzindicatorelements-getlocationnameforimmunization"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> IMMZIndicatorElements</td>

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/** 
 * @function
 * @param immunization The immunization record for which the location should be retrieved
 * @return FHIR.name The name of the location that the immunization event occurred
 */
define function GetLocationNameForImmunization(immunization Immunization):
  (
    [Location] L
        where immunization.location.references(L)
  ).only().name</code></pre>
  </td>

</tr>

  

<tr>
  <th colspan="2" scope="row" class="row-header">Generated using version 0.4.6 of the sample-content-ig Liquid templates</th>
</tr>
    </tbody>
  </table>
</div>
  </text>
  <contained>
    <Library>
      <id value="effective-data-requirements"/>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="IMMZIND45Logic"/>
        </extension>
        <extension url="name">
          <valueString value="Initial Population"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA; * As defined by Member State&#xA; */&#xA;define &quot;Initial Population&quot;:&#xA;  Immunization.occurrence is not null&#xA;  and Immunization.occurrence.toInterval() starts during &quot;Measurement Period&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="0"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="IMMZIND45Logic"/>
        </extension>
        <extension url="name">
          <valueString value="Denominator"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;@denominator: Number of planned immunization sessions at the vaccination location during the reporting period&#xA;@pseudocode: COUNT number of planned sessions during the reporting period&#xA;*/&#xA;define &quot;Denominator&quot;:&#xA;  &quot;Initial Population&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="1"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="IMMZIND45Logic"/>
        </extension>
        <extension url="name">
          <valueString value="Numerator"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;@numerator: Number of immunization sessions completed at the vaccination location during the reporting period&#xA;@pseudocode: COUNT of immunization events WHERE &quot;Immunization event status&quot; = &quot;Completed&quot; during the reporting period&#xA;*/&#xA;define &quot;Numerator&quot;:&#xA;  &quot;Denominator&quot;&#xA;    and Immunization.status = 'completed'"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="2"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="IMMZIND45Logic"/>
        </extension>
        <extension url="name">
          <valueString value="Stratification 2"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;Stratification 2&quot;:&#xA;  Elements.GetGeographicRegionForImmunization( Immunization )"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="3"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="IMMZIND45Logic"/>
        </extension>
        <extension url="name">
          <valueString value="Stratification 1"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;@disaggregation: Vaccination location&#xA;                 Administrative area&#xA;*/&#xA;define &quot;Stratification 1&quot;:&#xA;  Elements.GetLocationNameForImmunization( Immunization )"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="4"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="WHOCommon"/>
        </extension>
        <extension url="name">
          <valueString value="toInterval"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;From FHIRCommon 4.1.0:&#xA;*/&#xA;&#xA;/*&#xA;@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval&#xA;@comment: Normalizes a choice type of FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instance, FHIR.string, FHIR.Age, or FHIR.Range types&#xA;to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible&#xA;representations for timing-valued elements in FHIR, allowing this function to be used across any resource.&#xA;&#xA;The input can be provided as a dateTime, Period, Timing, instant, string, Age, or Range.&#xA;The intent of this function is to provide a clear and concise mechanism to treat single&#xA;elements that have multiple possible representations as intervals so that logic doesn't have to account&#xA;for the variability. More complex calculations (such as medication request period or dispense period&#xA;calculation) need specific guidance and consideration. That guidance may make use of this function, but&#xA;the focus of this function is on single element calculations where the semantics are unambiguous.&#xA;If the input is a dateTime, the result a DateTime Interval beginning and ending on that dateTime.&#xA;If the input is a Period, the result is a DateTime Interval.&#xA;If the input is a Timing, an error is raised indicating a single interval cannot be computed from a Timing.&#xA;If the input is an instant, the result is a DateTime Interval beginning and ending on that instant.&#xA;If the input is a string, an error is raised indicating a single interval cannot be computed from a string.&#xA;If the input is an Age, the result is a DateTime Interval beginning when the patient was the given Age,&#xA;and ending immediately prior to when the patient was the given Age plus one year.&#xA;If the input is a Range, the result is a DateTime Interval beginning when the patient was the Age given&#xA;by the low end of the Range, and ending immediately prior to when the patient was the Age given by the&#xA;high end of the Range plus one year.&#xA;&#xA;NOTE: Due to the&#xA;complexity of determining a single interval from a Timing or String type, this function will throw a run-time exception if it is used&#xA;with a Timing or String.&#xA;*/&#xA;define fluent function toInterval(choice Choice&lt;FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range&gt;):&#xA;  case&#xA;    when choice is FHIR.dateTime then&#xA;      Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]&#xA;    when choice is FHIR.Period then&#xA;      FHIRHelpers.ToInterval(choice as FHIR.Period)&#xA;    when choice is FHIR.instant then&#xA;      Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)]&#xA;    when choice is FHIR.Age then&#xA;      Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age),&#xA;        FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year)&#xA;    when choice is FHIR.Range then&#xA;      Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low),&#xA;        FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year)&#xA;    when choice is FHIR.Timing then&#xA;      Message(null as Interval&lt;DateTime&gt;, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported')&#xA;    when choice is FHIR.string then&#xA;      Message(null as Interval&lt;DateTime&gt;, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a String value is not supported')&#xA;    else&#xA;      null as Interval&lt;DateTime&gt;&#xA;  end"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="5"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToDateTime"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToDateTime(value dateTime): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="6"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToInterval"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToInterval(period FHIR.Period):&#xA;    if period is null then&#xA;        null&#xA;    else&#xA;        if period.&quot;start&quot; is null then&#xA;            Interval(period.&quot;start&quot;.value, period.&quot;end&quot;.value]&#xA;        else&#xA;            Interval[period.&quot;start&quot;.value, period.&quot;end&quot;.value]"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="7"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToDateTime"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToDateTime(value instant): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="8"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToDate"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToDate(value date): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="9"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToQuantity"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToQuantity(quantity FHIR.Quantity):&#xA;    case&#xA;        when quantity is null then null&#xA;        when quantity.value is null then null&#xA;        when quantity.comparator is not null then&#xA;            Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.')&#xA;        when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'&#xA;              or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then&#xA;            System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }&#xA;        else&#xA;            Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' &amp; quantity.unit.value &amp; ' (' &amp; quantity.system.value &amp; '|' &amp; quantity.code.value &amp; ')')&#xA;    end"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="10"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToCalendarUnit"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToCalendarUnit(unit System.String):&#xA;    case unit&#xA;        when 'ms' then 'millisecond'&#xA;        when 's' then 'second'&#xA;        when 'min' then 'minute'&#xA;        when 'h' then 'hour'&#xA;        when 'd' then 'day'&#xA;        when 'wk' then 'week'&#xA;        when 'mo' then 'month'&#xA;        when 'a' then 'year'&#xA;        else unit&#xA;    end"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="11"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToString"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToString(value ImmunizationStatus): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="12"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="IMMZIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="GetGeographicRegionForImmunization"/>
        </extension>
        <extension url="statement">
          <valueString value="/** &#xA; * @function&#xA; * @param immunization The immunization record for which the location should be retrieved&#xA; * @return FHIR.address The location that the immunization event occurred&#xA; */&#xA;define function GetGeographicRegionForImmunization(immunization Immunization):&#xA;  (&#xA;    [Location] L&#xA;        where immunization.location.references(L)&#xA;  ).only().address.state"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="13"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="WHOCommon"/>
        </extension>
        <extension url="name">
          <valueString value="only"/>
        </extension>
        <extension url="statement">
          <valueString value="define fluent function only(locations List&lt;Location&gt;):&#xA;  singleton from locations"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="14"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="WHOCommon"/>
        </extension>
        <extension url="name">
          <valueString value="references"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;@description: Returns true if the given reference is to the given resource&#xA;@comment: Returns true if the `id` element of the given resource exactly equals the tail of the given reference.&#xA;NOTE: This function assumes resources from the same source server.&#xA;*/&#xA;define fluent function references(reference FHIR.Reference, resource FHIR.Resource):&#xA;  resource.id = Last(Split(reference.reference, '/'))"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="15"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToString"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToString(value string): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="16"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="IMMZIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="GetLocationNameForImmunization"/>
        </extension>
        <extension url="statement">
          <valueString value="/** &#xA; * @function&#xA; * @param immunization The immunization record for which the location should be retrieved&#xA; * @return FHIR.name The name of the location that the immunization event occurred&#xA; */&#xA;define function GetLocationNameForImmunization(immunization Immunization):&#xA;  (&#xA;    [Location] L&#xA;        where immunization.location.references(L)&#xA;  ).only().name"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="17"/>
        </extension>
      </extension>
      <name value="EffectiveDataRequirements"/>
      <status value="active"/>
      <type>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/library-type"/>
          <code value="module-definition"/>
        </coding>
      </type>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="FHIR model information"/>
        <resource value="http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1"/>
      </relatedArtifact>
      <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 FHIRHelpers"/>
        <resource value="http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library Elements"/>
        <resource value="http://smart.who.int/immunizations/Library/IMMZIndicatorElements"/>
      </relatedArtifact>
      <parameter>
        <name value="Measurement Period"/>
        <use value="in"/>
        <min value="0"/>
        <max value="1"/>
        <type value="Period"/>
      </parameter>
      <parameter>
        <name value="Numerator"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="boolean"/>
      </parameter>
      <parameter>
        <name value="Stratification 2"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="string"/>
      </parameter>
      <parameter>
        <name value="Stratification 1"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="string"/>
      </parameter>
      <parameter>
        <name value="Denominator"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="boolean"/>
      </parameter>
      <parameter>
        <name value="Initial Population"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="boolean"/>
      </parameter>
      <dataRequirement>
        <type value="Immunization"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/Immunization"/>
        <mustSupport value="occurrence"/>
        <mustSupport value="status"/>
        <mustSupport value="location"/>
      </dataRequirement>
      <dataRequirement>
        <type value="Patient"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
        <mustSupport value="birthDate"/>
      </dataRequirement>
      <dataRequirement>
        <type value="Resource"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/Resource"/>
        <mustSupport value="id"/>
      </dataRequirement>
      <dataRequirement>
        <type value="Location"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/Location"/>
        <mustSupport value="address"/>
        <mustSupport value="address.state"/>
        <mustSupport value="name"/>
      </dataRequirement>
    </Library>
  </contained>
  <extension url="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements">
    <valueCanonical value="#effective-data-requirements"/>
  </extension>
  <url value="http://smart.who.int/immunizations/Measure/IMMZIND45"/>
  <version value="1.0.0"/>
  <name value="IMMZIND45"/>
  <title value="IMMZIND45"/>
  <status value="draft"/>
  <experimental value="false"/>
  <date value="2025-06-11"/>
  <publisher value="WHO"/>
  <contact>
    <name value="WHO"/>
    <telecom>
      <system value="url"/>
      <value value="http://who.int"/>
    </telecom>
  </contact>
  <description value="IMMZ.IND.45 Immunization session completion rate"/>
  <library value="http://smart.who.int/immunizations/Library/IMMZIND45Logic"/>
  <scoring>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/measure-scoring"/>
      <code value="proportion"/>
      <display value="Proportion"/>
    </coding>
  </scoring>
  <group>
    <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis">
      <valueCode value="boolean"/>
    </extension>
    <population id="IMMZ.IND.45.IP">
      <code>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-population"/>
          <code value="initial-population"/>
          <display value="Initial Population"/>
        </coding>
      </code>
      <description value="Initial Population"/>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Initial Population"/>
      </criteria>
    </population>
    <population id="IMMZ.IND.45.D">
      <code>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-population"/>
          <code value="denominator"/>
          <display value="Denominator"/>
        </coding>
      </code>
      <description value="Denominator"/>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Denominator"/>
      </criteria>
    </population>
    <population id="IMMZ.IND.45.N">
      <code>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-population"/>
          <code value="numerator"/>
          <display value="Numerator"/>
        </coding>
      </code>
      <description value="Numerator"/>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Numerator"/>
      </criteria>
    </population>
    <stratifier id="{idprefix}.S1">
      <code>
        <coding>
          <system value="http://smart.who.int/immunizations/CodeSystem/IMMZ.I"/>
          <code value="DE32"/>
          <display value="By-Administrative Area"/>
        </coding>
      </code>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Stratification 1"/>
      </criteria>
    </stratifier>
    <stratifier id="{idprefix}.S2">
      <code>
        <coding>
          <system value="http://smart.who.int/immunizations/CodeSystem/IMMZ.I"/>
          <code value="DE32"/>
          <display value="By-Administrative Area"/>
        </coding>
      </code>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Stratification 2"/>
      </criteria>
    </stratifier>
  </group>
</Measure>