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

<Measure xmlns="http://hl7.org/fhir">
  <id value="HIVIND21"/>
  <meta>
    <profile value="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/proportion-measure-cqfm"/>
    <profile value="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablemeasure"/>
    <profile value="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablemeasure"/>
  </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">HIVIND21</td>
</tr>


<tr>

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

<td class="content-container">HIV.IND.21 Linkage to ART</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">true</td>
</tr>


<tr>

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

<td class="content-container"><div><p>% of people newly diagnosed with HIV initiated on ART</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">0.4.4</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 scope="row" class="row-header">Improvement Notation</th>

<td class="content-container"><span title="Codes:{http://terminology.hl7.org/CodeSystem/measure-improvement-notation increase}">Increased score indicates improvement</span></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 Population Criteria</th>

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

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

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

      
      <td class="content-container">
        
        <em>ID</em>: HIV.IND.21.DEN
        <br/>
        
        
          <em>Description</em>:
          <p style="white-space: pre-line" class="tab-one">Number of people newly diagnosed with HIV during the reporting period</p>
        
        
          
            
            <em>Logic Definition</em>: <a href="#hivind21logic-denominator">Denominator</a> 
          
        
      </td>
    </tr>
  

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

      
      <td class="content-container">
        
        <em>ID</em>: HIV.IND.21.NUM
        <br/>
        
        
          <em>Description</em>:
          <p style="white-space: pre-line" class="tab-one">Number of people newly diagnosed with HIV and started on ART during the reporting period</p>
        
        
          
            
            <em>Logic Definition</em>: <a href="#hivind21logic-numerator">Numerator</a> 
          
        
      </td>
    </tr>
  

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

  <td class="content-container">
    
      <em>ID</em>: HIV.IND.21.S
      
    
    
    
  </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-HIVIND21Logic.html">HIV.IND.21 Logic</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 HIE
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="Library-HIVIndicatorElements.html">HIVIndicatorElements</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://smart.who.int/hiv/Library/HIVIndicatorElements</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 Concepts
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <code>http://smart.who.int/hiv/Library/HIVConcepts|0.0.2</code>
    <br/>
    <em>Canonical URL</em>: <tt>http://smart.who.int/hiv/Library/HIVConcepts|0.0.2</tt>
    
  </td>
</tr>

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

  
  <td class="content-container">
    
    <em>Description</em>: Library HE
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="Library-HIVElements.html">HIVElements</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://smart.who.int/hiv/Library/HIVElements</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/hiv/Library/WHOCommon</tt>
    
  </td>
</tr>

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

  
  <td class="content-container">
    
    <em>Description</em>: Library ConceptsCustom
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <code>http://smart.who.int/hiv/Library/HIVConceptsCustom|0.0.1</code>
    <br/>
    <em>Canonical URL</em>: <tt>http://smart.who.int/hiv/Library/HIVConceptsCustom|0.0.1</tt>
    
  </td>
</tr>

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

  
  <td class="content-container">
    
    <em>Description</em>: Code system HIVConcepts
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="CodeSystem-HIVConcepts.html">WHO SMART HIV Concepts CodeSystem</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    
  </td>
</tr>

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

  
  <td class="content-container">
    
    <em>Description</em>: Code system ConditionClinicalStatusCodes
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="http://terminology.hl7.org/6.1.0/CodeSystem-condition-clinical.html">Condition Clinical Status Codes</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-clinical</tt>
    
  </td>
</tr>

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

  
  <td class="content-container">
    
    <em>Description</em>: Code system ConditionCategoryCodes
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="http://terminology.hl7.org/6.1.0/CodeSystem-condition-category.html">Condition Category Codes</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-category</tt>
    
  </td>
</tr>

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

  
  <td class="content-container">
    
    <em>Description</em>: Code system ObservationCategoryCodes
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="http://terminology.hl7.org/6.1.0/CodeSystem-observation-category.html">Observation Category Codes</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/observation-category</tt>
    
  </td>
