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

<Measure xmlns="http://hl7.org/fhir">
  <id value="HybridHospitalWideReadmissionFHIR"/>
  <meta>
    <profile value="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/computable-measure-cqfm"/>
    <profile value="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/publishable-measure-cqfm"/>
    <profile value="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/executable-measure-cqfm"/>
  </meta>
  <text>
    <status value="extensions"/><div xmlns="http://www.w3.org/1999/xhtml">
    <table class="grid dict">
        
            <tr>
                <th scope="row"><b>Title: </b></th>
                <td style="padding-left: 4px;">Core Clinical Data Elements for the Hybrid Hospital-Wide Readmission (HWR) Measure with Claims and Electronic Health Record Data FHIR</td>
            </tr>
        

        

        
            <tr>
                <th scope="row"><b>Id: </b></th>
                <td style="padding-left: 4px;">HybridHospitalWideReadmissionFHIR</td>
            </tr>
            
                <tr>
                    <th scope="row"><b>Download cql: </b></th>
                    <td style="padding-left: 4px;"><a href="Library-HybridHospitalWideReadmissionFHIR.cql">HybridHospitalWideReadmissionFHIR.cql</a></td>
                </tr>
            
        

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

        
            <tr>
                <th scope="row"><b>Url: </b></th>
                <td style="padding-left: 4px;"><a href="Measure-HybridHospitalWideReadmissionFHIR.html">Core Clinical Data Elements for the Hybrid Hospital-Wide Readmission (HWR) Measure with Claims and Electronic Health Record Data FHIR</a></td>
            </tr>
        

        
            <tr>
                <th scope="row">
                    <b>
                        
                            
                                short-name identifier:
                            
                        
                    </b>
                </th>

                <td style="padding-left: 4px;">
                    
                        <p style="margin-bottom: 5px;">
                            <span>CMS529FHIR</span>
                        </p>
                    
                </td>
            </tr>
        
            <tr>
                <th scope="row">
                    <b>
                        
                            
                                version-independent identifier:
                            
                        
                    </b>
                </th>

                <td style="padding-left: 4px;">
                    
                        <p style="margin-bottom: 5px;">
                            <span>urn:uuid:66842e26-2256-4a2d-8dac-dd014c425748</span>
                        </p>
                    
                </td>
            </tr>
        
            <tr>
                <th scope="row">
                    <b>
                        
                            
                                version-specific identifier:
                            
                        
                    </b>
                </th>

                <td style="padding-left: 4px;">
                    
                        <p style="margin-bottom: 5px;">
                            <span>urn:uuid:2c92808482113ece0182c5d39df62f0e</span>
                        </p>
                    
                </td>
            </tr>
        
            <tr>
                <th scope="row">
                    <b>
                        
                            
                                endorser (NQF) identifier:
                            
                        
                    </b>
                </th>

                <td style="padding-left: 4px;">
                    
                        <p style="margin-bottom: 5px;">
                            <span>2879</span>
                        </p>
                    
                </td>
            </tr>
        
            <tr>
                <th scope="row">
                    <b>
                        
                            
                                publisher (CMS) identifier:
                            
                        
                    </b>
                </th>

                <td style="padding-left: 4px;">
                    
                        <p style="margin-bottom: 5px;">
                            <span>529FHIR</span>
                        </p>
                    
                </td>
            </tr>
        

        
            <tr>
                <th scope="row"><b>Effective Period: </b></th>
                <td style="padding-left: 4px;">2024-07-01
                    ..2025-06-30</td>
            </tr>
        

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

        

        
            <tr>
                <th scope="row"><b>Date: </b></th>
                <td style="padding-left: 4px;">2023-10-27 08:12:32+0000</td>
            </tr>
        

        
            <tr>
                <th scope="row"><b>Approval Date: </b></th>
                <td style="padding-left: 4px;">2023-08-14</td>
            </tr>
        

        
            <tr>
                <th scope="row"><b>Last Review Date: </b></th>
                <td style="padding-left: 4px;">2023-08-14</td>
            </tr>
        

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

        
            <tr>
                <th scope="row"><b>Publisher: </b></th>
                <td style="padding-left: 4px;">Centers for Medicare &amp; Medicaid Services (CMS)</td>
            </tr>
        

        
        <tr>
            <th scope="row"><b>Author: </b></th>
            <td style="padding-left: 4px;">Yale New Haven Health Service Corporation/ Center for Outcomes Research and Evaluation: <a href="https://medicine.yale.edu/core/">https://medicine.yale.edu/core/</a></td>
        </tr>
        

        

        
            <tr>
                <th scope="row"><b>Description: </b></th>
                <td style="padding-left: 4px;"><div><p>This logic is intended to extract electronic clinical data. This is not an electronic clinical quality measure and this logic will not produce measure results. Instead, it will produce a file containing the data that CMS will link with administrative claims to risk adjust the Hybrid HWR outcome measure. It is designed to extract the first resulted set of vital signs and basic laboratory results obtained from encounters for adult Medicare Fee-For-Service patients admitted to acute care short stay hospitals.</p>
</div></td>
            </tr>
        

        

        

        

        

        

        
            <tr>
                <th scope="row"><b>Purpose: </b></th>
                <td style="padding-left: 4px;"><div><p>UNKNOWN</p>
</div></td>
            </tr>
        

        
            <tr>
                <th scope="row"><b>Copyright: </b></th>
                <td style="padding-left: 4px;"><div><p>Limited proprietary coding is contained in these specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets.</p>
<p>This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2021 International Health Terminology Standards Development Organisation. All rights reserved.</p>
<p>LOINC(R) copyright 2004-2021 Regenstrief Institute, Inc.</p>
</div></td>
            </tr>
        

        
            <tr>
                <th scope="row"><b>Disclaimer: </b></th>
                <td style="padding-left: 4px;"><div><p>These performance specifications are not clinical guidelines and do not establish a standard of medical care, and have not been tested for all potential applications.</p>
<p>THE MEASURES AND SPECIFICATIONS ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND.</p>
<p>Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].</p>
</div></td>
            </tr>
        

        

        

        

        

        

        

        

        

        
        <tr>
            <th scope="row"><b>Rationale: </b></th>
            <td style="padding-left: 4px;"><div><p>The intent of this logic is to extract the FIRST set of clinical data elements from hospital electronic health records (EHRs) for all qualifying encounters. The data will be linked with administrative claims to risk adjust the Hybrid HWR outcome measure. This work addresses stakeholder concerns that clinical data garnered from patients, and used by clinicians to guide diagnostic decisions and treatment, are preferable to administrative claims data when profiling hospitals' case mix. We are calling the list of data elements for extraction the &quot;HWR-specific core clinical data elements&quot;. The core clinical data elements are the first set of vital signs and basic laboratory tests resulted from encounters for adult Medicare Fee-For-Service patients, age 65 or older (Initial Population), after they arrive at the hospital to which they are subsequently admitted. For example, this first set of data values are often captured in the emergency department or in the pre-operative area, sometimes hours before a patient is admitted to that same facility.</p>
<p>These data elements were selected because they: 1. reflect patients' clinical status when they first present to the hospital, 2. are clinically and statistically relevant to patient outcomes, 3. are consistently obtained on adult inpatient encounters based on current clinical practice, 4. are captured with a standard definition and recorded in a standard format across providers, and 5. are entered in structured fields that are feasibly retrieved from current EHR systems (YNHHS/CORE, 2015).</p>
<p>Additional data called Linking Variables are used to link EHR data files with administrative claims data for CMS to calculate results for the Hybrid HWR measure, which are: CMS Certification Number, Health Insurance Claim Number (HICN) or Medicare Beneficiary Identifier (MBI), date of birth, sex, admission date, and discharge date.</p>
</div></td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Clinical recommendation statement: </b></th>
            <td style="padding-left: 4px;"><div><p>The logic is not meant to guide or alter the care patients receive. The purpose of this core clinical data elements logic is to extract clinical data that are already routinely captured in EHRs from encounters for hospitalized adult patients. It is not intended to require that clinical staff perform additional measurements or tests that are not needed for diagnostic assessment or treatment of patients.</p>
