Quality Measure Implementation Guide
2.0.0 - STU 2 International flag

Quality Measure Implementation Guide, published by HL7 International / Clinical Quality Information. This guide is not an authorized publication; it is the continuous build for version 2.0.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-cqm/ and changes regularly. See the Directory of published versions

: EXM Measure

Page standards status: Informative

Raw xml | Download


<Measure xmlns="http://hl7.org/fhir">
  <id value="EXMLogic-FHIR"/>
  <meta>
    <profile
             value="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-cvmeasure|2.0.0"/>
    <profile
             value="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-computablemeasure|2.0.0"/>
    <profile
             value="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-executablemeasure|2.0.0"/>
    <profile
             value="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-cqlmeasure|2.0.0"/>
    <profile
             value="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-elmmeasure|2.0.0"/>
    <profile
             value="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-computablemeasure|2.0.0"/>
  </meta>
  <language value="en"/>
  <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"><a name="metadata"> </a>Metadata</th>


</tr>

<tr>


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



<td class="content-container">EXM Measure</td>


</tr>





<tr>


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



<td class="content-container">2.0.0</td>


</tr>







  
<tr>


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



<td class="content-container">EXM</td>


</tr>


  
<tr>


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



<td class="content-container">urn:oid:2.16.840.1.113883.4.642.40.61.29.9</td>


</tr>



  
    
    
    
    


  


<tr>


<th scope="row" class="row-header">Approval Date</th>



<td class="content-container">2019-02-17</td>


</tr>


<tr>


<th scope="row" class="row-header">Last Review Date</th>



<td class="content-container">2019-02-17</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">Use Context</th>



<td class="content-container">
    Clinical Venue

 = 
    EC


</td>


</tr>




<tr>


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



<td class="content-container">
    <a href="http://unstats.un.org/unsd/methods/m49/m49.htm">http://unstats.un.org/unsd/methods/m49/m49.htm</a>#001


</td>


</tr>




<tr>


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



<td class="content-container">Health Quality Measure Document
</td>


</tr>








<tr>


<th scope="row" class="row-header">Steward (Publisher)</th>



<td class="content-container">HL7 International / Clinical Quality Information</td>


</tr>








<tr>


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



<td class="content-container">Example Measure Content Developer</td>


</tr>






<tr>


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



<td class="content-container"><div><p>An example FHIR-based measure</p>
</div></td>


</tr>



<tr>


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



<td class="content-container"><div><p>This measure has been developed to support improvement in clinical care.</p>
</div></td>


</tr>



<tr>


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



<td class="content-container"><div><p>Example Copyright Statement</p>
</div></td>


</tr>


<tr>


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



<td class="content-container"><div><p>Example disclaimer</p>
</div></td>


</tr>


  
<tr>


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



<td class="content-container">Encounter</td>


</tr>



<tr>


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



<td class="content-container">
    Continuous Variable


</td>


</tr>



  
<tr>


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



<td class="content-container">2</td>


</tr>



<tr>


<th scope="row" class="row-header">Improvement Notation</th>



<td class="content-container">
    Increased score indicates improvement


</td>


</tr>







<tr>


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



<td class="content-container">
    <a href="http://terminology.hl7.org/7.3.0/CodeSystem-measure-type.html">http://terminology.hl7.org/CodeSystem/measure-type</a>#process


</td>


</tr>



<tr>


<th scope="row" class="row-header">Risk Adjustment</th>



<td class="content-container">Risk adjustment for this measure is performed by...</td>


</tr>


<tr>


<th scope="row" class="row-header">Rate Aggregation</th>



<td class="content-container">Rate aggregation for this measure is performed by...</td>


</tr>


<tr>


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



<td class="content-container"><div><p>The purpose of this measure is to show how all the elements of a FHIR-based quality measure are represented.</p>
</div></td>


</tr>


<tr>


<th scope="row" class="row-header">Clinical Recommendation Statement</th>



<td class="content-container"><div><p>The clinical recommendation statement for this measure is...</p>
</div></td>


</tr>




<tr>


<th scope="row" class="row-header">Guidance (Usage)</th>



<td class="content-container">Users of this measure should be aware that this is intentionally simplified to show specific aspects of a measure.</td>


</tr>



  
    
<tr>


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



<td class="content-container"><div><p>This illustrates an example comment</p>
</div></td>


</tr>

  