</tr>


  
  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Male
        <br/>
      
      <em>Code</em>: HIV.A.DE20
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Female
        <br/>
      
      <em>Code</em>: HIV.A.DE19
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Transgender female
        <br/>
      
      <em>Code</em>: HIV.A.DE22
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Transgender male
        <br/>
      
      <em>Code</em>: HIV.A.DE21
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Other
        <br/>
      
      <em>Code</em>: HIV.A.DE23
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: On ART
        <br/>
      
      <em>Code</em>: HIV.H.DE47
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
      <em>Code</em>: active
      <br/>
      <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-clinical</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Encounter Diagnosis
        <br/>
      
      <em>Code</em>: encounter-diagnosis
      <br/>
      <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-category</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: HIV-positive
        <br/>
      
      <em>Code</em>: HIV.B.DE116
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Within 7 days of HIV diagnosis
        <br/>
      
      <em>Code</em>: HIV.D.DE384
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Within 30 days of HIV diagnosis
        <br/>
      
      <em>Code</em>: HIV.D.DE385
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Within 90 days of HIV diagnosis
        <br/>
      
      <em>Code</em>: HIV.D.DE386
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Key population member*
        <br/>
      
      <em>Code</em>: HIV.B.DE49
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Social History
        <br/>
      
      <em>Code</em>: social-history
      <br/>
      <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/observation-category</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: TB diagnosis result
        <br/>
      
      <em>Code</em>: HIV.D.DE939
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Diagnosed TB
        <br/>
      
      <em>Code</em>: HIV.D.DE940
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Presumptive TB
        <br/>
      
      <em>Code</em>: HIV.D.DE945
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</tt>
    </td>
  </tr>

  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: TB excluded
        <br/>
      
      <em>Code</em>: HIV.D.DE941
      <br/>
      <em>System</em>: <tt>http://smart.who.int/hiv/CodeSystem/HIVConcepts</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>: 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 scope="row" class="row-header">Parameter</th>

  <td class="content-container">
    <em>Name</em>: Stratification
    <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 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>: Patient
    <br/>
  
    <em>Profile(s)</em>: 
  
    <a href="http://hl7.org/fhir/R4/patient.html">Patient</a>
    <br/>        
  
   
   
    <em>Must Support Elements</em>: use
    <br/>
   
   
  </td>
</tr>

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

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

<tr>
  <th scope="row" class="row-header">Data Requirement</th>
  <td class="content-container">
    <em>Type</em>: Observation
    <br/>
  
    <em>Profile(s)</em>: 
  
    <a href="http://hl7.org/fhir/R4/observation.html">Observation</a>
    <br/>        
  
   
   
    <em>Must Support Elements</em>: code, status, category, effective, issued, code.coding
    <br/>
   
  
    <em>Code Filter(s)</em>: 
    <br/>
  
  
    <span class="tab-one"><em>Path</em>: code</span>
    <br/>
  
  
  
  
    <span class="tab-one"><em>Code</em>: </span>
    <br/>
  
  
   
  </td>
</tr>

<tr>
  <th scope="row" class="row-header">Data Requirement</th>
  <td class="content-container">
    <em>Type</em>: Observation
    <br/>
  
    <em>Profile(s)</em>: 
  
    <a href="http://hl7.org/fhir/R4/observation.html">Observation</a>
    <br/>        
  
   
   
    <em>Must Support Elements</em>: code, status, value, effective
    <br/>
   
  
    <em>Code Filter(s)</em>: 
    <br/>
  
  
    <span class="tab-one"><em>Path</em>: code</span>
    <br/>
  
  
  
  
    <span class="tab-one"><em>Code</em>: </span>
    <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="hivind21logic-initial-population"> </a>
    
    Logic Definition
  </th>

  <td class="content-container"><em>Library Name:</em> HIVIND21Logic</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;:
  true</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivindicatorelements-by-administrative-gender-stratifier"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
@dataElement: HIV.A.DE18 - Gender
@activity: HIV.A6.1 Review sociodemographic data with client | HIV.A5 Create new client record
@description: Gender of the client
*/

/*
 * By Administrative Gender of Patient Stratifier
 * Need to expand codes
 */

define &quot;By Administrative Gender Stratifier&quot;:
  case 
      when Patient.gender = 'male' then Concepts.&quot;Male&quot;
      when Patient.gender = 'female' then Concepts.&quot;Female&quot;
      when Patient.gender = 'transgender female' then Concepts.&quot;Transgender female&quot;
      when Patient.gender = 'transgender male' then Concepts.&quot;Transgender male&quot;
      else Concepts.&quot;Other - HIV.A.DE23&quot;
  end</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivelements-on-art-h.de47"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of Refused stopped treatment */

/*
@dataElement: HIV.H.DE47 - On ART
@activity: HIV.H3 Record outreach and result
@description: Client is currently taking ART 
*/

define &quot;On ART H.DE47&quot;:
    [MedicationStatement] MS
    where exists(MS.reasonCode C where C ~ Concepts.&quot;On ART - HIV.H.DE47&quot;)
    sort by start of effective.toInterval()</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivelements-first-hiv-treatment"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;First HIV Treatment&quot;:
  First(&quot;On ART H.DE47&quot;)</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivelements-hiv-positive-condition"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;HIV Positive Condition&quot;:
[Condition] C
    where C.clinicalStatus ~ ConceptsCustom.&quot;active&quot;
    and exists(C.category CC where CC ~ ConceptsCustom.&quot;encounter-diagnosis&quot;)
    and C.code ~ Concepts.&quot;HIV-positive - HIV.B.DE116&quot;
    sort by start of onset.toInterval()</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivelements-first-hiv-positive-condition"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;First HIV Positive Condition&quot;:
  First(&quot;HIV Positive Condition&quot;)</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivelements-time-to-start-art"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of Date of baseline CD4 count test D.DE368 */

/*
@dataElement: HIV.D.DE383 - Time to start ART
@activity: HIV.D8 Capture or update client history
@description: Time from HIV diagnosis to when client started ART
*/
define &quot;Time to start ART&quot;:
  case 
      when difference in days between start of &quot;First HIV Treatment&quot;.effective.toInterval() and start of &quot;First HIV Positive Condition&quot;.onset.toInterval() &lt;= 7 then Concepts.&quot;Within 7 days of HIV diagnosis&quot;
      when difference in days between start of &quot;First HIV Treatment&quot;.effective.toInterval() and start of &quot;First HIV Positive Condition&quot;.onset.toInterval() &lt;= 30 then Concepts.&quot;Within 30 days of HIV diagnosis&quot;
      when difference in days between start of &quot;First HIV Treatment&quot;.effective.toInterval() and start of &quot;First HIV Positive Condition&quot;.onset.toInterval() &lt;= 90 then Concepts.&quot;Within 90 days of HIV diagnosis&quot;
  else null
  end</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivindicatorelements-age-in-years"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of Visit date A.DE3 */

/*
@dataElement: HIV.A.DE17 - Age
@activity: HIV.A6.1 Review sociodemographic data with client | HIV.A5 Create new client record
@description: Calculated age (number of years) of the client based on date of birth
*/
define &quot;Age In Years&quot;:
  AgeInYearsAt(start of &quot;Measurement Period&quot;)</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivindicatorelements-by-age-stratifier"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
 * By Age Stratifiers
 * (0–4, 5–9, 10–14, 15–19, 20–24, 25–29, 30–34, 35–39, 40–44, 45–49, 50+ years)
 * 
 */
define &quot;By Age Stratifier&quot;:
  case 
      when &quot;Age In Years&quot; &lt;= 4 then '0-4'
      when &quot;Age In Years&quot; &lt;= 9 then '5-9'
      when &quot;Age In Years&quot; &lt;= 14 then '10–14'
      when &quot;Age In Years&quot; &lt;= 19 then '15–19'
      when &quot;Age In Years&quot; &lt;= 24 then '20–24'
      when &quot;Age In Years&quot; &lt;= 29 then '25–29'
      when &quot;Age In Years&quot; &lt;= 34 then '30–34'
      when &quot;Age In Years&quot; &lt;= 39 then '35–39'
      when &quot;Age In Years&quot; &lt;= 44 then '40–44'
      when &quot;Age In Years&quot; &lt;= 49 then '45–49'
      when &quot;Age In Years&quot; &gt;= 50 then '50+'
      else null
  end</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivindicatorelements-by-geographic-region-stratifier"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">// Geographic Region
define &quot;By Geographic Region Stratifier&quot;:
    First(Patient.address A where A.use in { 'home' }).state</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivelements-key-population-member-type-observation"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of Key population member B.DE49 */

/*
@dataElement: HIV.B.DE50 - Key population member type
@activity: HIV.B6 Capture or update client history
@description: The type of key population that the client is included in
*/
define &quot;Key population member type Observation&quot;:
  [Observation: Concepts.&quot;Key population member - HIV.B.DE49&quot;] O
    where O.status in { 'final', 'amended', 'corrected' }
    and exists(O.category OC where OC ~ ConceptsCustom.&quot;social-history&quot;)</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivindicatorelements-key-population-member-type-observation"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Key population member type Observation&quot;:
  Elements.&quot;Key population member type Observation&quot; O
    where O.effective.toInterval() before end of &quot;Measurement Period&quot;
    or O.issued before end of &quot;Measurement Period&quot;</code></pre>
  </td>

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

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">// Stratifier
define patientGroups:
  &quot;Key population member type Observation&quot; O
  return Combine(O.code.coding.code, ':')</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivelements-tb-diagnosis-result"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of Extrapulmonary TB D.DE937 */

/*
@dataElement: HIV.D.DE939 - TB diagnosis result
@activity: HIV.D8 Capture or update client history
@description: Final result of the TB investigation (bacteriological and/or clinical)
*/

define &quot;TB diagnosis result&quot;:
  [Observation: Concepts.&quot;TB diagnosis result&quot;] O
    where O.status in { 'final', 'amended', 'corrected' }</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivelements-diagnosed-tb"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of TB diagnosis result */