</div></td>
        </tr>
        

        

        
            <tr>
                <th scope="row"><b>Guidance (Usage): </b></th>
                <td style="padding-left: 4px;">This FHIR-based measure has been derived from the QDM-based measure: CMS529v3.1 (QDM 5.6)Please refer to the HL7 QI-Core Implementation Guide (http://hl7.org/fhir/us/qicore/index.html) for more information on QI-Core and mapping recommendations from QDM to QI-Core 4.1.1 (http://hl7.org/fhir/us/qicore/qdm-to-qicore.html). These specifications are for use for data with discharges that occur between July 1, 2023 and June 30, 2024. 

This logic guides the user to extract the FIRST resulted HWR-specific core clinical data elements for all Medicare Fee-For-Service encounters for patients age 65 or older (Initial Population) directly admitted to the hospital or admitted to the same facility after being treated in another area such as the emergency department or hospital outpatient location. 

The logic supports extraction of the FIRST set of HWR-specific core clinical data elements in two different ways depending on if the patient was a direct admission, meaning that the patient was admitted directly to an inpatient unit without first receiving care in the emergency department or other hospital outpatient locations within the same admitting facility: 

1. If the patient was a direct admission, the logic supports extraction of the FIRST resulted vital signs within 2 hours (120 minutes) after the start of the inpatient admission, and the FIRST resulted laboratory tests within 24 hours (1440 minutes) after the start of the inpatient admission. 
2. If the patient has values captured prior to admission, for example from the emergency department, pre-operative, or other outpatient area within the hospital, the logic supports extraction of the FIRST resulted vital signs and laboratory tests within 24 hours (1440 minutes) PRIOR to the start of the inpatient admission. All clinical systems used in inpatient and outpatient locations within the hospital facility should be queried when looking for core clinical data element values related to a patient who is subsequently admitted.

Value sets for the laboratory tests represent the LOINC codes currently available for these tests. If the institution is using local codes to capture and store relevant laboratory test data, those sites should map that information to the LOINC code for reporting of the core clinical data elements.

NOTE: Do not report ALL values on an encounter during their entire admission. Only report the FIRST resulted value for EACH core clinical data element collected in the appropriate timeframe, if available.

For each core clinical data element, please report values using one of the appropriate units of measurement listed below, which represent valid UCUM codes: 

Core Clinical Data Element                          UCUM Unit

Bicarbonate----------------------------------meq/L 
                                                             mmol/L 

Creatinine------------------------------------mg/dL 
                                                             umol/L

Glucose--------------------------------------mg/dL
                                                            mmol/L

Heart rate------------------------------------{Beats}/min

Hematocrit -----------------------------------%

Oxygen saturation (by pulse oximetry)-----%{Oxygen}

Potassium------------------------------------meq/L 
                                                             mmol/L

Respiratory rate------------------------------{Breaths}/min

Sodium---------------------------------------meq/L
                                                             mmol/L
 
Systolic blood pressure----------------------mm[Hg]

Temperature----------------------------------Cel
                                                              [degF]  

Weight-----------------------------------------kg
                                                               [lb_av]
                                                               g
                                                          
White blood cell count ----------------------{Cells}/uL
                                                              10*3/uL
                                                              10*9/L 
                                                              /mm3
 
For each encounter please also submit the following Linking Variables: 
CMS Certification Number,
Health Insurance Claim Number (HICN) or Medicare Beneficiary Identifier (MBI),
Date of Birth,
Sex,
Inpatient Admission Date, and 
Discharge Date.

The initial population includes patients with inpatient hospitalizations and patients from Acute Hospital Care at Home programs, who are treated and billed as inpatients but receive care in their home.</td>
            </tr>
        

        
            
                <tr>
                    <th scope="row"><b>Population Criteria: </b></th>
                    <td style="padding-left: 4px;">
                        
                            <table class="grid-dict">
                                
                                    <tr>
                                        <th><b>638501714ba3d47c885c02ac</b></th>
                                    </tr>
                                
                                
                                    <tr>
                                        <td>Initial Population:</td>
                                        
                                            <td>All Medicare Fee-For-Service encounters age 65 and older at the start of an inpatient admission, who are discharged during the measurement period (length of stay &lt;365 days).

NOTE: All Medicare Fee-For-Service encounters meeting the above criteria should be included, regardless if Medicare Fee-For-Service is the primary, secondary, or tertiary payer.</td>
                                        
                                    </tr>
                                
                                
                            </table>
                        
                    </td>
                </tr>
            
        

        
            <tr>
                <th scope="row">
                    <b> Supplemental Data Guidance
                        : </b></th>
                <td style="padding-left: 4px;">  </td>
            </tr>
        

        
            <tr>
                <th scope="row"><b> Supplemental Data Elements: </b></th>
                <td style="padding-left: 4px;">
                    
                        
                            
                                Results
                            
                        
                    
                        
                            
                                SDE Ethnicity
                            
                        
                    
                        
                            
                                SDE Payer
                            
                        
                    
                        
                            
                                SDE Race
                            
                        
                    
                        
                            
                                SDE Sex
                            
                        
                    
                </td>
            </tr>
        

        
            <tr>
                <th scope="row"><b>Libraries: </b></th>
                <td style="padding-left: 4px;">
                    <table class="grid-dict">
                        
                            <tr>
                                <td><a href="Library-HybridHospitalWideReadmissionFHIR.html">HybridHospitalWideReadmissionFHIR</a></td>
                            </tr>
                        
                    </table>
                </td>
            </tr>
        

        

        
            
                <tr>
                    <th scope="row"><b>Related Artifact Dependencies: </b></th>
                    <td style="padding-left: 4px;">
                        
                            <li><a href="Library-SupplementalDataElements.html">SupplementalDataElements</a> version: 3.4.000</li>
                        
                            <li><a href="Library-FHIRHelpers.html">FHIRHelpers</a> version: 4.3.000</li>
                        
                            <li><a href="Library-CQMCommon.html">CQMCommon</a> version: 1.4.000</li>
                        
                            <li><a href="Library-QICoreCommon.html">QICoreCommon</a> version: 1.5.000</li>
                        
                            <li><code>http://hl7.org/fhir/v3/AdministrativeGender</code></li>
                        
                            <li><a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html">ActCode</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.307/expansion">Encounter Inpatient</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1104.10/expansion">Medicare payer</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1111.143/expansion">Observation Services</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion">Emergency Department Visit</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.149/expansion">Heart Rate LOINC</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.163/expansion">Systolic Blood Pressure LOINC</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.130/expansion">Respiratory Rate LOINC</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.152/expansion">Body temperature</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.151/expansion">Oxygen Saturation in Arterial Blood by Pulse Oximetry</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.159/expansion">Body weight</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.114/expansion">Hematocrit lab test</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.129/expansion">White blood cells count lab test</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.117/expansion">Potassium lab test</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.119/expansion">Sodium lab test</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.139/expansion">Bicarbonate lab test</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.2363/expansion">Creatinine lab test</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.134/expansion">Glucose lab test</a></li>
                        
                            <li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.3591/expansion">Payer</a></li>
                        
                    </td>
                </tr>
                <tr>
                    <th scope="row"><b>Parameters:</b></th>
                    <td style="padding-left: 4px;">
                        <table class="grid-dict">
                            <tr>
                                <th><b>name</b></th>
                                <th><b>use</b></th>
                                <th><b>min</b></th>
                                <th><b>max</b></th>
                                <th><b>type</b></th>
                            </tr>
                            
                                <tr>
                                    <td>Measurement Period</td>
                                    <td>In</td>
                                    <td>0</td>
                                    <td>1</td>
                                    <td>Period</td>
                                </tr>
                            
                                <tr>
                                    <td>SDE Sex</td>
                                    <td>Out</td>
                                    <td>0</td>
                                    <td>1</td>
                                    <td>Coding</td>
                                </tr>
                            
                                <tr>
                                    <td>Results</td>
                                    <td>Out</td>
                                    <td>0</td>
                                    <td>*</td>
                                    <td>string</td>
                                </tr>
                            
                                <tr>
                                    <td>SDE Payer</td>
                                    <td>Out</td>
                                    <td>0</td>
                                    <td>*</td>
                                    <td>Resource</td>
                                </tr>
                            
                                <tr>
                                    <td>Initial Population</td>
                                    <td>Out</td>
                                    <td>0</td>
                                    <td>*</td>
                                    <td>Resource</td>
                                </tr>
                            
                                <tr>
                                    <td>SDE Ethnicity</td>
                                    <td>Out</td>
                                    <td>0</td>
                                    <td>1</td>
                                    <td>Resource</td>
                                </tr>
                            
                                <tr>
                                    <td>SDE Race</td>
                                    <td>Out</td>
                                    <td>0</td>
                                    <td>1</td>
                                    <td>Resource</td>
                                </tr>
                            
                        </table>
                    </td>
                </tr>

                <tr>
                    <th scope="row"><b>DataRequirements:</b></th>
                    <td style="padding-left: 4px;">
                        <table class="grid-dict">
                            <tr>
                                <th><b>Type</b></th>
                                <th><b>Elements</b></th>
                                <th><b>Valueset Name</b></th>
                                <th><b>Valueset</b></th>
                            </tr>
                            
                                <tr>
                                    <td>Patient(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-patient.html">QICorePatient</a>)</td>
                                    <td>
                                        
                                            ethnicity
                                        
                                            race
                                        
                                    </td>
                                    <td>
                                        
                                    </td>
                                    <td/>
                                </tr>
                            
                                <tr>
                                    <td>Encounter(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-encounter.html">QICoreEncounter</a>)</td>
                                    <td>
                                        
                                            type
                                        
                                            status
                                        
                                            status.value
                                        
                                            period
                                        
                                            id
                                        
                                            id.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Observation Services
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1111.143/expansion">Observation Services</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Encounter(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-encounter.html">QICoreEncounter</a>)</td>
                                    <td>
                                        
                                            type
                                        
                                            status
                                        
                                            status.value
                                        
                                            period
                                        
                                            id
                                        
                                            id.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Emergency Department Visit
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion">Emergency Department Visit</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Encounter(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-encounter.html">QICoreEncounter</a>)</td>
                                    <td>
                                        
                                            type
                                        
                                            status
                                        
                                            status.value
                                        
                                            class
                                        
                                            period
                                        
                                            id
                                        
                                            id.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Encounter Inpatient
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.307/expansion">Encounter Inpatient</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Coverage(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-coverage.html">QICoreCoverage</a>)</td>
                                    <td>
                                        
                                            type
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Medicare payer
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1104.10/expansion">Medicare payer</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Coverage(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-coverage.html">QICoreCoverage</a>)</td>
                                    <td>
                                        
                                            type
                                        
                                            period
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Payer Type
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.3591/expansion">Payer</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Heart Rate
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.149/expansion">Heart Rate LOINC</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Systolic Blood Pressure
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.163/expansion">Systolic Blood Pressure LOINC</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Respiratory Rate
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.130/expansion">Respiratory Rate LOINC</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Body temperature
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.152/expansion">Body temperature</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Oxygen Saturation by Pulse Oximetry
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.151/expansion">Oxygen Saturation in Arterial Blood by Pulse Oximetry</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Body weight
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.159/expansion">Body weight</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Hematocrit lab test
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.114/expansion">Hematocrit lab test</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 White blood cells count lab test
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.129/expansion">White blood cells count lab test</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Potassium lab test
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.117/expansion">Potassium lab test</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Sodium lab test
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.119/expansion">Sodium lab test</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Bicarbonate lab test
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.139/expansion">Bicarbonate lab test</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Creatinine lab test
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.2363/expansion">Creatinine lab test</a></td>
                                </tr>
                            
                                <tr>
                                    <td>Observation(<a href="http://hl7.org/fhir/us/qicore/STU4.1.1/StructureDefinition-qicore-observation.html">QICoreObservation</a>)</td>
                                    <td>
                                        
                                            code
                                        
                                            effective
                                        
                                            status
                                        
                                            status.value
                                        
                                            value
                                        
                                            issued
                                        
                                            issued.value
                                        
                                    </td>
                                    <td>
                                        
                                            
                                                 Glucose lab test
                                            
                                        
                                    </td>
                                    <td><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1045.134/expansion">Glucose lab test</a></td>
                                </tr>
                            
                        </table>
                    </td>
                </tr>

                
                    <tr>
                        <th scope="row"><b>Direct Reference Codes:</b></th>
                        <td style="padding-left: 4px;">
                            <table class="grid-dict">
                                <tr>
                                    <th><b>display</b></th>
                                    <th><b>code</b></th>
                                    <th><b>system</b></th>
                                </tr>
                                
                                    <tr>
                                        <td>Male</td>
                                        <td>M</td>
                                        <td><a href="http://hl7.org/fhir/v3/AdministrativeGender">http://hl7.org/fhir/v3/AdministrativeGender</a></td>
                                    </tr>
                                
                                    <tr>
                                        <td>Female</td>
                                        <td>F</td>
                                        <td><a href="http://hl7.org/fhir/v3/AdministrativeGender">http://hl7.org/fhir/v3/AdministrativeGender</a></td>
                                    </tr>
                                
                                    <tr>
                                        <td>Inpatient</td>
                                        <td>IMP</td>
                                        <td><a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html">http://terminology.hl7.org/CodeSystem/v3-ActCode</a></td>
                                    </tr>
                                
                                    <tr>
                                        <td>Acute</td>
                                        <td>ACUTE</td>
                                        <td><a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html">http://terminology.hl7.org/CodeSystem/v3-ActCode</a></td>
                                    </tr>
                                
                                    <tr>
                                        <td>Nonacute</td>
                                        <td>NONAC</td>
                                        <td><a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html">http://terminology.hl7.org/CodeSystem/v3-ActCode</a></td>
                                    </tr>
                                
                                    <tr>
                                        <td>Observation Encounter</td>
                                        <td>OBSENC</td>
                                        <td><a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html">http://terminology.hl7.org/CodeSystem/v3-ActCode</a></td>
                                    </tr>
                                
                            </table>
                        </td>
                    </tr>
                

                
                <tr>
                    <th scope="row"><b>Logic Definitions:</b></th>
                    <td style="padding-left: 4px;">
                        
                        <table class="grid-dict">
                            <tr>
                                <th><b>Group</b></th>
                                <th><b>Scoring</b></th>
                                <th><b>Population Criteria</b></th>
                                <th><b>Expression</b></th>
                            </tr>
                            <tr>
                                
                                <td> 638501714ba3d47c885c02ac </td>
                                <td>
                                    
                                        <b>Group scoring:</b>
                                        
                                            <span>  cohort </span>
                                        
                                    

                                    

                                    

                                    

                                    

                                    

                                    

                                    

                                </td>
                                
                                <tr>
                                    <td/>
                                    <td/>
                                    <td>Initial Population</td>
                                    <td>
                                        
                                            <pre><code class="language-cql">define &quot;Initial Population&quot;:
  &quot;Inpatient Encounters&quot;</code></pre>
                                        
                                    </td>
                                </tr>
                                
                                
                            
                            </tr>
                        </table>
                

                <table class="grid-dict">
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>SupplementalDataElements</td>
                            
                            
                                <td>SDE Sex</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;SDE Sex&quot;:
  case
      when Patient.gender = 'male' then &quot;M&quot;
      when Patient.gender = 'female' then &quot;F&quot;
      else null
    end</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>HybridHospitalWideReadmissionFHIR</td>
                            
                            
                                <td>SDE Sex</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;SDE Sex&quot;:
  SDE.&quot;SDE Sex&quot;</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>HybridHospitalWideReadmissionFHIR</td>
                            
                            
                                <td>Inpatient Encounters</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;Inpatient Encounters&quot;:
  from
    [&quot;Encounter&quot;: &quot;Encounter Inpatient&quot;] InpatientEncounter,
    [&quot;Coverage&quot;: &quot;Medicare payer&quot;] Payer
    where InpatientEncounter.status = 'finished'
      and ( InpatientEncounter.class ~ &quot;IMP&quot;
          or InpatientEncounter.class ~ &quot;ACUTE&quot;
          or InpatientEncounter.class ~ &quot;NONAC&quot;
          or InpatientEncounter.class ~ &quot;OBSENC&quot;
      )
      and InpatientEncounter.hospitalizationWithObservationLengthofStay ( ) &lt; 365
      and InpatientEncounter.period ends during &quot;Measurement Period&quot;
      and AgeInYearsAt(date from start of InpatientEncounter.period) &gt;= 65
    return InpatientEncounter</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>HybridHospitalWideReadmissionFHIR</td>
                            
                            
                                <td>Results</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;Results&quot;:
  flatten {
     // First physical exams (vital signs)
  &quot;FirstPhysicalExamWithEncounterId&quot;([Observation: &quot;Heart Rate&quot;], 'FirstHeartRate'), &quot;FirstPhysicalExamWithEncounterId&quot;([Observation: &quot;Systolic Blood Pressure&quot;], 'FirstSystolicBP'), &quot;FirstPhysicalExamWithEncounterId&quot;([Observation: &quot;Respiratory Rate&quot;], 'FirstRespRate'), &quot;FirstPhysicalExamWithEncounterId&quot;([Observation: &quot;Body temperature&quot;], 'FirstTemperature'), &quot;FirstPhysicalExamWithEncounterId&quot;([Observation: &quot;Oxygen Saturation by Pulse Oximetry&quot;], 'FirstO2Saturation'),
      // First weight using lab test timing
  &quot;FirstPhysicalExamWithEncounterIdUsingLabTiming&quot;([Observation: &quot;Body weight&quot;], 'FirstWeight'), 
       //First lab tests
  &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Hematocrit lab test&quot;], 'FirstHematocrit'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;White blood cells count lab test&quot;], 'FirstWhiteBloodCell'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Potassium lab test&quot;], 'FirstPotassium'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Sodium lab test&quot;], 'FirstSodium'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Bicarbonate lab test&quot;], 'FirstBicarbonate'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Creatinine lab test&quot;], 'FirstCreatinine'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Glucose lab test&quot;], 'FirstGlucose') }</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>SupplementalDataElements</td>
                            
                            
                                <td>SDE Payer</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;SDE Payer&quot;:
  [Coverage: type in &quot;Payer Type&quot;] Payer
    return {
      code: Payer.type,
      period: Payer.period
    }</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>HybridHospitalWideReadmissionFHIR</td>
                            
                            
                                <td>SDE Payer</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;SDE Payer&quot;:
  SDE.&quot;SDE Payer&quot;</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>HybridHospitalWideReadmissionFHIR</td>
                            
                            
                                <td>Initial Population</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;Initial Population&quot;:
  &quot;Inpatient Encounters&quot;</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>SupplementalDataElements</td>
                            
                            
                                <td>SDE Ethnicity</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;SDE Ethnicity&quot;:
  Patient.ethnicity E
    return Tuple {
      codes: { E.ombCategory } union E.detailed,
      display: E.text
    }</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>HybridHospitalWideReadmissionFHIR</td>
                            
                            
                                <td>SDE Ethnicity</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;SDE Ethnicity&quot;:
  SDE.&quot;SDE Ethnicity&quot;</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>SupplementalDataElements</td>
                            
                            
                                <td>SDE Race</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;SDE Race&quot;:
  Patient.race R
    return Tuple {
      codes: R.ombCategory union R.detailed,
      display: R.text
    }</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>HybridHospitalWideReadmissionFHIR</td>
                            
                            
                                <td>SDE Race</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define &quot;SDE Race&quot;:
  SDE.&quot;SDE Race&quot;</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>HybridHospitalWideReadmissionFHIR</td>
                            
                            
                                <td>FirstPhysicalExamWithEncounterId</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define function &quot;FirstPhysicalExamWithEncounterId&quot;(ExamList List&lt;Observation&gt;, CCDE String):
  &quot;Inpatient Encounters&quot; Encounter
    let firstexam: First(ExamList Exam
        where start of QICoreCommon.&quot;ToInterval&quot;(Exam.effective) is not null
          and start of QICoreCommon.&quot;ToInterval&quot;(Exam.effective) during Interval[start of Encounter.period - 1440 minutes, start of Encounter.period + 120 minutes]
          and Exam.status in { 'final', 'amended', 'preliminary' }
          and Exam.value is not null
        sort by start of QICoreCommon.&quot;ToInterval&quot;(effective)
    )
    return '\r\n' &amp; CCDE &amp; ',' &amp; Encounter.id &amp; ',' &amp; ( ToString(firstexam.value as Quantity) ) &amp; ',' &amp; ToString(start of QICoreCommon.&quot;ToInterval&quot;(firstexam.effective))</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>CQMCommon</td>
                            
                            
                                <td>hospitalizationWithObservationLengthofStay</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">/*