<tr>
  <th scope="row" class="row-header"><a name="contents"> </a>Contents</th>
  <td class="content-container">
    <em><a href="#metadata">Metadata</a></em>
    <br/>
    <em><a href="#contents">Contents</a></em>
    <br/>
    <em><a href="#measure-rates">Measure Rates (Groups)</a></em>
    <br/>
    <em><a href="#supplemental-data">Supplemental Data</a></em>
    <br/>
    
    <em><a href="#measure-logic">Measure Logic</a></em>
    <br/>
    
    
    <em><a href="#population-criteria">Population Criteria</a></em>
    <br/>
    <em><a href="#definitions">Logic Definitions</a></em>
    <br/>
    <em><a href="#terminology">Terminology</a></em>
    <br/>
    <em><a href="#dependencies">Dependencies</a></em>
    <br/>
    <em><a href="#data-requirements">Data Requirements</a></em>
    <br/>
    
    
    
  </td>
</tr>

<tr>


<th colspan="2" scope="row" class="row-header"><a name="measure-rates"> </a>Measure Rates (Groups)</th>


</tr>

  
  
  
    
    <tr>


<th colspan="2" scope="row" class="row-header">Measure Rate (Group) (ID: primary)</th>


</tr>
  
  
  












  
  

    
      
        
  
    
    
    <tr>
      
        

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


      
      <td class="content-container">
        
        <em>ID</em>: primary-exmlogic-initial-population
        <br/>
        
        
          
        
        
          
            
              
              <em>Criteria</em>: <a href="#primary-primary-exmlogic-initial-population">Initial Population</a> 
            
          
          
        
        
        
      </td>
    </tr>
  

      
    

    
      
        
  
    
    
    <tr>
      
        

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


      
      <td class="content-container">
        
        <em>ID</em>: primary-exmlogic-measure-population
        <br/>
        
        
          
        
        
          
            
              
              <em>Criteria</em>: <a href="#primary-primary-exmlogic-measure-population">Measure Population</a> 
            
          
          
        
        
        
      </td>
    </tr>
  

      
    

    
      
    

    
      
        
  
    
    
    <tr>
      
        

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


      
      <td class="content-container">
        
        <em>ID</em>: primary-exmlogic-measure-observation
        <br/>
        
        
          
        
        
          
            
              
              <em>Criteria</em>: <a href="#primary-primary-exmlogic-measure-observation">Measure Observation</a> 
            
          
          
        
        
          <br/><em>Input population</em>: measure-population
        
        
          <em>Aggregate method</em>: median
        
      </td>
    </tr>
  

      
    

  


  

<tr>
  

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


  <td class="content-container">
    
      <em>ID</em>: stratifier-1
      
        <br/>
      
    
    
      
        <em>Code</em>: <span title="Codes:">Stratifier 1</span>
      
      
    
    
    
      <br/>
      <em>Applies to</em>: <span title="Codes:{http://terminology.hl7.org/CodeSystem/measure-population initial-population}">initial-population</span>
    
  </td>
</tr>

<tr>
  

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


  <td class="content-container">
    
      <em>ID</em>: stratifier-2
      
        <br/>
      
    
    
      
        <em>Code</em>: <span title="Codes:">Stratifier 2</span>
      
      
    
    
    
      <br/>
      <em>Applies to</em>: <span title="Codes:{http://terminology.hl7.org/CodeSystem/measure-population initial-population}">initial-population</span>
    
  </td>
</tr>

<tr>
  

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


  <td class="content-container">
    
      <em>ID</em>: stratifier-3
      
        <br/>
      
    
    
      
        <em>Code</em>: <span title="Codes:">Stratifier 3</span>
      
      
    
    
    
      <br/>
      <em>Applies to</em>: <span title="Codes:{http://terminology.hl7.org/CodeSystem/measure-population initial-population}">initial-population</span>
    
  </td>
</tr>



<tr>


<th colspan="2" scope="row" class="row-header"><a name="supplemental-data"> </a>Supplemental Data Elements</th>


</tr>














<tr>


<th colspan="2" scope="row" class="row-header"><a name="measure-logic"> </a>Measure Logic</th>


</tr>

<tr>


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



<td class="content-container"><a href="Library-EXMLogic.html">Example Logic Library</a> version: 2.0.0</td>


</tr>




  <tr>


<th colspan="2" scope="row" class="row-header"><a name="population-criteria"> </a>Population Criteria</th>


</tr>
  
  
  

  
  
  
    
    <tr>


<th colspan="2" scope="row" class="row-header">Measure Rate (Group) (ID: primary)</th>