/*
@dataElement: HIV.D.DE940 - Diagnosed TB
@activity: HIV.D8 Capture or update client history
@description: Client is diagnosed with TB disease
*/

define &quot;Diagnosed TB&quot;:
  &quot;TB diagnosis result&quot; O
    where O.status in { 'final', 'amended', 'corrected' }
      and O.value ~ Concepts.&quot;Diagnosed TB&quot;</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivindicatorelements-diagnosed-tb"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of TB diagnosis result */

/*
@dataElement: HIV.D.DE940 - Diagnosed TB
@activity: HIV.D8 Capture or update client history
@description: Client is diagnosed with TB disease
*/

define &quot;Diagnosed TB&quot;:
  exists Elements.&quot;Diagnosed TB&quot; O
    where O.effective.toInterval() during &quot;Measurement Period&quot;</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivelements-presumptive-tb-d.de945"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of TB excluded */

/*
@dataElement: HIV.D.DE945 - Presumptive TB
@activity: HIV.D8 Capture or update client history
@description: Client has signs or symptoms of tuberculosis (TB) without laboratory confirmation
*/

define &quot;Presumptive TB D.DE945&quot;:
  &quot;TB diagnosis result&quot; O
    where O.status in { 'final', 'amended', 'corrected' }
      and O.value ~ Concepts.&quot;Presumptive TB - HIV.D.DE945&quot;</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivindicatorelements-presumptive-tb-d.de945"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of TB excluded */

/*
@dataElement: HIV.D.DE945 - Presumptive TB
@activity: HIV.D8 Capture or update client history
@description: Client has signs or symptoms of tuberculosis (TB) without laboratory confirmation
*/

define &quot;Presumptive TB D.DE945&quot;:
  exists Elements.&quot;Presumptive TB D.DE945&quot; O
    where O.effective.toInterval() during &quot;Measurement Period&quot;</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivelements-tb-excluded"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of Diagnosed TB */

/*
@dataElement: HIV.D.DE941 - TB excluded
@activity: HIV.D8 Capture or update client history
@description: Client is not diagnosed with TB
*/

define &quot;TB excluded&quot;:
  &quot;TB diagnosis result&quot; O
    where O.status in { 'final', 'amended', 'corrected' }
      and O.value ~ Concepts.&quot;TB excluded&quot;</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="hivindicatorelements-tb-excluded"> </a>
    
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/* End of Diagnosed TB */

/*
@dataElement: HIV.D.DE941 - TB excluded
@activity: HIV.D8 Capture or update client history
@description: Client is not diagnosed with TB
*/

define &quot;TB excluded&quot;:
  exists Elements.&quot;TB excluded&quot; O
    where O.effective.toInterval() during &quot;Measurement Period&quot;</code></pre>
  </td>

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

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define tb:
  case 
      when &quot;Diagnosed TB&quot;  then Concepts.&quot;Diagnosed TB&quot;
      when &quot;Presumptive TB D.DE945&quot; then Concepts.&quot;Presumptive TB - HIV.D.DE945&quot;
      when &quot;TB excluded&quot; then Concepts.&quot;TB excluded&quot;
      else null
  end</code></pre>
  </td>

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

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

</tr>
<tr>

  <td>
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Stratification&quot;:
 HIE.&quot;By Administrative Gender Stratifier&quot;.code 
 + ':' + HE.&quot;Time to start ART&quot;.code
  + ':' + HIE.&quot;By Age Stratifier&quot;
+ ':' + HIE.&quot;By Geographic Region Stratifier&quot;
+ Combine(HIE.patientGroups, ':')
+ ':' + HIE.&quot;tb&quot;.code</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 AdministrativeGender): value.value</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="fhirhelpers-toconcept"> </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 ToConcept(concept FHIR.CodeableConcept):
    if concept is null then
        null
    else
        System.Concept {
            codes: concept.coding C return ToCode(C),
            display: concept.text.value
        }</code></pre>
  </td>

</tr>
        