@description: Hospitalization with Observation Length of Stay returns the length in days from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter
*/
define fluent function hospitalizationWithObservationLengthofStay(TheEncounter &quot;Encounter&quot; ):
  ((TheEncounter.&quot;hospitalizationWithObservation&quot;(). &quot;lengthInDays&quot;()))</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>CQMCommon</td>
                            
                            
                                <td>lengthInDays</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">/*
@description: Calculates the difference in calendar days between the start and end of the given interval.
*/
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><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>CQMCommon</td>
                            
                            
                                <td>hospitalizationWithObservation</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">/*
@description: Hospitalization with Observation returns the total interval from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter
*/
define fluent function hospitalizationWithObservation(TheEncounter Encounter ):
  TheEncounter Visit
  		let ObsVisit: Last([Encounter: &quot;Observation Services&quot;] LastObs
  				where LastObs.status = 'finished'
            and LastObs.period ends 1 hour or less on or before start of Visit.period
  				sort by end of period
  			),
  			VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
  			EDVisit: Last([Encounter: &quot;Emergency Department Visit&quot;] LastED
  				where LastED.status = 'finished'
            and LastED.period ends 1 hour or less on or before VisitStart
  				sort by end of period
  			)
  		return Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>QICoreCommon</td>
                            
                            
                                <td>ToInterval</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">/*