</tr>
  
  
  
  

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

  <td>
    
    
    
    
      
      <a name="primary-primary-exmlogic-initial-population"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Initial Population&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    with [&quot;Encounter&quot; : &quot;Emergency Department Visit&quot;] ED
     such that ED.status = 'finished'
       and ED.period ends 1 hour or less before start of Encounter.period</code></pre>
    
      
      <a href="#exmlogic-initial-population"><em>Definition</em></a>
    
  </td>

</tr>

          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
      
    
  

      
    

    
      
          
    
      
        
          
        
          
        
          
        
          
        
          
        
          
            
              
            
            
            
            <tr>
  <th scope="row" rowspan="2" class="row-header">
    
    Measure Population
    
  </th>
</tr>
<tr>

  <td>
    
    
    
    
      
      <a name="primary-primary-exmlogic-measure-population"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Measure Population&quot; :
  &quot;Initial Population&quot;</code></pre>
    
      
      <a href="#exmlogic-measure-population"><em>Definition</em></a>
    
  </td>

</tr>

          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
      
    
  

      
    

    
      
    

    
      
          
    
      
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
            
              
            
            
            
            <tr>
  <th scope="row" rowspan="2" class="row-header">
    
    Measure Observation
    
  </th>
</tr>
<tr>

  <td>
    
    
    
    
      
      <a name="primary-primary-exmlogic-measure-observation"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function &quot;Measure Observation&quot;(Encounter &quot;Encounter&quot;) :
  duration in minutes of &quot;Related ED Visit&quot;(Encounter).period</code></pre>
    
      
      <a href="#exmlogic-measure-observation"><em>Definition</em></a>
    
  </td>

</tr>

          
        
          
        
      
    
  

      
    

  


  

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

  <td>
    
    
    
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Stratification 1&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    where not (Encounter.principalDiagnosis().diagnosis in &quot;Psychiatric/Mental Health Patient&quot;)</code></pre>
    
      
      <a href="#exmlogic-stratification-1"><em>Definition</em></a>
    
  </td>

</tr>

          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
    
  

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

  <td>
    
    
    
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Stratification 2&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    where Encounter.principalDiagnosis().diagnosis in &quot;Psychiatric/Mental Health Patient&quot;</code></pre>
    
      
      <a href="#exmlogic-stratification-2"><em>Definition</em></a>
    
  </td>

</tr>

          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
    
  

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

  <td>
    
    
    
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Stratification 3&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    where Encounter.principalDiagnosis().diagnosis is null</code></pre>
    
      
      <a href="#exmlogic-stratification-3"><em>Definition</em></a>
    
  </td>

</tr>

          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
    
  


  

  
  


  <tr>


<th colspan="2" scope="row" class="row-header"><a name="definitions"> </a>Logic Definitions</th>


</tr>
  
  
          
        



        



        



        



        



        



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmcommon-lengthindays"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define fluent function lengthInDays(Value Interval&lt;DateTime&gt; ):
  difference in days between start of Value and end of Value</code></pre>
  </td>

</tr>



        



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmcommon-principaldiagnosis"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define fluent function principalDiagnosis(encounter Encounter):
  singleton from (
    (encounter.claimDiagnosis()) CD
      where CD.type.includesCode(&quot;Principal Diagnosis&quot;)
  )</code></pre>
  </td>

</tr>



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmcommon-claimdiagnosis"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define fluent function claimDiagnosis(encounter Encounter):
  encounter E
    let 
      claim: ([Claim] C where C.status = 'active' and C.use = 'claim' and exists (C.item I where I.encounter.references(E))),
      claimItem: (claim.item I where I.encounter.references(E))
    return claim.diagnosis D where D.sequence in claimItem.diagnosisSequence</code></pre>
  </td>

</tr>



        



        



        



        



        



        



        



        



        



        



        




        
        



        



        



        



        



        



        



        



        



        



        



        



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="fhircommon-references"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
@description: Returns true if any of the given references are to the given resource
@comment: Returns true if the `id` element of the given resource exactly equals the tail of any of the given references.
NOTE: This function assumes resources from the same source server.
*/
define fluent function references(references List&lt;FHIR.Reference&gt;, resource FHIR.Resource):
  exists (references R where R.references(resource))</code></pre>
  </td>

</tr>



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="fhircommon-references"> </a>
    
    <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">
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="fhircommon-includescode"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
@description: Returns true if the given code is in the given codeList
@comment: Returns true if the `code` is equivalent to any of the codes in the given `codeList`, false otherwise.
*/
define fluent function includesCode(codeList List&lt;CodeableConcept&gt;, code Concept):
  exists (codeList C where C ~ code)</code></pre>
  </td>