<tr>
  <th scope="row" rowspan="2" class="row-header">
    
      
      <a name="fhirhelpers-tocode"> </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 ToCode(coding FHIR.Coding):
    if coding is null then
        null
    else
        System.Code {
          code: coding.code.value,
          system: coding.system.value,
          version: coding.version.value,
          display: coding.display.value
        }</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="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 AddressUse): value.value</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 ObservationStatus): value.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 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-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.A.DE20"/>
          <display value="Male"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.A.DE19"/>
          <display value="Female"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.A.DE22"/>
          <display value="Transgender female"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.A.DE21"/>
          <display value="Transgender male"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.A.DE23"/>
          <display value="Other"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.H.DE47"/>
          <display value="On ART"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
          <code value="active"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://terminology.hl7.org/CodeSystem/condition-category"/>
          <code value="encounter-diagnosis"/>
          <display value="Encounter Diagnosis"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.B.DE116"/>
          <display value="HIV-positive"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.D.DE384"/>
          <display value="Within 7 days of HIV diagnosis"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.D.DE385"/>
          <display value="Within 30 days of HIV diagnosis"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.D.DE386"/>
          <display value="Within 90 days of HIV diagnosis"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.B.DE49"/>
          <display value="Key population member*"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://terminology.hl7.org/CodeSystem/observation-category"/>
          <code value="social-history"/>
          <display value="Social History"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.D.DE939"/>
          <display value="TB diagnosis result"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.D.DE940"/>
          <display value="Diagnosed TB"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.D.DE945"/>
          <display value="Presumptive TB"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
        <valueCoding>
          <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
          <code value="HIV.D.DE941"/>
          <display value="TB excluded"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIND21Logic"/>
        </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;  true"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="0"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="By Administrative Gender Stratifier"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;@dataElement: HIV.A.DE18 - Gender&#xA;@activity: HIV.A6.1 Review sociodemographic data with client | HIV.A5 Create new client record&#xA;@description: Gender of the client&#xA;*/&#xA;&#xA;/*&#xA; * By Administrative Gender of Patient Stratifier&#xA; * Need to expand codes&#xA; */&#xA;&#xA;define &quot;By Administrative Gender Stratifier&quot;:&#xA;  case &#xA;      when Patient.gender = 'male' then Concepts.&quot;Male&quot;&#xA;      when Patient.gender = 'female' then Concepts.&quot;Female&quot;&#xA;      when Patient.gender = 'transgender female' then Concepts.&quot;Transgender female&quot;&#xA;      when Patient.gender = 'transgender male' then Concepts.&quot;Transgender male&quot;&#xA;      else Concepts.&quot;Other - HIV.A.DE23&quot;&#xA;  end"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="1"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVElements"/>
        </extension>
        <extension url="name">
          <valueString value="On ART H.DE47"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of Refused stopped treatment */&#xA;&#xA;/*&#xA;@dataElement: HIV.H.DE47 - On ART&#xA;@activity: HIV.H3 Record outreach and result&#xA;@description: Client is currently taking ART &#xA;*/&#xA;&#xA;define &quot;On ART H.DE47&quot;:&#xA;    [MedicationStatement] MS&#xA;    where exists(MS.reasonCode C where C ~ Concepts.&quot;On ART - HIV.H.DE47&quot;)&#xA;    sort by start of effective.toInterval()"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="2"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVElements"/>
        </extension>
        <extension url="name">
          <valueString value="First HIV Treatment"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;First HIV Treatment&quot;:&#xA;  First(&quot;On ART H.DE47&quot;)"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="3"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVElements"/>
        </extension>
        <extension url="name">
          <valueString value="HIV Positive Condition"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;HIV Positive Condition&quot;:&#xA;[Condition] C&#xA;    where C.clinicalStatus ~ ConceptsCustom.&quot;active&quot;&#xA;    and exists(C.category CC where CC ~ ConceptsCustom.&quot;encounter-diagnosis&quot;)&#xA;    and C.code ~ Concepts.&quot;HIV-positive - HIV.B.DE116&quot;&#xA;    sort by start of onset.toInterval()"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="4"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVElements"/>
        </extension>
        <extension url="name">
          <valueString value="First HIV Positive Condition"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;First HIV Positive Condition&quot;:&#xA;  First(&quot;HIV Positive Condition&quot;)"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="5"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVElements"/>
        </extension>
        <extension url="name">
          <valueString value="Time to start ART"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of Date of baseline CD4 count test D.DE368 */&#xA;&#xA;/*&#xA;@dataElement: HIV.D.DE383 - Time to start ART&#xA;@activity: HIV.D8 Capture or update client history&#xA;@description: Time from HIV diagnosis to when client started ART&#xA;*/&#xA;define &quot;Time to start ART&quot;:&#xA;  case &#xA;      when difference in days between start of &quot;First HIV Treatment&quot;.effective.toInterval() and start of &quot;First HIV Positive Condition&quot;.onset.toInterval() &lt;= 7 then Concepts.&quot;Within 7 days of HIV diagnosis&quot;&#xA;      when difference in days between start of &quot;First HIV Treatment&quot;.effective.toInterval() and start of &quot;First HIV Positive Condition&quot;.onset.toInterval() &lt;= 30 then Concepts.&quot;Within 30 days of HIV diagnosis&quot;&#xA;      when difference in days between start of &quot;First HIV Treatment&quot;.effective.toInterval() and start of &quot;First HIV Positive Condition&quot;.onset.toInterval() &lt;= 90 then Concepts.&quot;Within 90 days of HIV diagnosis&quot;&#xA;  else null&#xA;  end"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="6"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="Age In Years"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of Visit date A.DE3 */&#xA;&#xA;/*&#xA;@dataElement: HIV.A.DE17 - Age&#xA;@activity: HIV.A6.1 Review sociodemographic data with client | HIV.A5 Create new client record&#xA;@description: Calculated age (number of years) of the client based on date of birth&#xA;*/&#xA;define &quot;Age In Years&quot;:&#xA;  AgeInYearsAt(start of &quot;Measurement Period&quot;)"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="7"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="By Age Stratifier"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA; * By Age Stratifiers&#xA; * (0–4, 5–9, 10–14, 15–19, 20–24, 25–29, 30–34, 35–39, 40–44, 45–49, 50+ years)&#xA; * &#xA; */&#xA;define &quot;By Age Stratifier&quot;:&#xA;  case &#xA;      when &quot;Age In Years&quot; &lt;= 4 then '0-4'&#xA;      when &quot;Age In Years&quot; &lt;= 9 then '5-9'&#xA;      when &quot;Age In Years&quot; &lt;= 14 then '10–14'&#xA;      when &quot;Age In Years&quot; &lt;= 19 then '15–19'&#xA;      when &quot;Age In Years&quot; &lt;= 24 then '20–24'&#xA;      when &quot;Age In Years&quot; &lt;= 29 then '25–29'&#xA;      when &quot;Age In Years&quot; &lt;= 34 then '30–34'&#xA;      when &quot;Age In Years&quot; &lt;= 39 then '35–39'&#xA;      when &quot;Age In Years&quot; &lt;= 44 then '40–44'&#xA;      when &quot;Age In Years&quot; &lt;= 49 then '45–49'&#xA;      when &quot;Age In Years&quot; &gt;= 50 then '50+'&#xA;      else null&#xA;  end"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="8"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="By Geographic Region Stratifier"/>
        </extension>
        <extension url="statement">
          <valueString value="// Geographic Region&#xA;define &quot;By Geographic Region Stratifier&quot;:&#xA;    First(Patient.address A where A.use in { 'home' }).state"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="9"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVElements"/>
        </extension>
        <extension url="name">
          <valueString value="Key population member type Observation"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of Key population member B.DE49 */&#xA;&#xA;/*&#xA;@dataElement: HIV.B.DE50 - Key population member type&#xA;@activity: HIV.B6 Capture or update client history&#xA;@description: The type of key population that the client is included in&#xA;*/&#xA;define &quot;Key population member type Observation&quot;:&#xA;  [Observation: Concepts.&quot;Key population member - HIV.B.DE49&quot;] O&#xA;    where O.status in { 'final', 'amended', 'corrected' }&#xA;    and exists(O.category OC where OC ~ ConceptsCustom.&quot;social-history&quot;)"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="10"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="Key population member type Observation"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;Key population member type Observation&quot;:&#xA;  Elements.&quot;Key population member type Observation&quot; O&#xA;    where O.effective.toInterval() before end of &quot;Measurement Period&quot;&#xA;    or O.issued before end of &quot;Measurement Period&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="11"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="patientGroups"/>
        </extension>
        <extension url="statement">
          <valueString value="// Stratifier&#xA;define patientGroups:&#xA;  &quot;Key population member type Observation&quot; O&#xA;  return Combine(O.code.coding.code, ':')"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="12"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVElements"/>
        </extension>
        <extension url="name">
          <valueString value="TB diagnosis result"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of Extrapulmonary TB D.DE937 */&#xA;&#xA;/*&#xA;@dataElement: HIV.D.DE939 - TB diagnosis result&#xA;@activity: HIV.D8 Capture or update client history&#xA;@description: Final result of the TB investigation (bacteriological and/or clinical)&#xA;*/&#xA;&#xA;define &quot;TB diagnosis result&quot;:&#xA;  [Observation: Concepts.&quot;TB diagnosis result&quot;] O&#xA;    where O.status in { 'final', 'amended', 'corrected' }"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="13"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVElements"/>
        </extension>
        <extension url="name">
          <valueString value="Diagnosed TB"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of TB diagnosis result */&#xA;&#xA;/*&#xA;@dataElement: HIV.D.DE940 - Diagnosed TB&#xA;@activity: HIV.D8 Capture or update client history&#xA;@description: Client is diagnosed with TB disease&#xA;*/&#xA;&#xA;define &quot;Diagnosed TB&quot;:&#xA;  &quot;TB diagnosis result&quot; O&#xA;    where O.status in { 'final', 'amended', 'corrected' }&#xA;      and O.value ~ Concepts.&quot;Diagnosed TB&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="14"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="Diagnosed TB"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of TB diagnosis result */&#xA;&#xA;/*&#xA;@dataElement: HIV.D.DE940 - Diagnosed TB&#xA;@activity: HIV.D8 Capture or update client history&#xA;@description: Client is diagnosed with TB disease&#xA;*/&#xA;&#xA;define &quot;Diagnosed TB&quot;:&#xA;  exists Elements.&quot;Diagnosed TB&quot; O&#xA;    where O.effective.toInterval() during &quot;Measurement Period&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="15"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVElements"/>
        </extension>
        <extension url="name">
          <valueString value="Presumptive TB D.DE945"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of TB excluded */&#xA;&#xA;/*&#xA;@dataElement: HIV.D.DE945 - Presumptive TB&#xA;@activity: HIV.D8 Capture or update client history&#xA;@description: Client has signs or symptoms of tuberculosis (TB) without laboratory confirmation&#xA;*/&#xA;&#xA;define &quot;Presumptive TB D.DE945&quot;:&#xA;  &quot;TB diagnosis result&quot; O&#xA;    where O.status in { 'final', 'amended', 'corrected' }&#xA;      and O.value ~ Concepts.&quot;Presumptive TB - HIV.D.DE945&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="16"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="Presumptive TB D.DE945"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of TB excluded */&#xA;&#xA;/*&#xA;@dataElement: HIV.D.DE945 - Presumptive TB&#xA;@activity: HIV.D8 Capture or update client history&#xA;@description: Client has signs or symptoms of tuberculosis (TB) without laboratory confirmation&#xA;*/&#xA;&#xA;define &quot;Presumptive TB D.DE945&quot;:&#xA;  exists Elements.&quot;Presumptive TB D.DE945&quot; O&#xA;    where O.effective.toInterval() during &quot;Measurement Period&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="17"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVElements"/>
        </extension>
        <extension url="name">
          <valueString value="TB excluded"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of Diagnosed TB */&#xA;&#xA;/*&#xA;@dataElement: HIV.D.DE941 - TB excluded&#xA;@activity: HIV.D8 Capture or update client history&#xA;@description: Client is not diagnosed with TB&#xA;*/&#xA;&#xA;define &quot;TB excluded&quot;:&#xA;  &quot;TB diagnosis result&quot; O&#xA;    where O.status in { 'final', 'amended', 'corrected' }&#xA;      and O.value ~ Concepts.&quot;TB excluded&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="18"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="TB excluded"/>
        </extension>
        <extension url="statement">
          <valueString value="/* End of Diagnosed TB */&#xA;&#xA;/*&#xA;@dataElement: HIV.D.DE941 - TB excluded&#xA;@activity: HIV.D8 Capture or update client history&#xA;@description: Client is not diagnosed with TB&#xA;*/&#xA;&#xA;define &quot;TB excluded&quot;:&#xA;  exists Elements.&quot;TB excluded&quot; O&#xA;    where O.effective.toInterval() during &quot;Measurement Period&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="19"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIndicatorElements"/>
        </extension>
        <extension url="name">
          <valueString value="tb"/>
        </extension>
        <extension url="statement">
          <valueString value="define tb:&#xA;  case &#xA;      when &quot;Diagnosed TB&quot;  then Concepts.&quot;Diagnosed TB&quot;&#xA;      when &quot;Presumptive TB D.DE945&quot; then Concepts.&quot;Presumptive TB - HIV.D.DE945&quot;&#xA;      when &quot;TB excluded&quot; then Concepts.&quot;TB excluded&quot;&#xA;      else null&#xA;  end"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="20"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="HIVIND21Logic"/>
        </extension>
        <extension url="name">
          <valueString value="Stratification"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;Stratification&quot;:&#xA; HIE.&quot;By Administrative Gender Stratifier&quot;.code &#xA; + ':' + HE.&quot;Time to start ART&quot;.code&#xA;  + ':' + HIE.&quot;By Age Stratifier&quot;&#xA;+ ':' + HIE.&quot;By Geographic Region Stratifier&quot;&#xA;+ Combine(HIE.patientGroups, ':')&#xA;+ ':' + HIE.&quot;tb&quot;.code"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="21"/>
        </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 AdministrativeGender): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="22"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToConcept"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToConcept(concept FHIR.CodeableConcept):&#xA;    if concept is null then&#xA;        null&#xA;    else&#xA;        System.Concept {&#xA;            codes: concept.coding C return ToCode(C),&#xA;            display: concept.text.value&#xA;        }"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="23"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToCode"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToCode(coding FHIR.Coding):&#xA;    if coding is null then&#xA;        null&#xA;    else&#xA;        System.Code {&#xA;          code: coding.code.value,&#xA;          system: coding.system.value,&#xA;          version: coding.version.value,&#xA;          display: coding.display.value&#xA;        }"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="24"/>
        </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="25"/>
        </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 AddressUse): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="26"/>
        </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 ObservationStatus): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="27"/>
        </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="28"/>
        </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 HIE"/>
        <resource value="http://smart.who.int/hiv/Library/HIVIndicatorElements"/>
      </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 Concepts"/>
        <resource value="http://smart.who.int/hiv/Library/HIVConcepts|0.0.2"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library HE"/>
        <resource value="http://smart.who.int/hiv/Library/HIVElements"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library WC"/>
        <resource value="http://smart.who.int/hiv/Library/WHOCommon"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library ConceptsCustom"/>
        <resource value="http://smart.who.int/hiv/Library/HIVConceptsCustom|0.0.1"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Code system HIVConcepts"/>
        <resource value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Code system ConditionClinicalStatusCodes"/>
        <resource value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Code system ConditionCategoryCodes"/>
        <resource value="http://terminology.hl7.org/CodeSystem/condition-category"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Code system ObservationCategoryCodes"/>
        <resource value="http://terminology.hl7.org/CodeSystem/observation-category"/>
      </relatedArtifact>
      <parameter>
        <name value="Measurement Period"/>
        <use value="in"/>
        <min value="0"/>
        <max value="1"/>
        <type value="Period"/>
      </parameter>
      <parameter>
        <name value="Initial Population"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="boolean"/>
      </parameter>
      <parameter>
        <name value="Stratification"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="string"/>
      </parameter>
      <dataRequirement>
        <type value="Patient"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
        <mustSupport value="use"/>
      </dataRequirement>
      <dataRequirement>
        <type value="MedicationStatement"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/MedicationStatement"/>
        <mustSupport value="reasonCode"/>
      </dataRequirement>
      <dataRequirement>
        <type value="Condition"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/Condition"/>
        <mustSupport value="clinicalStatus"/>
        <mustSupport value="category"/>
        <mustSupport value="code"/>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/Observation"/>
        <mustSupport value="code"/>
        <mustSupport value="status"/>
        <mustSupport value="category"/>
        <mustSupport value="effective"/>
        <mustSupport value="issued"/>
        <mustSupport value="code.coding"/>
        <codeFilter>
          <path value="code"/>
          <code>
            <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
            <code value="HIV.B.DE49"/>
            <display value="Key population member*"/>
          </code>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/Observation"/>
        <mustSupport value="code"/>
        <mustSupport value="status"/>
        <mustSupport value="value"/>
        <mustSupport value="effective"/>
        <codeFilter>
          <path value="code"/>
          <code>
            <system value="http://smart.who.int/hiv/CodeSystem/HIVConcepts"/>
            <code value="HIV.D.DE939"/>
            <display value="TB diagnosis result"/>
          </code>
        </codeFilter>
      </dataRequirement>
    </Library>
  </contained>
  <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis">
    <valueCode value="boolean"/>
  </extension>
  <extension url="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements">
    <valueCanonical value="#effective-data-requirements"/>
  </extension>
  <url value="http://smart.who.int/hiv/Measure/HIVIND21"/>
  <version value="0.4.4"/>
  <name value="HIVIND21"/>
  <title value="HIV.IND.21 Linkage to ART"/>
  <status value="draft"/>
  <experimental value="true"/>
  <date value="2024-08-18"/>
  <publisher value="WHO"/>
  <contact>
    <name value="WHO"/>
    <telecom>
      <system value="url"/>
      <value value="http://who.int"/>
    </telecom>
  </contact>
  <description value="% of people newly diagnosed with HIV initiated on ART"/>
  <library value="http://smart.who.int/hiv/Library/HIVIND21Logic"/>
  <scoring>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/measure-scoring"/>
      <code value="proportion"/>
      <display value="Proportion"/>
    </coding>
  </scoring>
  <improvementNotation>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/measure-improvement-notation"/>
      <code value="increase"/>
    </coding>
  </improvementNotation>
  <group>
    <population id="HIV.IND.21.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="HIV.IND.21.DEN">
      <code>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-population"/>
          <code value="denominator"/>
          <display value="Denominator"/>
        </coding>
      </code>
      <description value="Number of people newly diagnosed with HIV during the reporting period"/>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Denominator"/>
      </criteria>
    </population>
    <population id="HIV.IND.21.NUM">
      <code>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-population"/>
          <code value="numerator"/>
          <display value="Numerator"/>
        </coding>
      </code>
      <description value="Number of people newly diagnosed with HIV and started on ART during the reporting period"/>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Numerator"/>
      </criteria>
    </population>
    <stratifier id="HIV.IND.21.S">
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Stratification"/>
      </criteria>
    </stratifier>
  </group>
</Measure>