@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
@comment: Normalizes a choice type of DateTime, Quanitty, Interval&lt;DateTime&gt;, or Interval&lt;Quantity&gt; types
to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible
representations for timing-valued elements in QICore, allowing this function to be used across any resource.
The input can be provided as a DateTime, Quantity, Interval&lt;DateTime&gt; or Interval&lt;Quantity&gt;.
The intent of this function is to provide a clear and concise mechanism to treat single
elements that have multiple possible representations as intervals so that logic doesn't have to account
for the variability. More complex calculations (such as medication request period or dispense period
calculation) need specific guidance and consideration. That guidance may make use of this function, but
the focus of this function is on single element calculations where the semantics are unambiguous.
If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.
If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,
and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.
If the input is a DateTime Interval, the result is the input.
If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result
is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending
immediately before one year later than the date the patient turned the age given as the end of the quantity interval.
Any other input will reslt in a null DateTime Interval
@deprecated: This function is deprecated. Use the fluent function `toInterval()` instead
*/
define function ToInterval(choice Choice&lt;DateTime, Quantity, Interval&lt;DateTime&gt;, Interval&lt;Quantity&gt;&gt;):
  case
	  when choice is DateTime then
    	Interval[choice as DateTime, choice as DateTime]
		when choice is Interval&lt;DateTime&gt; then
  		choice as Interval&lt;DateTime&gt;
		when choice is Quantity then
		  Interval[Patient.birthDate + (choice as Quantity),
			  Patient.birthDate + (choice as Quantity) + 1 year)
		when choice is Interval&lt;Quantity&gt; then
		  Interval[Patient.birthDate + (choice.low as Quantity),
			  Patient.birthDate + (choice.high as Quantity) + 1 year)
		when choice is QICore.Timing then
            null as Interval&lt;DateTime&gt;
		else
			null as Interval&lt;DateTime&gt;
	end</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>HybridHospitalWideReadmissionFHIR</td>
                            
                            
                                <td>FirstPhysicalExamWithEncounterIdUsingLabTiming</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define function &quot;FirstPhysicalExamWithEncounterIdUsingLabTiming&quot;(ExamList List&lt;Observation&gt;, CCDE String):
  &quot;Inpatient Encounters&quot; Encounter
    let firstexamwithlabtiming: First(ExamList Exam
        where start of QICoreCommon.&quot;ToInterval&quot;(Exam.effective) is not null
          and start of QICoreCommon.&quot;ToInterval&quot;(Exam.effective) during Interval[start of Encounter.period - 1440 minutes, start of Encounter.period + 1440 minutes]
          and Exam.status in { 'final', 'amended', 'preliminary' }
          and Exam.value is not null
        sort by start of QICoreCommon.&quot;ToInterval&quot;(effective)
    )
    return '\r\n' &amp; CCDE &amp; ',' &amp; Encounter.id &amp; ',' &amp; ( ToString(firstexamwithlabtiming.value as Quantity) ) &amp; ',' &amp; ToString(start of QICoreCommon.&quot;ToInterval&quot;(firstexamwithlabtiming.effective))</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>HybridHospitalWideReadmissionFHIR</td>
                            
                            
                                <td>FirstLabTestWithEncounterId</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define function &quot;FirstLabTestWithEncounterId&quot;(LabList List&lt;Observation&gt;, CCDE String):
  &quot;Inpatient Encounters&quot; Encounter
    let firstlab: First(LabList Lab
        where Lab.issued is not null
          and Lab.issued during Interval[start of Encounter.period - 1440 minutes, start of Encounter.period + 1440 minutes]
          and Lab.status in { 'final', 'amended', 'preliminary' }
          and Lab.value is not null
        sort by issued
    )
    return '\r\n' &amp; CCDE &amp; ',' &amp; Encounter.id &amp; ',' &amp; ( ToString(firstlab.value as Quantity) ) &amp; ',' &amp; ToString(firstlab.issued)</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>FHIRHelpers</td>
                            
                            
                                <td>ToString</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="highlight language-cql"><code class="language-cql">define function ToString(value uri): value.value</code></pre>
                                </td>
                            
                        </tr>
                    
                        <tr>
                            <th><b>Library Name</b></th>
                            <th><b>Name</b></th>
                        </tr>
                        <tr>
                            
                                <td>FHIRHelpers</td>
                            
                            
                                <td>ToCode</td>
                            
                        </tr>
                        <tr>
                            
                                <td/>
                                <td>
                                    <pre class="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>
                    
                    </table>
                </td>
            </tr>
            
        
    

    </table>