</tr>



        



        



        



        



        




        
        



        



        



        



        



        



        



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="fhirhelpers-tointerval"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
@description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)
value to a CQL DateTime Interval
@comment: If the start value of the given period is unspecified, the starting
boundary of the resulting interval will be open (meaning the start of the interval
is unknown, as opposed to interpreted as the beginning of time).
*/
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">
    Logic Definition
  </th>

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

</tr>
<tr>

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

</tr>



        


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

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

</tr>
<tr>

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

</tr>



        



        



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="fhirhelpers-tostring"> </a>
    
    <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">
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="fhirhelpers-toconcept"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
@description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
*/
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">
    Logic Definition
  </th>

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="fhirhelpers-tocode"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
*/
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">
    Logic Definition
  </th>

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

</tr>
<tr>

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

</tr>



        



        




        
        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmlogic-inpatient-encounter"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Inpatient Encounter&quot; :
  [&quot;Encounter&quot;] Encounter
    where Encounter.period.lengthInDays() &lt;= 120
      and Encounter.period ends during &quot;Measurement Period&quot;</code></pre>
  </td>

</tr>



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmlogic-stratification-3"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Stratification 3&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    where Encounter.principalDiagnosis().diagnosis is null</code></pre>
  </td>

</tr>



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmlogic-stratification-2"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Stratification 2&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    where Encounter.principalDiagnosis().diagnosis in &quot;Psychiatric/Mental Health Patient&quot;</code></pre>
  </td>

</tr>



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmlogic-stratification-1"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Stratification 1&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    where not (Encounter.principalDiagnosis().diagnosis in &quot;Psychiatric/Mental Health Patient&quot;)</code></pre>
  </td>

</tr>



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmlogic-initial-population"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Initial Population&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    with [&quot;Encounter&quot; : &quot;Emergency Department Visit&quot;] ED
     such that ED.status = 'finished'
       and ED.period ends 1 hour or less before start of Encounter.period</code></pre>
  </td>

</tr>



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmlogic-measure-population"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Measure Population&quot; :
  &quot;Initial Population&quot;</code></pre>
  </td>

</tr>



        



        



        



        



        



        



        



        



        



        



        



        



        



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmlogic-measure-observation"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function &quot;Measure Observation&quot;(Encounter &quot;Encounter&quot;) :
  duration in minutes of &quot;Related ED Visit&quot;(Encounter).period</code></pre>
  </td>

</tr>



        


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

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

</tr>
<tr>

  <td>
    
    
    
    
      <a name="exmlogic-related-ed-visit"> </a>
    
    <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">//Measure Observation
define function &quot;Related ED Visit&quot;(Encounter &quot;Encounter&quot;) :
  Last([&quot;Encounter&quot; : &quot;Emergency Department Visit&quot;] ED
    where ED.status = 'finished'
      and ED.period ends 1 hour or less before start of Encounter.period
    sort by start of period )</code></pre>
  </td>

</tr>





  
  


  <tr>


<th colspan="2" scope="row" class="row-header"><a name="terminology"> </a>Terminology</th>


</tr>
  
  
  

 

 

 

 


<tr>
  
  
  

<th scope="row" class="row-header">Code System</th>


  
  <td class="content-container">
    
    <em>Description</em>: Code system Diagnosis Type
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="http://terminology.hl7.org/7.3.0/CodeSystem-ex-diagnosistype.html">Example Diagnosis Type Codes</a> version: 1.0.1
    <br/>
    <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/ex-diagnosistype|1.0.1</tt>
    
  </td>
</tr>
 


<tr>
  
  

<th scope="row" class="row-header">Value Set</th>


  
  
  <td class="content-container">
    
    <em>Description</em>: Value set Psychiatric/Mental Health Patient
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.299/expansion">Psychiatric/Mental Health Diagnosis</a> version: 20170816
    <br/>
    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.299|20170816</tt>
    
  </td>
</tr>
 


<tr>
  
  

<th scope="row" class="row-header">Value Set</th>


  
  
  <td class="content-container">
    
    <em>Description</em>: Value set Emergency Department Visit
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion">Emergency Department Visit</a> version: 20210611
    <br/>
    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292|20210611</tt>
    
  </td>
</tr>
 


  
  <tr>
    <th scope="row" class="row-header">Direct Reference Code</th>
    <td class="content-container">
      
        <em>Display</em>: Principal Diagnosis
        <br/>
      
      <em>Code</em>: principal
      <br/>
      <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/ex-diagnosistype</tt>
    </td>
  </tr>

  
  


  <tr>


<th colspan="2" scope="row" class="row-header"><a name="dependencies"> </a>Dependencies</th>


</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://hl7.org/fhir/uv/cql/STU2/Library-FHIR-ModelInfo.html">http://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://hl7.org/fhir/uv/cql/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 EXMCommon
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="Library-EXMCommon.html">EXMCommon</a> version: 2.0.0
    <br/>
    <em>Canonical URL</em>: <tt>http://hl7.org/fhir/uv/cqm/Library/EXMCommon|2.0.0</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://hl7.org/fhir/uv/cql/STU2/Library-FHIRHelpers.html">http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://hl7.org/fhir/uv/cql/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 FHIRCommon
    
    <br/>
    
    
    
    
    
    
    <em>Resource</em>: <a href="http://hl7.org/fhir/uv/cql/STU2/Library-FHIRCommon.html">http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0</a>
    <br/>
    <em>Canonical URL</em>: <tt>http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0</tt>
    
  </td>
</tr>
 

 

 

 


  
  






  <tr>


<th colspan="2" scope="row" class="row-header"><a name="data-requirements"> </a>Data Requirements</th>


</tr>
  
  
  
<tr>
  <th scope="row" class="row-header">Data Requirement</th>
  <td class="content-container">
    <em>Type</em>: Encounter
    <br/>
  
    <em>Profile(s)</em>: 
  
    <a href="http://hl7.org/fhir/R4/encounter.html">Encounter</a> version: 4.0.1
    <br/>        
  
   
   
    <em>Must Support Elements</em>: period, type
    <br/>
   
   
  </td>
</tr>

<tr>
  <th scope="row" class="row-header">Data Requirement</th>
  <td class="content-container">
    <em>Type</em>: Encounter
    <br/>
  
    <em>Profile(s)</em>: 
  
    <a href="http://hl7.org/fhir/R4/encounter.html">Encounter</a> version: 4.0.1
    <br/>        
  
   
   
    <em>Must Support Elements</em>: type, status, period
    <br/>
   
  
    <em>Code Filter(s)</em>: 
    <br/>
  
  
    <span class="tab-one"><em>Path</em>: type</span>
    <br/>
  
  
  
    <span class="tab-one"><em>ValueSet</em>:</span> <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion">Emergency Department Visit</a> version: 20210611
    <br/> 
  
  
  
   
  </td>
</tr>

<tr>
  <th scope="row" class="row-header">Data Requirement</th>
  <td class="content-container">
    <em>Type</em>: Claim
    <br/>
  
    <em>Profile(s)</em>: 
  
    <a href="http://hl7.org/fhir/R4/claim.html">Claim</a> version: 4.0.1
    <br/>        
  
   
   
    <em>Must Support Elements</em>: status, use, item
    <br/>
   
   
  </td>
</tr>

  
  




<tr>
  <th colspan="2" scope="row" class="row-header">Generated using version 0.5.7-cibuild 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://terminology.hl7.org/CodeSystem/ex-diagnosistype"/>
          <code value="principal"/>
          <display value="Principal Diagnosis"/>
        </valueCoding>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="EXMLogic"/>
        </extension>
        <extension url="name">
          <valueString value="Inpatient Encounter"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define &quot;Inpatient Encounter&quot; :
  [&quot;Encounter&quot;] Encounter
    where Encounter.period.lengthInDays() &lt;= 120
      and Encounter.period ends 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="EXMLogic"/>
        </extension>
        <extension url="name">
          <valueString value="Stratification 3"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define &quot;Stratification 3&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    where Encounter.principalDiagnosis().diagnosis is null"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="1"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="EXMLogic"/>
        </extension>
        <extension url="name">
          <valueString value="Stratification 2"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define &quot;Stratification 2&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    where Encounter.principalDiagnosis().diagnosis in &quot;Psychiatric/Mental Health Patient&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="2"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="EXMLogic"/>
        </extension>
        <extension url="name">
          <valueString value="Stratification 1"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define &quot;Stratification 1&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    where not (Encounter.principalDiagnosis().diagnosis in &quot;Psychiatric/Mental Health Patient&quot;)"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="3"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="EXMLogic"/>
        </extension>
        <extension url="name">
          <valueString value="Initial Population"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define &quot;Initial Population&quot; :
  &quot;Inpatient Encounter&quot; Encounter
    with [&quot;Encounter&quot; : &quot;Emergency Department Visit&quot;] ED
     such that ED.status = 'finished'
       and ED.period ends 1 hour or less before start of Encounter.period"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="4"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="EXMLogic"/>
        </extension>
        <extension url="name">
          <valueString value="Measure Population"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define &quot;Measure Population&quot; :
  &quot;Initial Population&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="5"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="EXMCommon"/>
        </extension>
        <extension url="name">
          <valueString value="lengthInDays"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define fluent function lengthInDays(Value Interval&lt;DateTime&gt; ):
  difference in days between start of Value and end of 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="/*