</div>
  </text>
  <contained>
    <Library>
      <id value="effective-data-requirements"/>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode">
        <valueCoding>
          <system value="http://hl7.org/fhir/v3/AdministrativeGender"/>
          <code value="M"/>
          <display value="Male"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode">
        <valueCoding>
          <system value="http://hl7.org/fhir/v3/AdministrativeGender"/>
          <code value="F"/>
          <display value="Female"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode">
        <valueCoding>
          <system value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
          <code value="IMP"/>
          <display value="Inpatient"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode">
        <valueCoding>
          <system value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
          <code value="ACUTE"/>
          <display value="Acute"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode">
        <valueCoding>
          <system value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
          <code value="NONAC"/>
          <display value="Nonacute"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode">
        <valueCoding>
          <system value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
          <code value="OBSENC"/>
          <display value="Observation Encounter"/>
        </valueCoding>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="SupplementalDataElements"/>
        </extension>
        <extension url="name">
          <valueString value="SDE Sex"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;SDE Sex&quot;:&#xA;  case&#xA;      when Patient.gender = 'male' then &quot;M&quot;&#xA;      when Patient.gender = 'female' then &quot;F&quot;&#xA;      else null&#xA;    end"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="0"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="HybridHospitalWideReadmissionFHIR"/>
        </extension>
        <extension url="name">
          <valueString value="SDE Sex"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;SDE Sex&quot;:&#xA;  SDE.&quot;SDE Sex&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="1"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="HybridHospitalWideReadmissionFHIR"/>
        </extension>
        <extension url="name">
          <valueString value="Inpatient Encounters"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;Inpatient Encounters&quot;:&#xA;  from&#xA;    [&quot;Encounter&quot;: &quot;Encounter Inpatient&quot;] InpatientEncounter,&#xA;    [&quot;Coverage&quot;: &quot;Medicare payer&quot;] Payer&#xA;    where InpatientEncounter.status = 'finished'&#xA;      and ( InpatientEncounter.class ~ &quot;IMP&quot;&#xA;          or InpatientEncounter.class ~ &quot;ACUTE&quot;&#xA;          or InpatientEncounter.class ~ &quot;NONAC&quot;&#xA;          or InpatientEncounter.class ~ &quot;OBSENC&quot;&#xA;      )&#xA;      and InpatientEncounter.hospitalizationWithObservationLengthofStay ( ) &lt; 365&#xA;      and InpatientEncounter.period ends during &quot;Measurement Period&quot;&#xA;      and AgeInYearsAt(date from start of InpatientEncounter.period) &gt;= 65&#xA;    return InpatientEncounter"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="2"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="HybridHospitalWideReadmissionFHIR"/>
        </extension>
        <extension url="name">
          <valueString value="Results"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;Results&quot;:&#xA;  flatten {&#xA;     // First physical exams (vital signs)&#xA;  &quot;FirstPhysicalExamWithEncounterId&quot;([Observation: &quot;Heart Rate&quot;], 'FirstHeartRate'), &quot;FirstPhysicalExamWithEncounterId&quot;([Observation: &quot;Systolic Blood Pressure&quot;], 'FirstSystolicBP'), &quot;FirstPhysicalExamWithEncounterId&quot;([Observation: &quot;Respiratory Rate&quot;], 'FirstRespRate'), &quot;FirstPhysicalExamWithEncounterId&quot;([Observation: &quot;Body temperature&quot;], 'FirstTemperature'), &quot;FirstPhysicalExamWithEncounterId&quot;([Observation: &quot;Oxygen Saturation by Pulse Oximetry&quot;], 'FirstO2Saturation'),&#xA;      // First weight using lab test timing&#xA;  &quot;FirstPhysicalExamWithEncounterIdUsingLabTiming&quot;([Observation: &quot;Body weight&quot;], 'FirstWeight'), &#xA;       //First lab tests&#xA;  &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Hematocrit lab test&quot;], 'FirstHematocrit'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;White blood cells count lab test&quot;], 'FirstWhiteBloodCell'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Potassium lab test&quot;], 'FirstPotassium'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Sodium lab test&quot;], 'FirstSodium'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Bicarbonate lab test&quot;], 'FirstBicarbonate'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Creatinine lab test&quot;], 'FirstCreatinine'), &quot;FirstLabTestWithEncounterId&quot;([Observation: &quot;Glucose lab test&quot;], 'FirstGlucose') }"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="3"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="SupplementalDataElements"/>
        </extension>
        <extension url="name">
          <valueString value="SDE Payer"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;SDE Payer&quot;:&#xA;  [Coverage: type in &quot;Payer Type&quot;] Payer&#xA;    return {&#xA;      code: Payer.type,&#xA;      period: Payer.period&#xA;    }"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="4"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="HybridHospitalWideReadmissionFHIR"/>
        </extension>
        <extension url="name">
          <valueString value="SDE Payer"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;SDE Payer&quot;:&#xA;  SDE.&quot;SDE Payer&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="5"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="HybridHospitalWideReadmissionFHIR"/>
        </extension>
        <extension url="name">
          <valueString value="Initial Population"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;Initial Population&quot;:&#xA;  &quot;Inpatient Encounters&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="6"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="SupplementalDataElements"/>
        </extension>
        <extension url="name">
          <valueString value="SDE Ethnicity"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;SDE Ethnicity&quot;:&#xA;  Patient.ethnicity E&#xA;    return Tuple {&#xA;      codes: { E.ombCategory } union E.detailed,&#xA;      display: E.text&#xA;    }"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="7"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="HybridHospitalWideReadmissionFHIR"/>
        </extension>
        <extension url="name">
          <valueString value="SDE Ethnicity"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;SDE Ethnicity&quot;:&#xA;  SDE.&quot;SDE Ethnicity&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="8"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="SupplementalDataElements"/>
        </extension>
        <extension url="name">
          <valueString value="SDE Race"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;SDE Race&quot;:&#xA;  Patient.race R&#xA;    return Tuple {&#xA;      codes: R.ombCategory union R.detailed,&#xA;      display: R.text&#xA;    }"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="9"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="HybridHospitalWideReadmissionFHIR"/>
        </extension>
        <extension url="name">
          <valueString value="SDE Race"/>
        </extension>
        <extension url="statement">
          <valueString value="define &quot;SDE Race&quot;:&#xA;  SDE.&quot;SDE Race&quot;"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="10"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="HybridHospitalWideReadmissionFHIR"/>
        </extension>
        <extension url="name">
          <valueString value="FirstPhysicalExamWithEncounterId"/>
        </extension>
        <extension url="statement">
          <valueString value="define function &quot;FirstPhysicalExamWithEncounterId&quot;(ExamList List&lt;Observation&gt;, CCDE String):&#xA;  &quot;Inpatient Encounters&quot; Encounter&#xA;    let firstexam: First(ExamList Exam&#xA;        where start of QICoreCommon.&quot;ToInterval&quot;(Exam.effective) is not null&#xA;          and start of QICoreCommon.&quot;ToInterval&quot;(Exam.effective) during Interval[start of Encounter.period - 1440 minutes, start of Encounter.period + 120 minutes]&#xA;          and Exam.status in { 'final', 'amended', 'preliminary' }&#xA;          and Exam.value is not null&#xA;        sort by start of QICoreCommon.&quot;ToInterval&quot;(effective)&#xA;    )&#xA;    return '\r\n' &amp; CCDE &amp; ',' &amp; Encounter.id &amp; ',' &amp; ( ToString(firstexam.value as Quantity) ) &amp; ',' &amp; ToString(start of QICoreCommon.&quot;ToInterval&quot;(firstexam.effective))"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="11"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="CQMCommon"/>
        </extension>
        <extension url="name">
          <valueString value="hospitalizationWithObservationLengthofStay"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;@description: Hospitalization with Observation Length of Stay returns the length in days from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter&#xA;*/&#xA;define fluent function hospitalizationWithObservationLengthofStay(TheEncounter &quot;Encounter&quot; ):&#xA;  ((TheEncounter.&quot;hospitalizationWithObservation&quot;(). &quot;lengthInDays&quot;()))"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="12"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="CQMCommon"/>
        </extension>
        <extension url="name">
          <valueString value="lengthInDays"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;@description: Calculates the difference in calendar days between the start and end of the given interval.&#xA;*/&#xA;define fluent function lengthInDays(Value Interval&lt;DateTime&gt; ):&#xA;  difference in days between start of Value and end of Value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="13"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="CQMCommon"/>
        </extension>
        <extension url="name">
          <valueString value="hospitalizationWithObservation"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;@description: Hospitalization with Observation returns the total interval from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter&#xA;*/&#xA;define fluent function hospitalizationWithObservation(TheEncounter Encounter ):&#xA;  TheEncounter Visit&#xA;  &#x9;&#x9;let ObsVisit: Last([Encounter: &quot;Observation Services&quot;] LastObs&#xA;  &#x9;&#x9;&#x9;&#x9;where LastObs.status = 'finished'&#xA;            and LastObs.period ends 1 hour or less on or before start of Visit.period&#xA;  &#x9;&#x9;&#x9;&#x9;sort by end of period&#xA;  &#x9;&#x9;&#x9;),&#xA;  &#x9;&#x9;&#x9;VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),&#xA;  &#x9;&#x9;&#x9;EDVisit: Last([Encounter: &quot;Emergency Department Visit&quot;] LastED&#xA;  &#x9;&#x9;&#x9;&#x9;where LastED.status = 'finished'&#xA;            and LastED.period ends 1 hour or less on or before VisitStart&#xA;  &#x9;&#x9;&#x9;&#x9;sort by end of period&#xA;  &#x9;&#x9;&#x9;)&#xA;  &#x9;&#x9;return Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="14"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="QICoreCommon"/>
        </extension>
        <extension url="name">
          <valueString value="ToInterval"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval&#xA;@comment: Normalizes a choice type of DateTime, Quanitty, Interval&lt;DateTime&gt;, or Interval&lt;Quantity&gt; types&#xA;to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible&#xA;representations for timing-valued elements in QICore, allowing this function to be used across any resource.&#xA;The input can be provided as a DateTime, Quantity, Interval&lt;DateTime&gt; or Interval&lt;Quantity&gt;.&#xA;The intent of this function is to provide a clear and concise mechanism to treat single&#xA;elements that have multiple possible representations as intervals so that logic doesn't have to account&#xA;for the variability. More complex calculations (such as medication request period or dispense period&#xA;calculation) need specific guidance and consideration. That guidance may make use of this function, but&#xA;the focus of this function is on single element calculations where the semantics are unambiguous.&#xA;If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.&#xA;If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,&#xA;and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.&#xA;If the input is a DateTime Interval, the result is the input.&#xA;If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result&#xA;is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending&#xA;immediately before one year later than the date the patient turned the age given as the end of the quantity interval.&#xA;Any other input will reslt in a null DateTime Interval&#xA;@deprecated: This function is deprecated. Use the fluent function `toInterval()` instead&#xA;*/&#xA;define function ToInterval(choice Choice&lt;DateTime, Quantity, Interval&lt;DateTime&gt;, Interval&lt;Quantity&gt;&gt;):&#xA;  case&#xA;&#x9;  when choice is DateTime then&#xA;    &#x9;Interval[choice as DateTime, choice as DateTime]&#xA;&#x9;&#x9;when choice is Interval&lt;DateTime&gt; then&#xA;  &#x9;&#x9;choice as Interval&lt;DateTime&gt;&#xA;&#x9;&#x9;when choice is Quantity then&#xA;&#x9;&#x9;  Interval[Patient.birthDate + (choice as Quantity),&#xA;&#x9;&#x9;&#x9;  Patient.birthDate + (choice as Quantity) + 1 year)&#xA;&#x9;&#x9;when choice is Interval&lt;Quantity&gt; then&#xA;&#x9;&#x9;  Interval[Patient.birthDate + (choice.low as Quantity),&#xA;&#x9;&#x9;&#x9;  Patient.birthDate + (choice.high as Quantity) + 1 year)&#xA;&#x9;&#x9;when choice is QICore.Timing then&#xA;            null as Interval&lt;DateTime&gt;&#xA;&#x9;&#x9;else&#xA;&#x9;&#x9;&#x9;null as Interval&lt;DateTime&gt;&#xA;&#x9;end"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="15"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="HybridHospitalWideReadmissionFHIR"/>
        </extension>
        <extension url="name">
          <valueString value="FirstPhysicalExamWithEncounterIdUsingLabTiming"/>
        </extension>
        <extension url="statement">
          <valueString value="define function &quot;FirstPhysicalExamWithEncounterIdUsingLabTiming&quot;(ExamList List&lt;Observation&gt;, CCDE String):&#xA;  &quot;Inpatient Encounters&quot; Encounter&#xA;    let firstexamwithlabtiming: First(ExamList Exam&#xA;        where start of QICoreCommon.&quot;ToInterval&quot;(Exam.effective) is not null&#xA;          and start of QICoreCommon.&quot;ToInterval&quot;(Exam.effective) during Interval[start of Encounter.period - 1440 minutes, start of Encounter.period + 1440 minutes]&#xA;          and Exam.status in { 'final', 'amended', 'preliminary' }&#xA;          and Exam.value is not null&#xA;        sort by start of QICoreCommon.&quot;ToInterval&quot;(effective)&#xA;    )&#xA;    return '\r\n' &amp; CCDE &amp; ',' &amp; Encounter.id &amp; ',' &amp; ( ToString(firstexamwithlabtiming.value as Quantity) ) &amp; ',' &amp; ToString(start of QICoreCommon.&quot;ToInterval&quot;(firstexamwithlabtiming.effective))"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="16"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="HybridHospitalWideReadmissionFHIR"/>
        </extension>
        <extension url="name">
          <valueString value="FirstLabTestWithEncounterId"/>
        </extension>
        <extension url="statement">
          <valueString value="define function &quot;FirstLabTestWithEncounterId&quot;(LabList List&lt;Observation&gt;, CCDE String):&#xA;  &quot;Inpatient Encounters&quot; Encounter&#xA;    let firstlab: First(LabList Lab&#xA;        where Lab.issued is not null&#xA;          and Lab.issued during Interval[start of Encounter.period - 1440 minutes, start of Encounter.period + 1440 minutes]&#xA;          and Lab.status in { 'final', 'amended', 'preliminary' }&#xA;          and Lab.value is not null&#xA;        sort by issued&#xA;    )&#xA;    return '\r\n' &amp; CCDE &amp; ',' &amp; Encounter.id &amp; ',' &amp; ( ToString(firstlab.value as Quantity) ) &amp; ',' &amp; ToString(firstlab.issued)"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="17"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToString"/>
        </extension>
        <extension url="statement">
          <valueString value="define function ToString(value uri): value.value"/>
        </extension>
        <extension url="displaySequence">
          <valueInteger value="18"/>
        </extension>
      </extension>
      <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition">
        <extension url="libraryName">
          <valueString value="FHIRHelpers"/>
        </extension>
        <extension url="name">
          <valueString value="ToCode"/>
        </extension>
        <extension url="statement">
          <valueString value="/*&#xA;@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.&#xA;*/&#xA;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="19"/>
        </extension>
      </extension>
      <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="Library SDE"/>
        <resource value="http://ecqi.healthit.gov/ecqms/Library/SupplementalDataElements|3.4.000"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library FHIRHelpers"/>
        <resource value="http://ecqi.healthit.gov/ecqms/Library/FHIRHelpers|4.3.000"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library CQMCommon"/>
        <resource value="http://ecqi.healthit.gov/ecqms/Library/CQMCommon|1.4.000"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library QICoreCommon"/>
        <resource value="http://ecqi.healthit.gov/ecqms/Library/QICoreCommon|1.5.000"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Code system AdministrativeGender"/>
        <resource value="http://hl7.org/fhir/v3/AdministrativeGender"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Code system ActCode"/>
        <resource value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Encounter Inpatient"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Medicare payer"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1104.10"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Observation Services"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"/>
      </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"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Heart Rate"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.149"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Systolic Blood Pressure"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.163"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Respiratory Rate"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.130"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Body temperature"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.152"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Oxygen Saturation by Pulse Oximetry"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.151"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Body weight"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.159"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Hematocrit lab test"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.114"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set White blood cells count lab test"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.129"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Potassium lab test"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.117"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Sodium lab test"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.119"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Bicarbonate lab test"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.139"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Creatinine lab test"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.2363"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Glucose lab test"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.134"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Payer Type"/>
        <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
      </relatedArtifact>
      <parameter>
        <name value="Measurement Period"/>
        <use value="in"/>
        <min value="0"/>
        <max value="1"/>
        <type value="Period"/>
      </parameter>
      <parameter>
        <name value="SDE Sex"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="Coding"/>
      </parameter>
      <parameter>
        <name value="Results"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="string"/>
      </parameter>
      <parameter>
        <name value="SDE Payer"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Resource"/>
      </parameter>
      <parameter>
        <name value="Initial Population"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Resource"/>
      </parameter>
      <parameter>
        <name value="SDE Ethnicity"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="Resource"/>
      </parameter>
      <parameter>
        <name value="SDE Race"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="Resource"/>
      </parameter>
      <dataRequirement>
        <type value="Patient"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient"/>
        <mustSupport value="ethnicity"/>
        <mustSupport value="race"/>
      </dataRequirement>
      <dataRequirement>
        <type value="Encounter"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"/>
        <mustSupport value="type"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="period"/>
        <mustSupport value="id"/>
        <mustSupport value="id.value"/>
        <codeFilter>
          <path value="type"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"/>
        </codeFilter>
        <codeFilter>
          <path value="status.value"/>
          <code>
            <code value="finished"/>
          </code>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Encounter"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"/>
        <mustSupport value="type"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="period"/>
        <mustSupport value="id"/>
        <mustSupport value="id.value"/>
        <codeFilter>
          <path value="type"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"/>
        </codeFilter>
        <codeFilter>
          <path value="status.value"/>
          <code>
            <code value="finished"/>
          </code>
        </codeFilter>
        <dateFilter>
          <path value="period"/>
          <valuePeriod>
            <extension url="http://hl7.org/fhir/uv/crmi-analysisException">
              <valueString value="Error attempting to determine filter value: toFhirValue not implemented for Subtract"/>
            </extension>
          </valuePeriod>
        </dateFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Encounter"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"/>
        <mustSupport value="type"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="class"/>
        <mustSupport value="period"/>
        <mustSupport value="id"/>
        <mustSupport value="id.value"/>
        <codeFilter>
          <path value="type"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"/>
        </codeFilter>
        <dateFilter>
          <path value="period"/>
          <valuePeriod>
            <extension url="http://hl7.org/fhir/StructureDefinition/cqf-expression">
              <valueExpression>
                <language value="text/cql-identifier"/>
                <expression value="Measurement Period"/>
              </valueExpression>
            </extension>
          </valuePeriod>
        </dateFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Coverage"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage"/>
        <mustSupport value="type"/>
        <codeFilter>
          <path value="type"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1104.10"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Coverage"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage"/>
        <mustSupport value="type"/>
        <mustSupport value="period"/>
        <codeFilter>
          <path value="type"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.149"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.163"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.130"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.152"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.151"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.159"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.114"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.129"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.117"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.119"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.139"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.2363"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Observation"/>
        <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation"/>
        <mustSupport value="code"/>
        <mustSupport value="effective"/>
        <mustSupport value="status"/>
        <mustSupport value="status.value"/>
        <mustSupport value="value"/>
        <mustSupport value="issued"/>
        <mustSupport value="issued.value"/>
        <codeFilter>
          <path value="code"/>
          <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.134"/>
        </codeFilter>
      </dataRequirement>
    </Library>
  </contained>
  <extension id="supplementalDataGuidance" url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-supplementalDataGuidance">
    <extension url="guidance"/>
    <extension url="usage">
      <valueCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-data-usage"/>
          <code value="supplemental-data"/>
          <display value="Supplemental Data"/>
        </coding>
        <text value="Supplemental Data Guidance"/>
      </valueCodeableConcept>
    </extension>
  </extension>
  <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem">
    <valueReference>
      <reference value="Device/cqf-tooling"/>
    </valueReference>
  </extension>
  <extension id="effective-data-requirements" url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-effectiveDataRequirements">
    <valueReference>
      <reference value="#effective-data-requirements"/>
    </valueReference>
  </extension>
  <url value="http://ecqi.healthit.gov/ecqms/Measure/HybridHospitalWideReadmissionFHIR"/>
  <identifier>
    <use value="usual"/>
    <type>
      <coding>
        <system value="http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type"/>
        <code value="short-name"/>
      </coding>
    </type>
    <system value="https://madie.cms.gov/measure/shortName"/>
    <value value="CMS529FHIR"/>
  </identifier>
  <identifier>
    <use value="official"/>
    <type>
      <coding>
        <system value="http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type"/>
        <code value="version-independent"/>
      </coding>
    </type>
    <system value="urn:ietf:rfc:3986"/>
    <value value="urn:uuid:66842e26-2256-4a2d-8dac-dd014c425748"/>
  </identifier>
  <identifier>
    <use value="official"/>
    <type>
      <coding>
        <system value="http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type"/>
        <code value="version-specific"/>
      </coding>
    </type>
    <system value="urn:ietf:rfc:3986"/>
    <value value="urn:uuid:2c92808482113ece0182c5d39df62f0e"/>
  </identifier>
  <identifier>
    <use value="official"/>
    <type>
      <coding>
        <system value="http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type"/>
        <code value="endorser"/>
      </coding>
    </type>
    <system value="https://madie.cms.gov/measure/nqfId"/>
    <value value="2879"/>
    <assigner>
      <display value="NQF"/>
    </assigner>
  </identifier>
  <identifier>
    <use value="official"/>
    <type>
      <coding>
        <system value="http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type"/>
        <code value="publisher"/>
      </coding>
    </type>
    <system value="https://madie.cms.gov/measure/cmsId"/>
    <value value="529FHIR"/>
    <assigner>
      <display value="CMS"/>
    </assigner>
  </identifier>
  <version value="0.0.001"/>
  <name value="HybridHospitalWideReadmissionFHIR"/>
  <title value="Core Clinical Data Elements for the Hybrid Hospital-Wide Readmission (HWR) Measure with Claims and Electronic Health Record Data FHIR"/>
  <status value="draft"/>
  <experimental value="false"/>
  <date value="2023-10-27T08:12:32+00:00"/>
  <publisher value="Centers for Medicare &amp; Medicaid Services (CMS)"/>
  <contact>
    <telecom>
      <system value="url"/>
      <value value="https://www.cms.gov/"/>
    </telecom>
  </contact>
  <description value="This logic is intended to extract electronic clinical data. This is not an electronic clinical quality measure and this logic will not produce measure results. Instead, it will produce a file containing the data that CMS will link with administrative claims to risk adjust the Hybrid HWR outcome measure. It is designed to extract the first resulted set of vital signs and basic laboratory results obtained from encounters for adult Medicare Fee-For-Service patients admitted to acute care short stay hospitals."/>
  <purpose value="UNKNOWN"/>
  <usage value="This FHIR-based measure has been derived from the QDM-based measure: CMS529v3.1 (QDM 5.6)Please refer to the HL7 QI-Core Implementation Guide (http://hl7.org/fhir/us/qicore/index.html) for more information on QI-Core and mapping recommendations from QDM to QI-Core 4.1.1 (http://hl7.org/fhir/us/qicore/qdm-to-qicore.html). These specifications are for use for data with discharges that occur between July 1, 2023 and June 30, 2024. &#xA;&#xA;This logic guides the user to extract the FIRST resulted HWR-specific core clinical data elements for all Medicare Fee-For-Service encounters for patients age 65 or older (Initial Population) directly admitted to the hospital or admitted to the same facility after being treated in another area such as the emergency department or hospital outpatient location. &#xA;&#xA;The logic supports extraction of the FIRST set of HWR-specific core clinical data elements in two different ways depending on if the patient was a direct admission, meaning that the patient was admitted directly to an inpatient unit without first receiving care in the emergency department or other hospital outpatient locations within the same admitting facility: &#xA;&#xA;1. If the patient was a direct admission, the logic supports extraction of the FIRST resulted vital signs within 2 hours (120 minutes) after the start of the inpatient admission, and the FIRST resulted laboratory tests within 24 hours (1440 minutes) after the start of the inpatient admission. &#xA;2. If the patient has values captured prior to admission, for example from the emergency department, pre-operative, or other outpatient area within the hospital, the logic supports extraction of the FIRST resulted vital signs and laboratory tests within 24 hours (1440 minutes) PRIOR to the start of the inpatient admission. All clinical systems used in inpatient and outpatient locations within the hospital facility should be queried when looking for core clinical data element values related to a patient who is subsequently admitted.&#xA;&#xA;Value sets for the laboratory tests represent the LOINC codes currently available for these tests. If the institution is using local codes to capture and store relevant laboratory test data, those sites should map that information to the LOINC code for reporting of the core clinical data elements.&#xA;&#xA;NOTE: Do not report ALL values on an encounter during their entire admission. Only report the FIRST resulted value for EACH core clinical data element collected in the appropriate timeframe, if available.&#xA;&#xA;For each core clinical data element, please report values using one of the appropriate units of measurement listed below, which represent valid UCUM codes: &#xA;&#xA;Core Clinical Data Element                          UCUM Unit&#xA;&#xA;Bicarbonate----------------------------------meq/L &#xA;                                                             mmol/L &#xA;&#xA;Creatinine------------------------------------mg/dL &#xA;                                                             umol/L&#xA;&#xA;Glucose--------------------------------------mg/dL&#xA;                                                            mmol/L&#xA;&#xA;Heart rate------------------------------------{Beats}/min&#xA;&#xA;Hematocrit -----------------------------------%&#xA;&#xA;Oxygen saturation (by pulse oximetry)-----%{Oxygen}&#xA;&#xA;Potassium------------------------------------meq/L &#xA;                                                             mmol/L&#xA;&#xA;Respiratory rate------------------------------{Breaths}/min&#xA;&#xA;Sodium---------------------------------------meq/L&#xA;                                                             mmol/L&#xA; &#xA;Systolic blood pressure----------------------mm[Hg]&#xA;&#xA;Temperature----------------------------------Cel&#xA;                                                              [degF]  &#xA;&#xA;Weight-----------------------------------------kg&#xA;                                                               [lb_av]&#xA;                                                               g&#xA;                                                          &#xA;White blood cell count ----------------------{Cells}/uL&#xA;                                                              10*3/uL&#xA;                                                              10*9/L &#xA;                                                              /mm3&#xA; &#xA;For each encounter please also submit the following Linking Variables: &#xA;CMS Certification Number,&#xA;Health Insurance Claim Number (HICN) or Medicare Beneficiary Identifier (MBI),&#xA;Date of Birth,&#xA;Sex,&#xA;Inpatient Admission Date, and &#xA;Discharge Date.&#xA;&#xA;The initial population includes patients with inpatient hospitalizations and patients from Acute Hospital Care at Home programs, who are treated and billed as inpatients but receive care in their home."/>
  <copyright value="Limited proprietary coding is contained in these specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets.&#xA;&#xA;This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2021 International Health Terminology Standards Development Organisation. All rights reserved.&#xA;&#xA;LOINC(R) copyright 2004-2021 Regenstrief Institute, Inc."/>
  <approvalDate value="2023-08-14"/>
  <lastReviewDate value="2023-08-14"/>
  <effectivePeriod>
    <start value="2024-07-01"/>
    <end value="2025-06-30"/>
  </effectivePeriod>
  <author>
    <name value="Yale New Haven Health Service Corporation/ Center for Outcomes Research and Evaluation"/>
    <telecom>
      <system value="url"/>
      <value value="https://medicine.yale.edu/core/"/>
    </telecom>
  </author>
  <library value="http://ecqi.healthit.gov/ecqms/Library/HybridHospitalWideReadmissionFHIR"/>
  <disclaimer value="These performance specifications are not clinical guidelines and do not establish a standard of medical care, and have not been tested for all potential applications.&#xA;&#xA;THE MEASURES AND SPECIFICATIONS ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND.&#xA;&#xA;Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM]."/>
  <rationale value="The intent of this logic is to extract the FIRST set of clinical data elements from hospital electronic health records (EHRs) for all qualifying encounters. The data will be linked with administrative claims to risk adjust the Hybrid HWR outcome measure. This work addresses stakeholder concerns that clinical data garnered from patients, and used by clinicians to guide diagnostic decisions and treatment, are preferable to administrative claims data when profiling hospitals' case mix. We are calling the list of data elements for extraction the &quot;HWR-specific core clinical data elements&quot;. The core clinical data elements are the first set of vital signs and basic laboratory tests resulted from encounters for adult Medicare Fee-For-Service patients, age 65 or older (Initial Population), after they arrive at the hospital to which they are subsequently admitted. For example, this first set of data values are often captured in the emergency department or in the pre-operative area, sometimes hours before a patient is admitted to that same facility. &#xA;&#xA;These data elements were selected because they: 1. reflect patients' clinical status when they first present to the hospital, 2. are clinically and statistically relevant to patient outcomes, 3. are consistently obtained on adult inpatient encounters based on current clinical practice, 4. are captured with a standard definition and recorded in a standard format across providers, and 5. are entered in structured fields that are feasibly retrieved from current EHR systems (YNHHS/CORE, 2015).&#xA;&#xA;Additional data called Linking Variables are used to link EHR data files with administrative claims data for CMS to calculate results for the Hybrid HWR measure, which are: CMS Certification Number, Health Insurance Claim Number (HICN) or Medicare Beneficiary Identifier (MBI), date of birth, sex, admission date, and discharge date."/>
  <clinicalRecommendationStatement value="The logic is not meant to guide or alter the care patients receive. The purpose of this core clinical data elements logic is to extract clinical data that are already routinely captured in EHRs from encounters for hospitalized adult patients. It is not intended to require that clinical staff perform additional measurements or tests that are not needed for diagnostic assessment or treatment of patients."/>
  <group id="638501714ba3d47c885c02ac">
    <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring">
      <valueCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-scoring"/>
          <code value="cohort"/>
          <display value="Cohort"/>
        </coding>
      </valueCodeableConcept>
    </extension>
    <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis">
      <valueCode value="Encounter"/>
    </extension>
    <extension url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-type">
      <valueCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-type"/>
          <code value="outcome"/>
          <display value="Outcome"/>
        </coding>
      </valueCodeableConcept>
    </extension>
    <population id="087F31A7-36A7-4F47-AB51-E1264E96E0B8">
      <code>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-population"/>
          <code value="initial-population"/>
          <display value="Initial Population"/>
        </coding>
      </code>
      <description value="All Medicare Fee-For-Service encounters age 65 and older at the start of an inpatient admission, who are discharged during the measurement period (length of stay &lt;365 days).&#xA;&#xA;NOTE: All Medicare Fee-For-Service encounters meeting the above criteria should be included, regardless if Medicare Fee-For-Service is the primary, secondary, or tertiary payer."/>
      <criteria>
        <language value="text/cql-identifier"/>
        <expression value="Initial Population"/>
      </criteria>
    </population>
  </group>
  <supplementalData id="results">
    <usage>
      <coding>
        <system value="http://terminology.hl7.org/CodeSystem/measure-data-usage"/>
        <code value="supplemental-data"/>
      </coding>
    </usage>
    <description value="Results"/>
    <criteria>
      <language value="text/cql-identifier"/>
      <expression value="Results"/>
    </criteria>
  </supplementalData>
  <supplementalData id="sde-ethnicity">
    <usage>
      <coding>
        <system value="http://terminology.hl7.org/CodeSystem/measure-data-usage"/>
        <code value="supplemental-data"/>
      </coding>
    </usage>
    <description value="SDE Ethnicity"/>
    <criteria>
      <language value="text/cql-identifier"/>
      <expression value="SDE Ethnicity"/>
    </criteria>
  </supplementalData>
  <supplementalData id="sde-payer">
    <usage>
      <coding>
        <system value="http://terminology.hl7.org/CodeSystem/measure-data-usage"/>
        <code value="supplemental-data"/>
      </coding>
    </usage>
    <description value="SDE Payer"/>
    <criteria>
      <language value="text/cql-identifier"/>
      <expression value="SDE Payer"/>
    </criteria>
  </supplementalData>
  <supplementalData id="sde-race">
    <usage>
      <coding>
        <system value="http://terminology.hl7.org/CodeSystem/measure-data-usage"/>
        <code value="supplemental-data"/>
      </coding>
    </usage>
    <description value="SDE Race"/>
    <criteria>
      <language value="text/cql-identifier"/>
      <expression value="SDE Race"/>
    </criteria>
  </supplementalData>
  <supplementalData id="sde-sex">
    <usage>
      <coding>
        <system value="http://terminology.hl7.org/CodeSystem/measure-data-usage"/>
        <code value="supplemental-data"/>
      </coding>
    </usage>
    <description value="SDE Sex"/>
    <criteria>
      <language value="text/cql-identifier"/>
      <expression value="SDE Sex"/>
    </criteria>
  </supplementalData>
</Measure>