@description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)
value to a CQL DateTime Interval
@comment: If the start value of the given period is unspecified, the starting
boundary of the resulting interval will be open (meaning the start of the interval
is unknown, as opposed to interpreted as the beginning of time).
*/
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]"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="7"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="EXMCommon"/>
        </extension>
        <extension url="name">
          <valueString value="principalDiagnosis"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define fluent function principalDiagnosis(encounter Encounter):
  singleton from (
    (encounter.claimDiagnosis()) CD
      where CD.type.includesCode(&quot;Principal Diagnosis&quot;)
  )"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="8"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="EXMCommon"/>
        </extension>
        <extension url="name">
          <valueString value="claimDiagnosis"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define fluent function claimDiagnosis(encounter Encounter):
  encounter E
    let 
      claim: ([Claim] C where C.status = 'active' and C.use = 'claim' and exists (C.item I where I.encounter.references(E))),
      claimItem: (claim.item I where I.encounter.references(E))
    return claim.diagnosis D where D.sequence in claimItem.diagnosisSequence"/>
        </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="ToString"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define function ToString(value ClaimStatus): value.value"/>
        </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="ToString"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define function ToString(value Use): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="11"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRCommon"/>
        </extension>
        <extension url="name">
          <valueString value="references"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="/*
@description: Returns true if any of the given references are to the given resource
@comment: Returns true if the `id` element of the given resource exactly equals the tail of any of the given references.
NOTE: This function assumes resources from the same source server.
*/
define fluent function references(references List&lt;FHIR.Reference&gt;, resource FHIR.Resource):
  exists (references R where R.references(resource))"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="12"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRCommon"/>
        </extension>
        <extension url="name">
          <valueString value="references"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="/*
@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, '/'))"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="13"/>
        </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="14"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRCommon"/>
        </extension>
        <extension url="name">
          <valueString value="includesCode"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="/*
@description: Returns true if the given code is in the given codeList
@comment: Returns true if the `code` is equivalent to any of the codes in the given `codeList`, false otherwise.
*/
define fluent function includesCode(codeList List&lt;CodeableConcept&gt;, code Concept):
  exists (codeList C where C ~ code)"/>
        </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="ToConcept"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="/*
@description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
*/
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
        }"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="16"/>
        </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="/*
@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
*/
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
        }"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="17"/>
        </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 EncounterStatus): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="18"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="EXMLogic"/>
        </extension>
        <extension url="name">
          <valueString value="Measure Observation"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="define function &quot;Measure Observation&quot;(Encounter &quot;Encounter&quot;) :
  duration in minutes of &quot;Related ED Visit&quot;(Encounter).period"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="19"/>
        </extension>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
        <extension url="libraryName">
          <valueString value="EXMLogic"/>
        </extension>
        <extension url="name">
          <valueString value="Related ED Visit"/>
        </extension>
        <extension url="statement">
          <valueString
                       value="//Measure Observation
define function &quot;Related ED Visit&quot;(Encounter &quot;Encounter&quot;) :
  Last([&quot;Encounter&quot; : &quot;Emergency Department Visit&quot;] ED
    where ED.status = 'finished'
      and ED.period ends 1 hour or less before start of Encounter.period
    sort by start of period )"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="20"/>
        </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://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library EXMCommon"/>
        <resource value="http://hl7.org/fhir/uv/cqm/Library/EXMCommon|2.0.0"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library FHIRHelpers"/>
        <resource
                  value="http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library FHIRCommon"/>
        <resource
                  value="http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Code system Diagnosis Type"/>
        <resource
                  value="http://terminology.hl7.org/CodeSystem/ex-diagnosistype|1.0.1"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Psychiatric/Mental Health Patient"/>
        <resource
                  value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.299|20170816"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Emergency Department Visit"/>
        <resource
                  value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292|20210611"/>
      </relatedArtifact>
      <parameter>
        <name value="Measurement Period"/>
        <use value="in"/>
        <min value="0"/>
        <max value="1"/>
        <type value="Period"/>
      </parameter>
      <parameter>
        <name value="Stratification 3"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="Stratification 2"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="Stratification 1"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="Initial Population"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="Measure Population"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <dataRequirement>
        <type value="Encounter"/>
        <profile
                 value="http://hl7.org/fhir/StructureDefinition/Encounter|4.0.1"/>
        <mustSupport value="period"/>
        <mustSupport value="type"/>
      </dataRequirement>
      <dataRequirement>
        <type value="Encounter"/>
        <profile
                 value="http://hl7.org/fhir/StructureDefinition/Encounter|4.0.1"/>
        <mustSupport value="type"/>
        <mustSupport value="status"/>
        <mustSupport value="period"/>
        <codeFilter>
          <path value="type"/>
          <valueSet
                    value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292|20210611"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Claim"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/Claim|4.0.1"/>
        <mustSupport value="status"/>
        <mustSupport value="use"/>
        <mustSupport value="item"/>
      </dataRequirement>
    </Library>
  </contained>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/cqf-artifactComment">
    <extension url="type">
      <valueCode value="documentation"/>
    </extension>
    <extension url="text">
      <valueMarkdown value="This illustrates an example comment"/>
    </extension>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-populationBasis">
    <valueCode value="Encounter"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-softwaresystem">
    <valueReference>🔗 
      <reference value="Device/software-system-example"/>
    </valueReference>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-scoringPrecision">
    <valuePositiveInt value="2"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements">
    <valueCanonical value="#effective-data-requirements"/>
  </extension>
  <url value="http://hl7.org/fhir/uv/cqm/Measure/EXMLogic-FHIR"/>
  <identifier>
    <system value="http://example.org/fhir/cqi/ecqm/Measure/Identifier/exm"/>
    <value value="EXM"/>
  </identifier>
  <identifier>
    <system value="urn:ietf:rfc:3986"/>
    <value value="urn:oid:2.16.840.1.113883.4.642.40.61.29.9"/>
  </identifier>
  <version value="2.0.0"/>
  <name value="MeasureEXM"/>
  <title value="EXM Measure"/>
  <status value="active"/>
  <experimental value="true"/>
  <date value="2025-08-13"/>
  <publisher value="HL7 International / Clinical Quality Information"/>
  <contact>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/cqi"/>
    </telecom>
  </contact>
  <description value="An example FHIR-based measure"/>
  <useContext>
    <code>
      <system
              value="http://terminology.hl7.org/CodeSystem/usage-context-type"/>
      <code value="venue"/>
      <display value="Clinical Venue"/>
    </code>
    <valueCodeableConcept>
      <coding>
        <system
                value="http://hl7.org/fhir/uv/cqm/CodeSystem/intended-venue-codes"/>
        <code value="ec"/>
        <display value="EC"/>
      </coding>
    </valueCodeableConcept>
  </useContext>
  <jurisdiction>
    <coding>
      <system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
      <code value="001"/>
    </coding>
  </jurisdiction>
  <purpose
           value="This measure has been developed to support improvement in clinical care."/>
  <usage
         value="Users of this measure should be aware that this is intentionally simplified to show specific aspects of a measure."/>
  <copyright value="Example Copyright Statement"/>
  <approvalDate value="2019-02-17"/>
  <lastReviewDate value="2019-02-17"/>
  <effectivePeriod>
    <extension
               url="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-effectivePeriodAnchor">
      <valueDateTime value="2018-01-01"/>
    </extension>
    <extension
               url="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-effectivePeriodDuration">
      <valueDuration>
        <value value="1"/>
        <system value="http://unitsofmeasure.org"/>
        <code value="a"/>
      </valueDuration>
    </extension>
    <start value="2018-01-01"/>
    <end value="2018-12-31"/>
  </effectivePeriod>
  <topic>
    <coding>
      <system value="http://loinc.org"/>
      <code value="57024-2"/>
    </coding>
    <text value="Health Quality Measure Document"/>
  </topic>
  <author>
    <name value="Example Measure Content Developer"/>
  </author>
  <library value="http://hl7.org/fhir/uv/cqm/Library/EXMLogic|2.0.0"/>
  <disclaimer value="Example disclaimer"/>
  <scoring>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/measure-scoring"/>
      <code value="continuous-variable"/>
      <display value="Continuous Variable"/>
    </coding>
  </scoring>
  <type>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/measure-type"/>
      <code value="process"/>
    </coding>
  </type>
  <riskAdjustment
                  value="Risk adjustment for this measure is performed by..."/>
  <rateAggregation
                   value="Rate aggregation for this measure is performed by..."/>
  <rationale
             value="The purpose of this measure is to show how all the elements of a FHIR-based quality measure are represented."/>
  <clinicalRecommendationStatement
                                   value="The clinical recommendation statement for this measure is..."/>
  <improvementNotation>
    <coding>
      <system
              value="http://terminology.hl7.org/CodeSystem/measure-improvement-notation"/>
      <code value="increase"/>
      <display value="Increased score indicates improvement"/>
    </coding>
  </improvementNotation>
  <guidance
            value="Additional guidance provided to help communicate the intent of the measure"/>
  <group id="group-1">
    <extension
               url="http://hl7.org/fhir/5.0/StructureDefinition/extension-Measure.group.linkId">
      <valueString value="primary"/>
    </extension>
    <code>
      <coding>
        <system value="http://example.org/group"/>
        <code value="group"/>
        <display value="group-1"/>
      </coding>
    </code>
    <population id="initial-population-1">
      <extension
                 url="http://hl7.org/fhir/5.0/StructureDefinition/extension-Measure.group.population.linkId">
        <valueString value="primary-exmlogic-initial-population"/>
      </extension>
      <code>
        <coding>
          <system
                  value="http://terminology.hl7.org/CodeSystem/measure-population"/>
          <code value="initial-population"/>
          <display value="Initial Population"/>
        </coding>
      </code>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Initial Population"/>
      </criteria>
    </population>
    <population id="measure-population">
      <extension
                 url="http://hl7.org/fhir/5.0/StructureDefinition/extension-Measure.group.population.linkId">
        <valueString value="primary-exmlogic-measure-population"/>
      </extension>
      <code>
        <coding>
          <system
                  value="http://terminology.hl7.org/CodeSystem/measure-population"/>
          <code value="measure-population"/>
          <display value="Measure Population"/>
        </coding>
      </code>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Measure Population"/>
      </criteria>
    </population>
    <population id="measure-observation">
      <extension
                 url="http://hl7.org/fhir/5.0/StructureDefinition/extension-Measure.group.population.linkId">
        <valueString value="primary-exmlogic-measure-observation"/>
      </extension>
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/cqf-criteriaReference">
        <valueString value="measure-population"/>
      </extension>
      <extension
                 url="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-aggregateMethod">
        <valueCode value="median"/>
      </extension>
      <code>
        <coding>
          <system
                  value="http://terminology.hl7.org/CodeSystem/measure-population"/>
          <code value="measure-observation"/>
          <display value="Measure Observation"/>
        </coding>
      </code>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Measure Observation"/>
      </criteria>
    </population>
    <stratifier id="stratifier-1">
      <extension
                 url="http://hl7.org/fhir/5.0/StructureDefinition/extension-Measure.group.stratifier.linkId">
        <valueString value="primary-exmlogic-stratification-1"/>
      </extension>
      <extension
                 url="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-appliesTo">
        <valueCodeableConcept>
          <coding>
            <system
                    value="http://terminology.hl7.org/CodeSystem/measure-population"/>
            <code value="initial-population"/>
            <display value="Initial Population"/>
          </coding>
          <text value="initial-population"/>
        </valueCodeableConcept>
      </extension>
      <code>
        <text value="Stratifier 1"/>
      </code>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Stratification 1"/>
      </criteria>
    </stratifier>
    <stratifier id="stratifier-2">
      <extension
                 url="http://hl7.org/fhir/5.0/StructureDefinition/extension-Measure.group.stratifier.linkId">
        <valueString value="primary-exmlogic-stratification-2"/>
      </extension>
      <extension
                 url="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-appliesTo">
        <valueCodeableConcept>
          <coding>
            <system
                    value="http://terminology.hl7.org/CodeSystem/measure-population"/>
            <code value="initial-population"/>
            <display value="Initial Population"/>
          </coding>
          <text value="initial-population"/>
        </valueCodeableConcept>
      </extension>
      <code>
        <text value="Stratifier 2"/>
      </code>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Stratification 2"/>
      </criteria>
    </stratifier>
    <stratifier id="stratifier-3">
      <extension
                 url="http://hl7.org/fhir/5.0/StructureDefinition/extension-Measure.group.stratifier.linkId">
        <valueString value="primary-exmlogic-stratification-3"/>
      </extension>
      <extension
                 url="http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-appliesTo">
        <valueCodeableConcept>
          <coding>
            <system
                    value="http://terminology.hl7.org/CodeSystem/measure-population"/>
            <code value="initial-population"/>
            <display value="Initial Population"/>
          </coding>
          <text value="initial-population"/>
        </valueCodeableConcept>
      </extension>
      <code>
        <text value="Stratifier 3"/>
      </code>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Stratification 3"/>
      </criteria>
    </stratifier>
  </group>
</Measure>