{
  "resourceType": "Bundle",
  "type": "transaction",
  "entry": [ {
    "fullUrl": "https://madie.cms.gov/Measure/CMS137FHIRSUDTxInitEngagement",
    "resource": {
      "resourceType": "Measure",
      "id": "CMS137FHIRSUDTxInitEngagement",
      "meta": {
        "profile": [ "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablemeasure", "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/computable-measure-cqfm", "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/publishable-measure-cqfm", "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/executable-measure-cqfm", "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cql-measure-cqfm", "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/elm-measure-cqfm", "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/proportion-measure-cqfm" ]
      },
      "text": {
        "status": "extensions",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"col-12\">\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n<td class=\"content-container\">Initiation and Engagement of Substance Use Disorder TreatmentFHIR</td>\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n<td class=\"content-container\">1.0.000</td>\n</tr>\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Short Name</th>\n\n\n<td class=\"content-container\">CMS137FHIR</td>\n</tr>\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">GUID (Version Independent)</th>\n\n\n<td class=\"content-container\">urn:uuid:7738a412-7fff-4276-a140-8ee4c08503a2</td>\n</tr>\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">GUID (Version Specific)</th>\n\n\n<td class=\"content-container\">urn:uuid:e156e1a3-4a76-4490-b3be-96a0d90f9b32</td>\n</tr>\n\n\n\n  \n    \n    \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">CMS Identifier</th>\n\n\n<td class=\"content-container\">137FHIR</td>\n</tr>\n\n  \n\n\n\n\n  \n    \n    \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Effective Period</th>\n\n\n<td class=\"content-container\">2026-01-01 through 2026-12-31</td>\n</tr>\n\n  \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward (Publisher)</th>\n\n\n<td class=\"content-container\">National Committee for Quality Assurance</td>\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Developer</th>\n\n\n<td class=\"content-container\">National Committee for Quality Assurance</td>\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n<td class=\"content-container\">Percentage of patients 13 years of age and older with a new substance use disorder (SUD) episode who received the following (Two rates are reported): a. Percentage of patients who initiated treatment, including either an intervention or medication for the treatment of SUD, within 14 days of the new SUD episode. b. Percentage of patients who engaged in ongoing treatment, including two additional interventions or medication treatment events for SUD, or one long-acting medication event for the treatment of SUD, within 34 days of the initiation.</td>\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Copyright</th>\n\n\n<td class=\"content-container\">This Physician Performance Measure (Measure) and related data specifications are owned and were developed by the National Committee for Quality Assurance (NCQA). NCQA is not responsible for any use of the Measure. NCQA makes no representations, warranties or endorsements about the quality of any product, test or protocol identified as numerator compliant or otherwise identified as meeting the requirements of the measure or specification. NCQA makes no representations, warranties, or endorsement about the quality of any organization or physician that uses or reports performance measures and NCQA has no liability to anyone who relies on such measures or specifications. NCQA holds a copyright in the Measure. The Measure may be used for internal, noncommercial purposes (e.g., use by healthcare providers in connection with their practices) without obtaining approval from NCQA. All other uses, including a commercial use (including but not limited to vendors using or embedding the measures and specifications into any product or service to calculate measure results for customers for any purpose), must be approved by NCQA and are subject to a license at the discretion of NCQA. (C) 2012-2025 National Committee for Quality Assurance. All Rights Reserved. Limited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets. NCQA disclaims all liability for use or accuracy of any third-party codes contained in the specifications. CPT(R) codes, descriptions and other data are copyright 2025. American Medical Association. All rights reserved. CPT is a trademark of the American Medical Association. Fee schedules, relative value units, conversion factors and/or related components are not assigned by the AMA, are not part of CPT, and the AMA is not recommending their use. The AMA does not directly or indirectly practice medicine or dispense medical services. The AMA assumes no liability for data contained or not contained herein. Applicable FARS/DFARS restrictions apply to government use. Some measure specifications contain coding from LOINC(R) (https://loinc.org). The LOINC table, LOINC codes, LOINC panels and form file, LOINC linguistic variants file, LOINC/RSNA Radiology Playbook, and LOINC/IEEE Medical Device Code Mapping Table are copyright 2004-2025 Regenstrief Institute, Inc. and the Logical Observation Identifiers Names and Codes (LOINC) Committee, and are available at no cost under the license at https://loinc.org/kb/license/. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation. ICD-10 copyright 2025 World Health Organization. All Rights Reserved. Some measures use RxNorm, a standardized nomenclature and coding for clinical drugs and drug delivery devices, which is made publicly available courtesy of the U.S. National Library of Medicine (NLM), National Institutes of Health, Department of Health and Human Services. NLM is not responsible for the measures and does not endorse or recommend this or any other product. “HL7” is the registered trademark of Health Level Seven International.</td>\n</tr>\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Disclaimer</th>\n\n\n<td class=\"content-container\">The performance Measure is not a clinical guideline and does not establish a standard of medical care, and has not been tested for all potential applications. THE MEASURE AND SPECIFICATIONS ARE PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND. Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].</td>\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Rationale</th>\n\n\n<td class=\"content-container\">There are more deaths, illnesses and disabilities from substance abuse than from any other preventable health condition. In 2021, 46.3 million individuals in the U.S. age 12 or older (16.5 percent of the population) met the diagnosis criteria for having an SUD within the past year (Substance Abuse and Mental Health Services Administration [SAMHSA], 2022). Despite the high prevalence of SUD in the U.S., 94 percent of individuals aged 12 or older with an SUD did not receive any treatment (SAMHSA, 2022).</td>\n</tr>\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Clinical Recommendation Statement</th>\n\n\n<td class=\"content-container\">American Society of Addiction Medicine (2020) - All Food and Drug Administration approved medications for the treatment of opioid use disorder should be available to all patients. Clinicians should consider the patient’s preferences, past treatment history, current state of illness, and treatment setting when deciding between the use of methadone, buprenorphine, and naltrexone. - There is no recommended time limit for pharmacological treatment - Patients’ psychosocial needs should be assessed, and patients should be offered or referred to psychosocial treatment based on their individual needs. However, a patient’s decision to decline psychosocial treatment or the absence of available psychosocial treatment should not preclude or delay pharmacotherapy, with appropriate medication management. Motivational interviewing or enhancement can be used to encourage patients to engage in psychosocial treatment services appropriate for addressing individual needs. American Psychiatric Association (2018) - Patients with alcohol use disorder should have a documented comprehensive and person-centered treatment plan that includes evidence-based nonpharmacological and pharmacological treatments. [1C] - Naltrexone or acamprosate should be offered to patients with moderate to severe alcohol use disorder who have a goal of reducing alcohol consumption or achieving abstinence, prefer pharmacotherapy or have not responded to nonpharmacological treatments alone, and have no contraindications to the use of these medications. [1B] - Disulfiram should be offered to patients with moderate to severe alcohol use disorder who have a goal of achieving abstinence, prefer disulfiram or are intolerant to or have not responded to naltrexone and acamprosate, are capable of understanding the risks of alcohol consumption while taking disulfiram, and have no contraindications to the use of this medication. [2C] - Topiramate or gabapentin should be offered to patients with moderate to severe alcohol use disorder who have a goal of reducing alcohol consumption or achieving abstinence, prefer topiramate or gabapentin or are intolerant to or have not responded to naltrexone and acamprosate, and have no contraindications to the use of these medications. [2C] American Psychiatric Association (2006) - Because many substance use disorders are chronic, patients usually require long-term treatment, although the intensity and specific components of treatment may vary over time [I rating]. - It is important to intensify the monitoring for substance use during periods when the patient is at a high risk of relapsing, including during the early stages of treatment, times of transition to less intensive levels of care, and the first year after active treatment has ceased [I rating]. - Outpatient treatment of substance use disorders is appropriate for patients whose clinical condition or environmental circumstances do not require a more intensive level of care [I rating]. As in other treatment settings, a comprehensive approach is optimal, using, where indicated, a variety of psychotherapeutic and pharmacological interventions along with behavioral monitoring [I rating]. - Disulfiram is also recommended for patients with alcohol dependence [II rating]. - Naltrexone, injectable naltrexone, acamprosate, a y-aminobutyric acid (GABA) are recommended for patients with alcohol dependence [I rating]. Disulfiram is also recommended for patients with alcohol dependence [II rating]. - Methadone and buprenorphine are recommended for patients with opioid dependence [I rating]. - Naltrexone is an alternative strategy [I rating]. American Society of Addiction Medicine (2015) - Methadone and buprenorphine are recommended for opioid use disorder treatment and withdrawal management. - Naltrexone (oral; extended-release injectable) is recommended for relapse prevention. Michigan Quality Improvement Consortium (2021) - Patients with substance use disorder or risky substance use: Patient Education and Brief Intervention by a Primary Care Physician (PCP) or Trained Staff (e.g., Registered Nurse [RN], Master of Social Work [MSW]) - If diagnosed with substance use disorder or risky substance use, initiate an intervention within 14 days. - Frequent follow-up is helpful to support behavior change; preferably 2 visits within 30 days. - Refer to a substance abuse health specialist, an addiction physician specialist, or a physician experienced in pharmacologic management of addiction. Department of Veterans Affairs/Department of Defense (2015) - Offer referral to specialty SUD care for addiction treatment based on willingness to engage. [B] - For patients with moderate-severe alcohol use disorder, we recommend: Acamprosate, Disulfiram, Naltrexone- oral or extended release, or Topiramate. [A] - Medications should be offered in combined with addiction-focused counseling, offering one or more of the following interventions considering patient preference and provider training/competence: Behavioral Couples Therapy for alcohol use disorder, Cognitive Behavioral Therapy for substance use disorders, Community Reinforcement Approach, Motivational Enhancement Therapy, 12-Step Facilitation. [A] - For patients with opioid use disorder we recommend buprenorphine/naloxone or methadone in an Opioid Treatment Program. For patients for whom agonist treatment is contraindicated, unacceptable, unavailable, or discontinued, we recommend extended-release injectable naltrexone. [A] - For patients initiated in an intensive phase of outpatient or residential treatment, recommend ongoing systematic relapse prevention efforts or recovery support, individualized on the basis of treatment response. [A]</td>\n</tr>\n\n\n\n\n<tr>\n  \n  \n  \n  \n\n<th scope=\"row\" class=\"row-header\">Citation</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    \n    \n    American Psychiatric Association, Kleber, H. D., &amp; McIntyre, J. S. (2006). Practice Guideline for Treatment of Patients with Substance Use Disorders (pp. 1-276). Arlington, VA: American Psychiatric Association.\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n<tr>\n  \n  \n  \n  \n\n<th scope=\"row\" class=\"row-header\">Citation</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    \n    \n    American Society of Addiction Medicine (ASAM). (2020). The ASAM National Practice Guideline for the Treatment of Opioid Use Disorder: 2020 Focused Update.\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n<tr>\n  \n  \n  \n  \n\n<th scope=\"row\" class=\"row-header\">Citation</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    \n    \n    Department of Veteran Affairs, Department of Defense. (2015). VA/DoD Clinical Practice Guideline for the Management of Substance Use Disorders. Washington DC: Department of Veterans Affairs, Department of Defense.\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n<tr>\n  \n  \n  \n  \n\n<th scope=\"row\" class=\"row-header\">Citation</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    \n    \n    Kampman, K., Jarvis, M. (2015). The ASAM National Practice Guideline for the Use of Medications in the Treatment of Addiction Involving Opioid Use. Journal of Addiction Medicine; 9(5), 358–367. https://doi.org/10.1097/ADM.0000000000000166\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n<tr>\n  \n  \n  \n  \n\n<th scope=\"row\" class=\"row-header\">Citation</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    \n    \n    Michigan Quality Improvement Consortium. (2021). Screening, Diagnosis and Referral for Substance Use Disorders. Southfield, (MI): Michigan Quality Improvement Consortium. Retrieved from https://www.improve.health/wp-content/uploads/2023/04/mqicscreeningdiagnosisandreferralforsubstanceusedisordersFINAL-1.pdf\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n<tr>\n  \n  \n  \n  \n\n<th scope=\"row\" class=\"row-header\">Citation</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    \n    \n    Reus, V. et al. (2018). Practice Guideline for the Pharmacological Treatment of Patients with Alcohol Use Disorder. American Journal of Psychiatry, 175(1), 86-90. https://doi.org/10.1176/appi.ajp.2017.1750101\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n<tr>\n  \n  \n  \n  \n\n<th scope=\"row\" class=\"row-header\">Citation</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    \n    \n    Substance Abuse and Mental Health Services Administration (SAMHSA). (2022). Key substance use and mental health indicators in the United States: Results from the 2021 National Survey on Drug Use and Health (HHS Publication No. PEP22-07-01-005, NSDUH Series H-57). Center for Behavioral Health Statistics and Quality, Substance Abuse and Mental Health Services Administration. https://www.samhsa.gov/data/report/2021-nsduh-annual-national-report\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n\n\n\n\n\n  \n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Definition</th>\n\n\n<td class=\"content-container\">Initiation of Treatment: The initiation of treatment is the first SUD treatment within 14 days of a new SUD episode. Treatment includes inpatient SUD admissions, outpatient visits, intensive outpatient encounters or partial hospitalizations, and medications for the treatment of SUD.</td>\n</tr>\n\n\n  \n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Definition</th>\n\n\n<td class=\"content-container\">New SUD Episode: The new SUD episode is the first encounter during the Intake Period with a diagnosis of SUD with no encounter or medication treatment for a diagnosis of SUD in the 60 days prior.</td>\n</tr>\n\n\n  \n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Definition</th>\n\n\n<td class=\"content-container\">The Intake Period: January 1-November 14 of the measurement year. The Intake Period is used to capture new SUD episodes. The November 14 cut-off date ensures that all services can occur before the measurement period ends.</td>\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Guidance (Usage)</th>\n\n\n<td class=\"content-container\">This eCQM is a patient-based measure. This FHIR-based measure has been derived from the QDM-based measure: CMS137v14. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU6/) for more information on QI-Core and mapping recommendations from QDM to QI-Core STU 6. (https://hl7.org/fhir/us/qicore/STU6/qdm-to-qicore.html).</td>\n</tr>\n\n\n\n  \n    \n    <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Measure Group (Rate) (ID: Group_1)</th>\n\n\n</tr>\n  \n  \n  \n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Basis</th>\n\n\n<td class=\"content-container\">boolean</td>\n</tr>\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Scoring</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/measure-scoring#proportion: 'Proportion']</td>\n</tr>\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/measure-type#process: 'Process']</td>\n</tr>\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Rate Aggregation</th>\n\n\n<td class=\"content-container\">None</td>\n</tr>\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Improvement Notation</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/measure-improvement-notation#increase: 'Increased score indicates improvement']</td>\n</tr>\n\n\n  \n  \n    <tr>\n      \n        \n\n<th scope=\"row\" class=\"row-header\">Initial Population</th>\n\n\n      \n      <td class=\"content-container\">\n        \n        <em>ID</em>: InitialPopulation_1\n        <br/>\n        \n        \n          <em>Description</em>:\n          <p style=\"white-space: pre-line\" class=\"tab-one\">Patients 13 years of age and older as of the start of the measurement period who were diagnosed with a new SUD episode during a visit between January 1 and November 14 of the measurement period</p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms137fhirsudtxinitengagement-initial-population\">Initial Population</a> \n          \n        \n      </td>\n    </tr>\n  \n\n  \n    <tr>\n      \n        \n\n<th scope=\"row\" class=\"row-header\">Denominator</th>\n\n\n      \n      <td class=\"content-container\">\n        \n        <em>ID</em>: Denominator_1\n        <br/>\n        \n        \n          <em>Description</em>:\n          <p style=\"white-space: pre-line\" class=\"tab-one\">Equals Initial Population</p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms137fhirsudtxinitengagement-denominator\">Denominator</a> \n          \n        \n      </td>\n    </tr>\n  \n\n  \n    <tr>\n      \n        \n\n<th scope=\"row\" class=\"row-header\">Denominator Exclusion</th>\n\n\n      \n      <td class=\"content-container\">\n        \n        <em>ID</em>: DenominatorExclusion_1\n        <br/>\n        \n        \n          <em>Description</em>:\n          <p style=\"white-space: pre-line\" class=\"tab-one\">Exclude patients who are in hospice care for any part of the measurement period</p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms137fhirsudtxinitengagement-denominator-exclusions\">Denominator Exclusions</a> \n          \n        \n      </td>\n    </tr>\n  \n\n  \n    <tr>\n      \n        \n\n<th scope=\"row\" class=\"row-header\">Numerator</th>\n\n\n      \n      <td class=\"content-container\">\n        \n        <em>ID</em>: Numerator_1\n        <br/>\n        \n        \n          <em>Description</em>:\n          <p style=\"white-space: pre-line\" class=\"tab-one\">Initiation of treatment includes either an intervention or medication for the treatment of SUD within 14 days of the new SUD episode.</p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms137fhirsudtxinitengagement-numerator-1\">Numerator 1</a> \n          \n        \n      </td>\n    </tr>\n  \n\n  \n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Stratifier</th>\n\n\n  <td class=\"content-container\">\n    \n      <em>ID</em>: Stratification_1_1\n      \n        <br/>\n      \n    \n    \n    \n      <em>Description</em>: Report a total score, and each of the following strata: Stratum 1: Patients age 13-17 at the start of the measurement period\n    \n  </td>\n</tr>\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Stratifier</th>\n\n\n  <td class=\"content-container\">\n    \n      <em>ID</em>: Stratification_1_2\n      \n        <br/>\n      \n    \n    \n    \n      <em>Description</em>: Stratum 2: Patients age 18-64 at the start of the measurement period\n    \n  </td>\n</tr>\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Stratifier</th>\n\n\n  <td class=\"content-container\">\n    \n      <em>ID</em>: Stratification_1_3\n      \n        <br/>\n      \n    \n    \n    \n      <em>Description</em>: Stratum 3: Patients age 65 and older at the start of the measurement period\n    \n  </td>\n</tr>\n\n\n  \n    \n    <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Measure Group (Rate) (ID: Group_2)</th>\n\n\n</tr>\n  \n  \n  \n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Basis</th>\n\n\n<td class=\"content-container\">boolean</td>\n</tr>\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Scoring</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/measure-scoring#proportion: 'Proportion']</td>\n</tr>\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/measure-type#process: 'Process']</td>\n</tr>\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Rate Aggregation</th>\n\n\n<td class=\"content-container\">None</td>\n</tr>\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Improvement Notation</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/measure-improvement-notation#increase: 'Increased score indicates improvement']</td>\n</tr>\n\n\n  \n  \n    <tr>\n      \n        \n\n<th scope=\"row\" class=\"row-header\">Initial Population</th>\n\n\n      \n      <td class=\"content-container\">\n        \n        <em>ID</em>: InitialPopulation_2\n        <br/>\n        \n        \n          <em>Description</em>:\n          <p style=\"white-space: pre-line\" class=\"tab-one\">Patients 13 years of age and older as of the start of the measurement period who were diagnosed with a new SUD episode during a visit between January 1 and November 14 of the measurement period</p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms137fhirsudtxinitengagement-initial-population\">Initial Population</a> \n          \n        \n      </td>\n    </tr>\n  \n\n  \n    <tr>\n      \n        \n\n<th scope=\"row\" class=\"row-header\">Denominator</th>\n\n\n      \n      <td class=\"content-container\">\n        \n        <em>ID</em>: Denominator_2\n        <br/>\n        \n        \n          <em>Description</em>:\n          <p style=\"white-space: pre-line\" class=\"tab-one\">Equals Initial Population</p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms137fhirsudtxinitengagement-denominator\">Denominator</a> \n          \n        \n      </td>\n    </tr>\n  \n\n  \n    <tr>\n      \n        \n\n<th scope=\"row\" class=\"row-header\">Denominator Exclusion</th>\n\n\n      \n      <td class=\"content-container\">\n        \n        <em>ID</em>: DenominatorExclusion_2\n        <br/>\n        \n        \n          <em>Description</em>:\n          <p style=\"white-space: pre-line\" class=\"tab-one\">Exclude patients who are in hospice care for any part of the measurement period</p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms137fhirsudtxinitengagement-denominator-exclusions\">Denominator Exclusions</a> \n          \n        \n      </td>\n    </tr>\n  \n\n  \n    <tr>\n      \n        \n\n<th scope=\"row\" class=\"row-header\">Numerator</th>\n\n\n      \n      <td class=\"content-container\">\n        \n        <em>ID</em>: Numerator_2\n        <br/>\n        \n        \n          <em>Description</em>:\n          <p style=\"white-space: pre-line\" class=\"tab-one\">Engagement in ongoing SUD treatment within 34 days of initiation includes: 1. A long-acting SUD medication on the day after the initiation through 34 days after the initiation of treatment. 2. One of the following options on the day after the initiation of treatment through 34 days after the initiation of treatment: a) two engagement visits, b) two engagement medication treatment events, c) one engagement visit and one engagement medication treatment event.</p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms137fhirsudtxinitengagement-numerator-2\">Numerator 2</a> \n          \n        \n      </td>\n    </tr>\n  \n\n  \n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Stratifier</th>\n\n\n  <td class=\"content-container\">\n    \n      <em>ID</em>: Stratification_2_1\n      \n        <br/>\n      \n    \n    \n    \n      <em>Description</em>: Report a total score, and each of the following strata: Stratum 1: Patients age 13-17 at the start of the measurement period\n    \n  </td>\n</tr>\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Stratifier</th>\n\n\n  <td class=\"content-container\">\n    \n      <em>ID</em>: Stratification_2_2\n      \n        <br/>\n      \n    \n    \n    \n      <em>Description</em>: Stratum 2: Patients age 18-64 at the start of the measurement period\n    \n  </td>\n</tr>\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Stratifier</th>\n\n\n  <td class=\"content-container\">\n    \n      <em>ID</em>: Stratification_2_3\n      \n        <br/>\n      \n    \n    \n    \n      <em>Description</em>: Stratum 3: Patients age 65 and older at the start of the measurement period\n    \n  </td>\n</tr>\n\n\n\n  \n    \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Supplemental Data Guidance</th>\n\n\n<td class=\"content-container\">For every patient evaluated by this measure also identify payer, race, ethnicity and sex</td>\n</tr>\n\n  \n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Supplemental Data Elements</th>\n\n\n</tr>\n\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Supplemental Data Element</th>\n\n\n  <td class=\"content-container\">\n    \n      <em>ID</em>: sde-ethnicity\n      \n      <br/>\n      \n    \n    \n      \n        \n          <em>Usage Code</em>: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data]\n        \n        <br/>\n      \n    \n    \n      <em>Description</em>: SDE Ethnicity\n    \n    \n      \n        <br/>\n        \n        <em>Logic Definition</em>: <a href=\"#cms137fhirsudtxinitengagement-sde-ethnicity\">SDE Ethnicity</a> \n      \n    \n  </td>\n</tr>\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Supplemental Data Element</th>\n\n\n  <td class=\"content-container\">\n    \n      <em>ID</em>: sde-payer\n      \n      <br/>\n      \n    \n    \n      \n        \n          <em>Usage Code</em>: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data]\n        \n        <br/>\n      \n    \n    \n      <em>Description</em>: SDE Payer\n    \n    \n      \n        <br/>\n        \n        <em>Logic Definition</em>: <a href=\"#cms137fhirsudtxinitengagement-sde-payer\">SDE Payer</a> \n      \n    \n  </td>\n</tr>\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Supplemental Data Element</th>\n\n\n  <td class=\"content-container\">\n    \n      <em>ID</em>: sde-race\n      \n      <br/>\n      \n    \n    \n      \n        \n          <em>Usage Code</em>: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data]\n        \n        <br/>\n      \n    \n    \n      <em>Description</em>: SDE Race\n    \n    \n      \n        <br/>\n        \n        <em>Logic Definition</em>: <a href=\"#cms137fhirsudtxinitengagement-sde-race\">SDE Race</a> \n      \n    \n  </td>\n</tr>\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Supplemental Data Element</th>\n\n\n  <td class=\"content-container\">\n    \n      <em>ID</em>: sde-sex\n      \n      <br/>\n      \n    \n    \n      \n        \n          <em>Usage Code</em>: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data]\n        \n        <br/>\n      \n    \n    \n      <em>Description</em>: SDE Sex\n    \n    \n      \n        <br/>\n        \n        <em>Logic Definition</em>: <a href=\"#cms137fhirsudtxinitengagement-sde-sex\">SDE Sex</a> \n      \n    \n  </td>\n</tr>\n\n\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Measure Logic</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Primary Library</th>\n\n\n<td class=\"content-container\">https://madie.cms.gov/Library/CMS137FHIRSUDTxInitEngagement</td>\n</tr>\n\n\n\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Contents</th>\n  <td class=\"content-container\">\n    <em><a href=\"#population-criteria\">Population Criteria</a></em>\n    <br/>\n    <em><a href=\"#definitions\">Logic Definitions</a></em>\n    <br/>\n    <em><a href=\"#terminology\">Terminology</a></em>\n    <br/>\n    <em><a href=\"#dependencies\">Dependencies</a></em>\n    <br/>\n    <em><a href=\"#data-requirements\">Data Requirements</a></em>\n    <br/>\n  </td>\n</tr>\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"population-criteria\"> </a>Population Criteria</th>\n\n\n</tr>\n  \n  \n  \n  \n    \n    <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Measure Group (Rate) (ID: Group_1)</th>\n\n\n</tr>\n  \n  \n  \n  \n    \n      \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n            \n              \n            \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-initial-population\"> </a>\n    \n    \n    Initial Population\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Initial Population&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) &gt;= 13\n    and &quot;First SUD Episode During Measurement Period&quot; is not null\n    and not exists &quot;History of SUD Diagnosis or Treatment&quot;</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n      \n    \n  \n\n  \n    \n      \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n            \n              \n            \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-denominator\"> </a>\n    \n    \n    Denominator\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Denominator&quot;:\n  &quot;Initial Population&quot;</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n      \n    \n  \n\n  \n    \n      \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n            \n              \n            \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-denominator-exclusions\"> </a>\n    \n    \n    Denominator Exclusion\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Denominator Exclusions&quot;:\n  Hospice.&quot;Has Hospice Services&quot;</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n      \n    \n  \n\n  \n    \n      \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n            \n              \n            \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-numerator-1\"> </a>\n    \n    \n    Numerator\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Numerator 1&quot;:\n  exists &quot;Treatment Initiation With Non Medication Intervention Dates&quot;\n    or exists &quot;Treatment Initiation With Medication Order Dates&quot;</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n      \n    \n  \n\n  \n  \n    \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-stratification-1\"> </a>\n    \n    \n    Stratifier\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Stratification 1&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) in Interval[13, 17]</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n    \n  \n\n  \n    \n        \n          \n        \n          \n        \n          \n        \n          \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-stratification-2\"> </a>\n    \n    \n    Stratifier\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Stratification 2&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) in Interval[18, 64]</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n    \n  \n\n  \n    \n        \n          \n        \n          \n        \n          \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-stratification-3\"> </a>\n    \n    \n    Stratifier\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Stratification 3&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) &gt;= 65</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n    \n  \n\n  \n\n  \n    \n    <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Measure Group (Rate) (ID: Group_2)</th>\n\n\n</tr>\n  \n  \n  \n  \n    \n      \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n            \n              \n            \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-initial-population\"> </a>\n    \n    \n    Initial Population\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Initial Population&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) &gt;= 13\n    and &quot;First SUD Episode During Measurement Period&quot; is not null\n    and not exists &quot;History of SUD Diagnosis or Treatment&quot;</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n      \n    \n  \n\n  \n    \n      \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n            \n              \n            \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-denominator\"> </a>\n    \n    \n    Denominator\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Denominator&quot;:\n  &quot;Initial Population&quot;</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n      \n    \n  \n\n  \n    \n      \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n            \n              \n            \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-denominator-exclusions\"> </a>\n    \n    \n    Denominator Exclusion\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Denominator Exclusions&quot;:\n  Hospice.&quot;Has Hospice Services&quot;</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n      \n    \n  \n\n  \n    \n      \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n            \n              \n            \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-numerator-2\"> </a>\n    \n    \n    Numerator\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Numerator 2&quot;:\n  &quot;Has Treatment Engagement With Long Acting Medication&quot;\n    or &quot;Has Two or More Treatment Engagements With Short Acting Medication or Non Medication Intervention&quot;</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n      \n    \n  \n\n  \n  \n    \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-stratification-1\"> </a>\n    \n    \n    Stratifier\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Stratification 1&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) in Interval[13, 17]</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n    \n  \n\n  \n    \n        \n          \n        \n          \n        \n          \n        \n          \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-stratification-2\"> </a>\n    \n    \n    Stratifier\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Stratification 2&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) in Interval[18, 64]</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n    \n  \n\n  \n    \n        \n          \n        \n          \n        \n          \n            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms137fhirsudtxinitengagement-stratification-3\"> </a>\n    \n    \n    Stratifier\n    \n  </th>\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Stratification 3&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) &gt;= 65</code></pre>\n  </td>\n\n</tr>\n\n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n    \n  \n\n  \n\n  \n  \n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"definitions\"> </a>Logic Definitions</th>\n\n\n</tr>\n  \n  \n          \n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"hospice-has-hospice-services\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> Hospice</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Has Hospice Services&quot;:\n  exists ((([Encounter: &quot;Encounter Inpatient&quot;]).isEncounterPerformed()) InpatientEncounter\n      where (InpatientEncounter.hospitalization.dischargeDisposition ~ &quot;Discharge to home for hospice care (procedure)&quot;\n          or InpatientEncounter.hospitalization.dischargeDisposition ~ &quot;Discharge to healthcare facility for hospice care (procedure)&quot;\n      )\n        and InpatientEncounter.period ends during day of &quot;Measurement Period&quot;\n  )\n    or exists ((([Encounter: &quot;Hospice Encounter&quot;]).isEncounterPerformed()) HospiceEncounter\n        where HospiceEncounter.period overlaps day of &quot;Measurement Period&quot;\n    )\n    or exists ((([ObservationScreeningAssessment: &quot;Hospice care [Minimum Data Set]&quot;]).isAssessmentPerformed()) HospiceAssessment\n        where HospiceAssessment.value ~ &quot;Yes (qualifier value)&quot;\n          and HospiceAssessment.effective.toInterval() overlaps day of &quot;Measurement Period&quot;\n    )\n    or exists ((([ServiceRequest: &quot;Hospice Care Ambulatory&quot;]).isInterventionOrder()) HospiceOrder\n        where HospiceOrder.authoredOn during day of &quot;Measurement Period&quot;\n    )\n    or exists ((([Procedure: &quot;Hospice Care Ambulatory&quot;]).isInterventionPerformed()) HospicePerformed\n        where HospicePerformed.performed.toInterval() overlaps day of &quot;Measurement Period&quot;\n    )\n    or exists ((([ConditionProblemsHealthConcerns: &quot;Hospice Diagnosis&quot;]\n        union [ConditionEncounterDiagnosis: &quot;Hospice Diagnosis&quot;]).verified()) HospiceCareDiagnosis\n        where HospiceCareDiagnosis.prevalenceInterval() overlaps day of &quot;Measurement Period&quot;\n    )</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n\n        \n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"supplementaldataelements-sde-sex\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> SupplementalDataElements</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;SDE Sex&quot;:\n  case\n    when Patient.sex = '248153007' then &quot;Male (finding)&quot;\n    when Patient.sex = '248152002' then &quot;Female (finding)&quot;\n    else null\n  end</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"supplementaldataelements-sde-payer\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> SupplementalDataElements</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;SDE Payer&quot;:\n  [Coverage: type in &quot;Payer Type&quot;] Payer\n    return {\n      code: Payer.type,\n      period: Payer.period\n    }</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"supplementaldataelements-sde-ethnicity\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> SupplementalDataElements</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;SDE Ethnicity&quot;:\n  Patient.ethnicity E\n    return Tuple {\n      codes: { E.ombCategory } union E.detailed,\n      display: E.text\n    }</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"supplementaldataelements-sde-race\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> SupplementalDataElements</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;SDE Race&quot;:\n  Patient.race R\n    return Tuple {\n      codes: R.ombCategory union R.detailed,\n      display: R.text\n    }</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n\n        \n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-sde-sex\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;SDE Sex&quot;:\n  SDE.&quot;SDE Sex&quot;</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-stratification-3\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Stratification 3&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) &gt;= 65</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-stratification-2\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Stratification 2&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) in Interval[18, 64]</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-stratification-1\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Stratification 1&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) in Interval[13, 17]</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-qualifying-encounters\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Qualifying Encounters&quot;:\n  ( [Encounter: &quot;Office Visit&quot;]\n      union [Encounter: &quot;Emergency Department Evaluation and Management Visit&quot;]\n      union [Encounter: &quot;Detoxification Visit&quot;]\n      union [Encounter: &quot;Initial Hospital Inpatient Visit&quot;]\n      union [Encounter: &quot;Discharge Services Hospital Inpatient Same Day Discharge&quot;]\n      union [Encounter: &quot;Discharge Services Hospital Inpatient&quot;]\n      union [Encounter: &quot;Telephone Visits&quot;]\n      union [Encounter: &quot;Virtual Encounter&quot;]\n  ).isEncounterPerformed ( )</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-first-sud-episode-during-measurement-period\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;First SUD Episode During Measurement Period&quot;:\n  First((&quot;Qualifying Encounters&quot;) ValidEncounters\n      with(([ConditionEncounterDiagnosis: &quot;Substance Use Disorder&quot;]).verified()) SUDDiagnosis\n        such that ValidEncounters.period during &quot;Measurement Period&quot;\n          and SUDDiagnosis.prevalenceInterval() starts during ValidEncounters.period\n          and SUDDiagnosis.prevalenceInterval() starts 47 days or more before day of \n          end of &quot;Measurement Period&quot;\n      return {\n        ValidEncounterDate: date from start of ValidEncounters.period,\n        ValidEncounter: ValidEncounters\n      }\n      sort by ValidEncounterDate\n  ).ValidEncounter</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-emergency-department-or-detoxification-visit\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Emergency Department or Detoxification Visit&quot;:\n  ( [Encounter: &quot;Emergency Department Evaluation and Management Visit&quot;]\n      union [Encounter: &quot;Detoxification Visit&quot;]\n  ).isEncounterPerformed ( )</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-history-of-sud-diagnosis-or-treatment\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;History of SUD Diagnosis or Treatment&quot;:\n  ( ( ( [Procedure: &quot;Substance Use Disorder Treatment&quot;]\n        union [Procedure: &quot;Psych Visit Psychotherapy&quot;]\n        union [Procedure: &quot;Substance Use Disorder Long Acting Medication Administration&quot;]\n        union [Procedure: &quot;Substance Use Disorder Short Acting Medication Administration&quot;]\n    ).isInterventionPerformed ( ) ) Interventions\n      with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\n        such that Interventions.performed.toInterval ( ) starts 60 days or less before day of date from start of FirstSUDEpisode.period\n  )\n    union ( ( ( &quot;Qualifying Encounters&quot;\n        except &quot;Emergency Department or Detoxification Visit&quot; ) QualifyingEncounter\n        where QualifyingEncounter.encounterDiagnosis ( ).code in &quot;Substance Use Disorder&quot; ) SUDEncounterDx\n        with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\n          such that SUDEncounterDx.period starts 60 days or less before day of date from start of FirstSUDEpisode.period\n    )\n    union ( ( ( [MedicationRequest: &quot;Substance Use Disorder Long Acting Medication&quot;]\n          union [MedicationRequest: &quot;Substance Use Disorder Short Acting Medication&quot;]\n      ).isMedicationOrder ( ) ) SUDMedication\n        with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\n          such that SUDMedication.authoredOn 60 days or less before day of date from start of FirstSUDEpisode.period\n    )</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-initial-population\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Initial Population&quot;:\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) &gt;= 13\n    and &quot;First SUD Episode During Measurement Period&quot; is not null\n    and not exists &quot;History of SUD Diagnosis or Treatment&quot;</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-denominator\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Denominator&quot;:\n  &quot;Initial Population&quot;</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-psychosocial-visit\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Psychosocial Visit&quot;:\n  ( ( [Procedure: &quot;Substance Use Disorder Treatment&quot;]\n        union [Procedure: &quot;Psych Visit Psychotherapy&quot;]\n    ).isInterventionPerformed ( )\n  )\n    union ( ( [Encounter: &quot;Telephone Visits&quot;]\n        union [Encounter: &quot;Virtual Encounter&quot;]\n    ).isEncounterPerformed ( ) ) TelehealthEncounter\n      where TelehealthEncounter.encounterDiagnosis ( ).code in &quot;Substance Use Disorder&quot;</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-treatment-initiation-with-non-medication-intervention-dates\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Treatment Initiation With Non Medication Intervention Dates&quot;:\n  ( &quot;Psychosocial Visit&quot; PsychosocialVisitProcedure\n      let treatmentDate: date from start of PsychosocialVisitProcedure.performed.toInterval ( )\n      with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\n        such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\n          and PsychosocialVisitProcedure.id !~ FirstSUDEpisode.id\n      return all treatmentDate\n  )\n    union ( &quot;Psychosocial Visit&quot; PsychosocialVisitEncounter\n        let treatmentDate: date from start of PsychosocialVisitEncounter.period\n        with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\n          such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\n            and PsychosocialVisitEncounter.id !~ FirstSUDEpisode.id\n        return all treatmentDate\n    )</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-treatment-initiation-with-medication-order-dates\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Treatment Initiation With Medication Order Dates&quot;:\n  ( ( ( [MedicationRequest: &quot;Substance Use Disorder Short Acting Medication&quot;]\n        union [MedicationRequest: &quot;Substance Use Disorder Long Acting Medication&quot;]\n    ).isMedicationOrder ( ) ) SUDMedication\n      let treatmentDate: date from start of SUDMedication.authoredOn.toInterval ( )\n      with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\n        such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\n      return all treatmentDate\n  )\n    union ( ( ( [Procedure: &quot;Substance Use Disorder Short Acting Medication Administration&quot;]\n          union [Procedure: &quot;Substance Use Disorder Long Acting Medication Administration&quot;]\n      ).isProcedurePerformed ( ) ) SUDMedAdministration\n        let treatmentDate: date from start of SUDMedAdministration.performed.toInterval ( )\n        with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\n          such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\n        return all treatmentDate\n    )</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-numerator-1\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Numerator 1&quot;:\n  exists &quot;Treatment Initiation With Non Medication Intervention Dates&quot;\n    or exists &quot;Treatment Initiation With Medication Order Dates&quot;</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-sde-payer\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;SDE Payer&quot;:\n  SDE.&quot;SDE Payer&quot;</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-has-treatment-engagement-with-long-acting-medication\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Has Treatment Engagement With Long Acting Medication&quot;:\n  exists ( ( ( ( [MedicationRequest: &quot;Substance Use Disorder Long Acting Medication&quot;] ).isMedicationOrder ( ) ) LongActingMedOrder\n        with ( Min(&quot;Treatment Initiation With Non Medication Intervention Dates&quot;\n            union &quot;Treatment Initiation With Medication Order Dates&quot;\n        ) ) InitiationTreatmentDate\n          such that date from start of LongActingMedOrder.authoredOn.toInterval ( ) 34 days or less after InitiationTreatmentDate\n    )\n      union ( ( ( [Procedure: &quot;Substance Use Disorder Long Acting Medication Administration&quot;] ).isProcedurePerformed ( ) ) LongActingTreatment\n          with ( Min(&quot;Treatment Initiation With Non Medication Intervention Dates&quot;\n              union &quot;Treatment Initiation With Medication Order Dates&quot;\n          ) ) InitiationTreatmentDate\n            such that date from start of LongActingTreatment.performed.toInterval ( ) 34 days or less after InitiationTreatmentDate\n      )\n  )</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-has-two-or-more-treatment-engagements-with-short-acting-medication-or-non-medication-intervention\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Has Two or More Treatment Engagements With Short Acting Medication or Non Medication Intervention&quot;:\n  Count(((&quot;Psychosocial Visit&quot;\n        union(([Procedure: &quot;Substance Use Disorder Short Acting Medication Administration&quot;]).isProcedurePerformed())) ShortActingTreatment\n        with(Min(&quot;Treatment Initiation With Non Medication Intervention Dates&quot;\n            union &quot;Treatment Initiation With Medication Order Dates&quot;\n        )) InitiationTreatmentDate\n          such that date from start of ShortActingTreatment.performed.toInterval() 34 days or less after InitiationTreatmentDate\n            or date from start of ShortActingTreatment.period 34 days or less after InitiationTreatmentDate\n        return all ShortActingTreatment\n    )\n      union((([MedicationRequest: &quot;Substance Use Disorder Short Acting Medication&quot;]).isMedicationOrder()) ShortActingMedOrder\n          with(Min(&quot;Treatment Initiation With Non Medication Intervention Dates&quot;\n              union &quot;Treatment Initiation With Medication Order Dates&quot;\n          )) InitiationTreatmentDate\n            such that date from start of ShortActingMedOrder.authoredOn.toInterval() 34 days or less after InitiationTreatmentDate\n          return all ShortActingMedOrder\n      )\n  ) &gt;= 2</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-numerator-2\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Numerator 2&quot;:\n  &quot;Has Treatment Engagement With Long Acting Medication&quot;\n    or &quot;Has Two or More Treatment Engagements With Short Acting Medication or Non Medication Intervention&quot;</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-sde-ethnicity\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;SDE Ethnicity&quot;:\n  SDE.&quot;SDE Ethnicity&quot;</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-denominator-exclusions\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;Denominator Exclusions&quot;:\n  Hospice.&quot;Has Hospice Services&quot;</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms137fhirsudtxinitengagement-sde-race\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS137FHIRSUDTxInitEngagement</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define &quot;SDE Race&quot;:\n  SDE.&quot;SDE Race&quot;</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n\n        \n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cqmcommon-encounterdiagnosis\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CQMCommon</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">/*  \n@description: Returns the Condition resources referenced by the diagnosis element of the Encounter  \n*/\ndefine fluent function encounterDiagnosis(Encounter Encounter ):\n  Encounter.reasonReference D\n    return singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where D.references(C.id))</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n\n        \n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"qicorecommon-tointerval\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> QICoreCommon</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">/*\n@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval\n@comment: Normalizes a choice type of DateTime, Quanitty, Interval&lt;DateTime&gt;, or Interval&lt;Quantity&gt; types\nto an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible\nrepresentations for timing-valued elements in QICore, allowing this function to be used across any resource.\nThe input can be provided as a DateTime, Quantity, Interval&lt;DateTime&gt; or Interval&lt;Quantity&gt;.\nThe intent of this function is to provide a clear and concise mechanism to treat single\nelements that have multiple possible representations as intervals so that logic doesn't have to account\nfor the variability. More complex calculations (such as medication request period or dispense period\ncalculation) need specific guidance and consideration. That guidance may make use of this function, but\nthe focus of this function is on single element calculations where the semantics are unambiguous.\nIf the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.\nIf the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,\nand the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.\nIf the input is a DateTime Interval, the result is the input.\nIf the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result\nis a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending\nimmediately before one year later than the date the patient turned the age given as the end of the quantity interval.\nIf the input is a Timing, an error will be thrown indicating that Timing calculations are not implemented. Any other input will reslt in a null DateTime Interval\n*/\ndefine fluent function toInterval(choice Choice&lt;DateTime, Quantity, Interval&lt;DateTime&gt;, Interval&lt;Quantity&gt;, Timing&gt;):\n  case\n\t  when choice is DateTime then\n    \tInterval[choice as DateTime, choice as DateTime]\n\t\twhen choice is Interval&lt;DateTime&gt; then\n  \t\tchoice as Interval&lt;DateTime&gt;\n\t\twhen choice is Quantity then\n\t\t  Interval[Patient.birthDate + (choice as Quantity),\n\t\t\t  Patient.birthDate + (choice as Quantity) + 1 year)\n\t\twhen choice is Interval&lt;Quantity&gt; then\n\t\t  Interval[Patient.birthDate + (choice.low as Quantity),\n\t\t\t  Patient.birthDate + (choice.high as Quantity) + 1 year)\n\t\twhen choice is Timing then\n      Message(null, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported') as Interval&lt;DateTime&gt;\n\t\telse\n\t\t\tnull as Interval&lt;DateTime&gt;\n\tend</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"qicorecommon-references\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> QICoreCommon</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">/*\n@description: Returns true if the given reference is to the given resourceId\n@comment: Returns true if the `resourceId` parameter exactly equals the tail of the given reference.\nNOTE: This function assumes resources from the same source server.\n*/\ndefine fluent function references(reference Reference, resourceId String):\n  resourceId = Last(Split(reference.reference, '/'))</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n\n        \n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"fhirhelpers-tostring\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> FHIRHelpers</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">define function ToString(value uri): value.value</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"fhirhelpers-tointerval\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> FHIRHelpers</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">/*\n@description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)\nvalue to a CQL DateTime Interval\n@comment: If the start value of the given period is unspecified, the starting\nboundary of the resulting interval will be open (meaning the start of the interval\nis unknown, as opposed to interpreted as the beginning of time).\n*/\ndefine function ToInterval(period FHIR.Period):\n    if period is null then\n        null\n    else\n        if period.&quot;start&quot; is null then\n            Interval(period.&quot;start&quot;.value, period.&quot;end&quot;.value]\n        else\n            Interval[period.&quot;start&quot;.value, period.&quot;end&quot;.value]</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"fhirhelpers-tocode\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> FHIRHelpers</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">/*\n@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.\n*/\ndefine function ToCode(coding FHIR.Coding):\n    if coding is null then\n        null\n    else\n        System.Code {\n          code: coding.code.value,\n          system: coding.system.value,\n          version: coding.version.value,\n          display: coding.display.value\n        }</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n\n        \n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"status-isencounterperformed\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> Status</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">//Encounter, Performed\n//General usage unless required otherwise by measure intent (e.g., follow-up encounters)\ndefine fluent function isEncounterPerformed(Enc List&lt;Encounter&gt;):\n  Enc E\n    where E.status = 'finished'</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"status-verified\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> Status</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">//This library contains functions used to constrain FHIR resource elements for measures authored by NCQA, based on QICore 6.0.0 resources including IG and authoring patterns. The functions may appear similar to some QICoreCommon functions but differ in that they have constraints that are relevant for measures authored by NCQA.\n\n//Condition\n//Returns conditions in the given list that either have no verification status or have a verification status of confirmed, unconfirmed, provisional, or differential\ndefine fluent function verified(conditions List&lt;Choice&lt;ConditionProblemsHealthConcerns, ConditionEncounterDiagnosis&gt;&gt;):\n  conditions C\n    where C.verificationStatus is not null implies\n      (C.verificationStatus ~ &quot;confirmed&quot;\n        or C.verificationStatus ~ &quot;unconfirmed&quot;\n        or C.verificationStatus ~ &quot;provisional&quot;\n        or C.verificationStatus ~ &quot;differential&quot;\n      )</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"status-isinterventionperformed\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> Status</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">//Intervention, Performed\ndefine fluent function isInterventionPerformed(Proc List&lt;Procedure&gt;):\n  Proc P\n    where P.status ~ 'completed'</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"status-ismedicationorder\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> Status</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">//Medication, Order\ndefine fluent function isMedicationOrder(MedicationRequest List&lt;MedicationRequest&gt;):\n  MedicationRequest M\n    where M.status in { 'active', 'completed' }\n    and M.intent in {'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order'}</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"status-isprocedureperformed\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> Status</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">//Procedure, Performed\ndefine fluent function isProcedurePerformed(Proc List&lt;Procedure&gt;):\n  Proc P\n    where P.status ~ 'completed'</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"status-isassessmentperformed\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> Status</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">//Assessment, Performed\ndefine fluent function isAssessmentPerformed(Obs List&lt;ObservationScreeningAssessment&gt;):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' }</code></pre>\n  </td>\n\n</tr>\n\n\n\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"status-isinterventionorder\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> Status</td>\n\n</tr>\n<tr>\n\n  <td>\n    <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">//Intervention, Order\ndefine fluent function isInterventionOrder(ServiceRequest List&lt;ServiceRequest&gt;):\n  ServiceRequest S\n    where S.status in { 'active', 'completed' }\n      and S.intent in {'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order'}</code></pre>\n  </td>\n\n</tr>\n\n\n\n\n\n  \n  \n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"terminology\"> </a>Terminology</th>\n\n\n</tr>\n  \n  \n  \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n\n<tr>\n  \n  \n  \n\n<th scope=\"row\" class=\"row-header\">Code System</th>\n\n\n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Code system SNOMEDCT\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://snomed.info/sct\n    <br/>\n    <em>Canonical URL</em>: <tt>http://snomed.info/sct</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n  \n\n<th scope=\"row\" class=\"row-header\">Code System</th>\n\n\n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Code system ConditionVerificationStatusCodes\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://terminology.hl7.org/CodeSystem/condition-ver-status\n    <br/>\n    <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-ver-status</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n  \n\n<th scope=\"row\" class=\"row-header\">Code System</th>\n\n\n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Code system LOINC\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://loinc.org\n    <br/>\n    <em>Canonical URL</em>: <tt>http://loinc.org</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Office Visit\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Emergency Department Evaluation and Management Visit\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Detoxification Visit\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1059\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1059</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Initial Hospital Inpatient Visit\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1004\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1004</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Discharge Services Hospital Inpatient Same Day Discharge\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1006\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1006</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Discharge Services Hospital Inpatient\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1007\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1007</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Telephone Visits\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Virtual Encounter\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Substance Use Disorder\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1001\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1001</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Substance Use Disorder Treatment\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1005\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1005</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Psych Visit Psychotherapy\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Substance Use Disorder Long Acting Medication Administration\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1156\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1156</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Substance Use Disorder Short Acting Medication Administration\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1157\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1157</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Substance Use Disorder Long Acting Medication\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1149\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1149</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Substance Use Disorder Short Acting Medication\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1150\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1150</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Payer Type\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Encounter Inpatient\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Hospice Encounter\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Hospice Care Ambulatory\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Value Set</th>\n\n\n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Value set Hospice Diagnosis\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165</tt>\n    \n  </td>\n</tr>\n \n\n\n  \n  <tr>\n    <th scope=\"row\" class=\"row-header\">Direct Reference Code</th>\n    <td class=\"content-container\">\n      \n        <em>Display</em>: Male (finding)\n        <br/>\n      \n      <em>Code</em>: 248153007\n      <br/>\n      <em>System</em>: <tt>http://snomed.info/sct</tt>\n    </td>\n  </tr>\n\n  <tr>\n    <th scope=\"row\" class=\"row-header\">Direct Reference Code</th>\n    <td class=\"content-container\">\n      \n        <em>Display</em>: Female (finding)\n        <br/>\n      \n      <em>Code</em>: 248152002\n      <br/>\n      <em>System</em>: <tt>http://snomed.info/sct</tt>\n    </td>\n  </tr>\n\n  <tr>\n    <th scope=\"row\" class=\"row-header\">Direct Reference Code</th>\n    <td class=\"content-container\">\n      \n        <em>Display</em>: confirmed\n        <br/>\n      \n      <em>Code</em>: confirmed\n      <br/>\n      <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-ver-status</tt>\n    </td>\n  </tr>\n\n  <tr>\n    <th scope=\"row\" class=\"row-header\">Direct Reference Code</th>\n    <td class=\"content-container\">\n      \n        <em>Display</em>: unconfirmed\n        <br/>\n      \n      <em>Code</em>: unconfirmed\n      <br/>\n      <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-ver-status</tt>\n    </td>\n  </tr>\n\n  <tr>\n    <th scope=\"row\" class=\"row-header\">Direct Reference Code</th>\n    <td class=\"content-container\">\n      \n        <em>Display</em>: provisional\n        <br/>\n      \n      <em>Code</em>: provisional\n      <br/>\n      <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-ver-status</tt>\n    </td>\n  </tr>\n\n  <tr>\n    <th scope=\"row\" class=\"row-header\">Direct Reference Code</th>\n    <td class=\"content-container\">\n      \n        <em>Display</em>: differential\n        <br/>\n      \n      <em>Code</em>: differential\n      <br/>\n      <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-ver-status</tt>\n    </td>\n  </tr>\n\n  <tr>\n    <th scope=\"row\" class=\"row-header\">Direct Reference Code</th>\n    <td class=\"content-container\">\n      \n        <em>Display</em>: Discharge to home for hospice care (procedure)\n        <br/>\n      \n      <em>Code</em>: 428361000124107\n      <br/>\n      <em>System</em>: <tt>http://snomed.info/sct</tt>\n    </td>\n  </tr>\n\n  <tr>\n    <th scope=\"row\" class=\"row-header\">Direct Reference Code</th>\n    <td class=\"content-container\">\n      \n        <em>Display</em>: Discharge to healthcare facility for hospice care (procedure)\n        <br/>\n      \n      <em>Code</em>: 428371000124100\n      <br/>\n      <em>System</em>: <tt>http://snomed.info/sct</tt>\n    </td>\n  </tr>\n\n  <tr>\n    <th scope=\"row\" class=\"row-header\">Direct Reference Code</th>\n    <td class=\"content-container\">\n      \n        <em>Display</em>: Hospice care [Minimum Data Set]\n        <br/>\n      \n      <em>Code</em>: 45755-6\n      <br/>\n      <em>System</em>: <tt>http://loinc.org</tt>\n    </td>\n  </tr>\n\n  <tr>\n    <th scope=\"row\" class=\"row-header\">Direct Reference Code</th>\n    <td class=\"content-container\">\n      \n        <em>Display</em>: Yes (qualifier value)\n        <br/>\n      \n      <em>Code</em>: 373066001\n      <br/>\n      <em>System</em>: <tt>http://snomed.info/sct</tt>\n    </td>\n  </tr>\n\n  \n  \n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"dependencies\"> </a>Dependencies</th>\n\n\n</tr>\n  \n  \n  \n\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Dependency</th>\n\n\n  <td class=\"content-container\">\n    \n    <em>Description</em>: QICore model information\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: http://hl7.org/fhir/Library/QICore-ModelInfo\n    <br/>\n    <em>Canonical URL</em>: <tt>http://hl7.org/fhir/Library/QICore-ModelInfo</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Dependency</th>\n\n\n  <td class=\"content-container\">\n    \n    <em>Description</em>: Library SDE\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: https://madie.cms.gov/Library/SupplementalDataElements|5.1.000\n    <br/>\n    <em>Canonical URL</em>: <tt>https://madie.cms.gov/Library/SupplementalDataElements|5.1.000</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Dependency</th>\n\n\n  <td class=\"content-container\">\n    \n    <em>Description</em>: Library FHIRHelpers\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: https://madie.cms.gov/Library/FHIRHelpers|4.4.000\n    <br/>\n    <em>Canonical URL</em>: <tt>https://madie.cms.gov/Library/FHIRHelpers|4.4.000</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Dependency</th>\n\n\n  <td class=\"content-container\">\n    \n    <em>Description</em>: Library Status\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: https://madie.cms.gov/Library/Status|1.15.000\n    <br/>\n    <em>Canonical URL</em>: <tt>https://madie.cms.gov/Library/Status|1.15.000</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Dependency</th>\n\n\n  <td class=\"content-container\">\n    \n    <em>Description</em>: Library QICoreCommon\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: https://madie.cms.gov/Library/QICoreCommon|4.0.000\n    <br/>\n    <em>Canonical URL</em>: <tt>https://madie.cms.gov/Library/QICoreCommon|4.0.000</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Dependency</th>\n\n\n  <td class=\"content-container\">\n    \n    <em>Description</em>: Library CQMCommon\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: https://madie.cms.gov/Library/CQMCommon|4.1.000\n    <br/>\n    <em>Canonical URL</em>: <tt>https://madie.cms.gov/Library/CQMCommon|4.1.000</tt>\n    \n  </td>\n</tr>\n \n\n\n<tr>\n  \n\n<th scope=\"row\" class=\"row-header\">Dependency</th>\n\n\n  <td class=\"content-container\">\n    \n    <em>Description</em>: Library Hospice\n    \n    <br/>\n    \n    \n    \n    \n    \n    \n    <em>Resource</em>: https://madie.cms.gov/Library/Hospice|6.18.000\n    <br/>\n    <em>Canonical URL</em>: <tt>https://madie.cms.gov/Library/Hospice|6.18.000</tt>\n    \n  </td>\n</tr>\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n\n  \n  \n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\"><a name=\"data-requirements\"> </a>Data Requirements</th>\n\n\n</tr>\n  \n  \n  \n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Patient\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: extension, birthDate, birthDate.value, url\n    <br/>\n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1004\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1006\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1007\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1059\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, hospitalization, hospitalization.dischargeDisposition, period, status, status.value\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period, status, status.value\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Condition\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1001\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Condition\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis\n    <br/>        \n  \n   \n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Condition\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Condition\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns\n    <br/>        \n  \n   \n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Condition\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, status, status.value, performed\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1005\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, status, status.value, performed\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, status, status.value, performed\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1156\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, status, status.value, performed\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1157\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, performed, status, status.value\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: MedicationRequest\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: medication, status, status.value, intent, intent.value, authoredOn, authoredOn.value\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: medication</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1149\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: MedicationRequest\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: medication, status, status.value, intent, intent.value, authoredOn, authoredOn.value\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: medication</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1150\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: MedicationRequest\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: medication.reference.value, status, status.value, intent, intent.value, authoredOn, authoredOn.value\n    <br/>\n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Medication\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: id.value, code\n    <br/>\n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Coverage\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Observation\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, value, effective, status, status.value\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n  \n    <span class=\"tab-one\"><em>Code(s)</em>: \n    \n      \n      http://loinc.org#45755-6: 'Hospice care [Minimum Data Set]'\n      \n    \n    </span>\n    <br/>\n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: ServiceRequest\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, authoredOn, authoredOn.value, status, status.value, intent, intent.value\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n  \n  \n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.4.8 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
      },
      "contained": [ {
        "resourceType": "Library",
        "id": "effective-data-requirements",
        "extension": [ {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://snomed.info/sct",
            "code": "248153007",
            "display": "Male (finding)"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://snomed.info/sct",
            "code": "248152002",
            "display": "Female (finding)"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
            "code": "confirmed",
            "display": "confirmed"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
            "code": "unconfirmed",
            "display": "unconfirmed"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
            "code": "provisional",
            "display": "provisional"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
            "code": "differential",
            "display": "differential"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://snomed.info/sct",
            "code": "428361000124107",
            "display": "Discharge to home for hospice care (procedure)"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://snomed.info/sct",
            "code": "428371000124100",
            "display": "Discharge to healthcare facility for hospice care (procedure)"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://loinc.org",
            "code": "45755-6",
            "display": "Hospice care [Minimum Data Set]"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://snomed.info/sct",
            "code": "373066001",
            "display": "Yes (qualifier value)"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "SupplementalDataElements"
          }, {
            "url": "name",
            "valueString": "SDE Sex"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Sex\":\n  case\n    when Patient.sex = '248153007' then \"Male (finding)\"\n    when Patient.sex = '248152002' then \"Female (finding)\"\n    else null\n  end"
          }, {
            "url": "displaySequence",
            "valueInteger": 0
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "SDE Sex"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Sex\":\n  SDE.\"SDE Sex\""
          }, {
            "url": "displaySequence",
            "valueInteger": 1
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Stratification 3"
          }, {
            "url": "statement",
            "valueString": "define \"Stratification 3\":\n  AgeInYearsAt(date from start of \"Measurement Period\") >= 65"
          }, {
            "url": "displaySequence",
            "valueInteger": 2
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Stratification 2"
          }, {
            "url": "statement",
            "valueString": "define \"Stratification 2\":\n  AgeInYearsAt(date from start of \"Measurement Period\") in Interval[18, 64]"
          }, {
            "url": "displaySequence",
            "valueInteger": 3
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Stratification 1"
          }, {
            "url": "statement",
            "valueString": "define \"Stratification 1\":\n  AgeInYearsAt(date from start of \"Measurement Period\") in Interval[13, 17]"
          }, {
            "url": "displaySequence",
            "valueInteger": 4
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Qualifying Encounters"
          }, {
            "url": "statement",
            "valueString": "define \"Qualifying Encounters\":\n  ( [Encounter: \"Office Visit\"]\n      union [Encounter: \"Emergency Department Evaluation and Management Visit\"]\n      union [Encounter: \"Detoxification Visit\"]\n      union [Encounter: \"Initial Hospital Inpatient Visit\"]\n      union [Encounter: \"Discharge Services Hospital Inpatient Same Day Discharge\"]\n      union [Encounter: \"Discharge Services Hospital Inpatient\"]\n      union [Encounter: \"Telephone Visits\"]\n      union [Encounter: \"Virtual Encounter\"]\n  ).isEncounterPerformed ( )"
          }, {
            "url": "displaySequence",
            "valueInteger": 5
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "First SUD Episode During Measurement Period"
          }, {
            "url": "statement",
            "valueString": "define \"First SUD Episode During Measurement Period\":\n  First((\"Qualifying Encounters\") ValidEncounters\n      with(([ConditionEncounterDiagnosis: \"Substance Use Disorder\"]).verified()) SUDDiagnosis\n        such that ValidEncounters.period during \"Measurement Period\"\n          and SUDDiagnosis.prevalenceInterval() starts during ValidEncounters.period\n          and SUDDiagnosis.prevalenceInterval() starts 47 days or more before day of \n          end of \"Measurement Period\"\n      return {\n        ValidEncounterDate: date from start of ValidEncounters.period,\n        ValidEncounter: ValidEncounters\n      }\n      sort by ValidEncounterDate\n  ).ValidEncounter"
          }, {
            "url": "displaySequence",
            "valueInteger": 6
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Emergency Department or Detoxification Visit"
          }, {
            "url": "statement",
            "valueString": "define \"Emergency Department or Detoxification Visit\":\n  ( [Encounter: \"Emergency Department Evaluation and Management Visit\"]\n      union [Encounter: \"Detoxification Visit\"]\n  ).isEncounterPerformed ( )"
          }, {
            "url": "displaySequence",
            "valueInteger": 7
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "History of SUD Diagnosis or Treatment"
          }, {
            "url": "statement",
            "valueString": "define \"History of SUD Diagnosis or Treatment\":\n  ( ( ( [Procedure: \"Substance Use Disorder Treatment\"]\n        union [Procedure: \"Psych Visit Psychotherapy\"]\n        union [Procedure: \"Substance Use Disorder Long Acting Medication Administration\"]\n        union [Procedure: \"Substance Use Disorder Short Acting Medication Administration\"]\n    ).isInterventionPerformed ( ) ) Interventions\n      with \"First SUD Episode During Measurement Period\" FirstSUDEpisode\n        such that Interventions.performed.toInterval ( ) starts 60 days or less before day of date from start of FirstSUDEpisode.period\n  )\n    union ( ( ( \"Qualifying Encounters\"\n        except \"Emergency Department or Detoxification Visit\" ) QualifyingEncounter\n        where QualifyingEncounter.encounterDiagnosis ( ).code in \"Substance Use Disorder\" ) SUDEncounterDx\n        with \"First SUD Episode During Measurement Period\" FirstSUDEpisode\n          such that SUDEncounterDx.period starts 60 days or less before day of date from start of FirstSUDEpisode.period\n    )\n    union ( ( ( [MedicationRequest: \"Substance Use Disorder Long Acting Medication\"]\n          union [MedicationRequest: \"Substance Use Disorder Short Acting Medication\"]\n      ).isMedicationOrder ( ) ) SUDMedication\n        with \"First SUD Episode During Measurement Period\" FirstSUDEpisode\n          such that SUDMedication.authoredOn 60 days or less before day of date from start of FirstSUDEpisode.period\n    )"
          }, {
            "url": "displaySequence",
            "valueInteger": 8
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Initial Population"
          }, {
            "url": "statement",
            "valueString": "define \"Initial Population\":\n  AgeInYearsAt(date from start of \"Measurement Period\") >= 13\n    and \"First SUD Episode During Measurement Period\" is not null\n    and not exists \"History of SUD Diagnosis or Treatment\""
          }, {
            "url": "displaySequence",
            "valueInteger": 9
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Denominator"
          }, {
            "url": "statement",
            "valueString": "define \"Denominator\":\n  \"Initial Population\""
          }, {
            "url": "displaySequence",
            "valueInteger": 10
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Psychosocial Visit"
          }, {
            "url": "statement",
            "valueString": "define \"Psychosocial Visit\":\n  ( ( [Procedure: \"Substance Use Disorder Treatment\"]\n        union [Procedure: \"Psych Visit Psychotherapy\"]\n    ).isInterventionPerformed ( )\n  )\n    union ( ( [Encounter: \"Telephone Visits\"]\n        union [Encounter: \"Virtual Encounter\"]\n    ).isEncounterPerformed ( ) ) TelehealthEncounter\n      where TelehealthEncounter.encounterDiagnosis ( ).code in \"Substance Use Disorder\""
          }, {
            "url": "displaySequence",
            "valueInteger": 11
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Treatment Initiation With Non Medication Intervention Dates"
          }, {
            "url": "statement",
            "valueString": "define \"Treatment Initiation With Non Medication Intervention Dates\":\n  ( \"Psychosocial Visit\" PsychosocialVisitProcedure\n      let treatmentDate: date from start of PsychosocialVisitProcedure.performed.toInterval ( )\n      with \"First SUD Episode During Measurement Period\" FirstSUDEpisode\n        such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\n          and PsychosocialVisitProcedure.id !~ FirstSUDEpisode.id\n      return all treatmentDate\n  )\n    union ( \"Psychosocial Visit\" PsychosocialVisitEncounter\n        let treatmentDate: date from start of PsychosocialVisitEncounter.period\n        with \"First SUD Episode During Measurement Period\" FirstSUDEpisode\n          such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\n            and PsychosocialVisitEncounter.id !~ FirstSUDEpisode.id\n        return all treatmentDate\n    )"
          }, {
            "url": "displaySequence",
            "valueInteger": 12
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Treatment Initiation With Medication Order Dates"
          }, {
            "url": "statement",
            "valueString": "define \"Treatment Initiation With Medication Order Dates\":\n  ( ( ( [MedicationRequest: \"Substance Use Disorder Short Acting Medication\"]\n        union [MedicationRequest: \"Substance Use Disorder Long Acting Medication\"]\n    ).isMedicationOrder ( ) ) SUDMedication\n      let treatmentDate: date from start of SUDMedication.authoredOn.toInterval ( )\n      with \"First SUD Episode During Measurement Period\" FirstSUDEpisode\n        such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\n      return all treatmentDate\n  )\n    union ( ( ( [Procedure: \"Substance Use Disorder Short Acting Medication Administration\"]\n          union [Procedure: \"Substance Use Disorder Long Acting Medication Administration\"]\n      ).isProcedurePerformed ( ) ) SUDMedAdministration\n        let treatmentDate: date from start of SUDMedAdministration.performed.toInterval ( )\n        with \"First SUD Episode During Measurement Period\" FirstSUDEpisode\n          such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\n        return all treatmentDate\n    )"
          }, {
            "url": "displaySequence",
            "valueInteger": 13
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Numerator 1"
          }, {
            "url": "statement",
            "valueString": "define \"Numerator 1\":\n  exists \"Treatment Initiation With Non Medication Intervention Dates\"\n    or exists \"Treatment Initiation With Medication Order Dates\""
          }, {
            "url": "displaySequence",
            "valueInteger": 14
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "SupplementalDataElements"
          }, {
            "url": "name",
            "valueString": "SDE Payer"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Payer\":\n  [Coverage: type in \"Payer Type\"] Payer\n    return {\n      code: Payer.type,\n      period: Payer.period\n    }"
          }, {
            "url": "displaySequence",
            "valueInteger": 15
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "SDE Payer"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Payer\":\n  SDE.\"SDE Payer\""
          }, {
            "url": "displaySequence",
            "valueInteger": 16
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Has Treatment Engagement With Long Acting Medication"
          }, {
            "url": "statement",
            "valueString": "define \"Has Treatment Engagement With Long Acting Medication\":\n  exists ( ( ( ( [MedicationRequest: \"Substance Use Disorder Long Acting Medication\"] ).isMedicationOrder ( ) ) LongActingMedOrder\n        with ( Min(\"Treatment Initiation With Non Medication Intervention Dates\"\n            union \"Treatment Initiation With Medication Order Dates\"\n        ) ) InitiationTreatmentDate\n          such that date from start of LongActingMedOrder.authoredOn.toInterval ( ) 34 days or less after InitiationTreatmentDate\n    )\n      union ( ( ( [Procedure: \"Substance Use Disorder Long Acting Medication Administration\"] ).isProcedurePerformed ( ) ) LongActingTreatment\n          with ( Min(\"Treatment Initiation With Non Medication Intervention Dates\"\n              union \"Treatment Initiation With Medication Order Dates\"\n          ) ) InitiationTreatmentDate\n            such that date from start of LongActingTreatment.performed.toInterval ( ) 34 days or less after InitiationTreatmentDate\n      )\n  )"
          }, {
            "url": "displaySequence",
            "valueInteger": 17
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Has Two or More Treatment Engagements With Short Acting Medication or Non Medication Intervention"
          }, {
            "url": "statement",
            "valueString": "define \"Has Two or More Treatment Engagements With Short Acting Medication or Non Medication Intervention\":\n  Count(((\"Psychosocial Visit\"\n        union(([Procedure: \"Substance Use Disorder Short Acting Medication Administration\"]).isProcedurePerformed())) ShortActingTreatment\n        with(Min(\"Treatment Initiation With Non Medication Intervention Dates\"\n            union \"Treatment Initiation With Medication Order Dates\"\n        )) InitiationTreatmentDate\n          such that date from start of ShortActingTreatment.performed.toInterval() 34 days or less after InitiationTreatmentDate\n            or date from start of ShortActingTreatment.period 34 days or less after InitiationTreatmentDate\n        return all ShortActingTreatment\n    )\n      union((([MedicationRequest: \"Substance Use Disorder Short Acting Medication\"]).isMedicationOrder()) ShortActingMedOrder\n          with(Min(\"Treatment Initiation With Non Medication Intervention Dates\"\n              union \"Treatment Initiation With Medication Order Dates\"\n          )) InitiationTreatmentDate\n            such that date from start of ShortActingMedOrder.authoredOn.toInterval() 34 days or less after InitiationTreatmentDate\n          return all ShortActingMedOrder\n      )\n  ) >= 2"
          }, {
            "url": "displaySequence",
            "valueInteger": 18
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Numerator 2"
          }, {
            "url": "statement",
            "valueString": "define \"Numerator 2\":\n  \"Has Treatment Engagement With Long Acting Medication\"\n    or \"Has Two or More Treatment Engagements With Short Acting Medication or Non Medication Intervention\""
          }, {
            "url": "displaySequence",
            "valueInteger": 19
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "SupplementalDataElements"
          }, {
            "url": "name",
            "valueString": "SDE Ethnicity"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Ethnicity\":\n  Patient.ethnicity E\n    return Tuple {\n      codes: { E.ombCategory } union E.detailed,\n      display: E.text\n    }"
          }, {
            "url": "displaySequence",
            "valueInteger": 20
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "SDE Ethnicity"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Ethnicity\":\n  SDE.\"SDE Ethnicity\""
          }, {
            "url": "displaySequence",
            "valueInteger": 21
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "Hospice"
          }, {
            "url": "name",
            "valueString": "Has Hospice Services"
          }, {
            "url": "statement",
            "valueString": "define \"Has Hospice Services\":\n  exists ((([Encounter: \"Encounter Inpatient\"]).isEncounterPerformed()) InpatientEncounter\n      where (InpatientEncounter.hospitalization.dischargeDisposition ~ \"Discharge to home for hospice care (procedure)\"\n          or InpatientEncounter.hospitalization.dischargeDisposition ~ \"Discharge to healthcare facility for hospice care (procedure)\"\n      )\n        and InpatientEncounter.period ends during day of \"Measurement Period\"\n  )\n    or exists ((([Encounter: \"Hospice Encounter\"]).isEncounterPerformed()) HospiceEncounter\n        where HospiceEncounter.period overlaps day of \"Measurement Period\"\n    )\n    or exists ((([ObservationScreeningAssessment: \"Hospice care [Minimum Data Set]\"]).isAssessmentPerformed()) HospiceAssessment\n        where HospiceAssessment.value ~ \"Yes (qualifier value)\"\n          and HospiceAssessment.effective.toInterval() overlaps day of \"Measurement Period\"\n    )\n    or exists ((([ServiceRequest: \"Hospice Care Ambulatory\"]).isInterventionOrder()) HospiceOrder\n        where HospiceOrder.authoredOn during day of \"Measurement Period\"\n    )\n    or exists ((([Procedure: \"Hospice Care Ambulatory\"]).isInterventionPerformed()) HospicePerformed\n        where HospicePerformed.performed.toInterval() overlaps day of \"Measurement Period\"\n    )\n    or exists ((([ConditionProblemsHealthConcerns: \"Hospice Diagnosis\"]\n        union [ConditionEncounterDiagnosis: \"Hospice Diagnosis\"]).verified()) HospiceCareDiagnosis\n        where HospiceCareDiagnosis.prevalenceInterval() overlaps day of \"Measurement Period\"\n    )"
          }, {
            "url": "displaySequence",
            "valueInteger": 22
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "Denominator Exclusions"
          }, {
            "url": "statement",
            "valueString": "define \"Denominator Exclusions\":\n  Hospice.\"Has Hospice Services\""
          }, {
            "url": "displaySequence",
            "valueInteger": 23
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "SupplementalDataElements"
          }, {
            "url": "name",
            "valueString": "SDE Race"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Race\":\n  Patient.race R\n    return Tuple {\n      codes: R.ombCategory union R.detailed,\n      display: R.text\n    }"
          }, {
            "url": "displaySequence",
            "valueInteger": 24
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS137FHIRSUDTxInitEngagement"
          }, {
            "url": "name",
            "valueString": "SDE Race"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Race\":\n  SDE.\"SDE Race\""
          }, {
            "url": "displaySequence",
            "valueInteger": 25
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "FHIRHelpers"
          }, {
            "url": "name",
            "valueString": "ToString"
          }, {
            "url": "statement",
            "valueString": "define function ToString(value uri): value.value"
          }, {
            "url": "displaySequence",
            "valueInteger": 26
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "Status"
          }, {
            "url": "name",
            "valueString": "isEncounterPerformed"
          }, {
            "url": "statement",
            "valueString": "//Encounter, Performed\n//General usage unless required otherwise by measure intent (e.g., follow-up encounters)\ndefine fluent function isEncounterPerformed(Enc List<Encounter>):\n  Enc E\n    where E.status = 'finished'"
          }, {
            "url": "displaySequence",
            "valueInteger": 27
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "Status"
          }, {
            "url": "name",
            "valueString": "verified"
          }, {
            "url": "statement",
            "valueString": "//This library contains functions used to constrain FHIR resource elements for measures authored by NCQA, based on QICore 6.0.0 resources including IG and authoring patterns. The functions may appear similar to some QICoreCommon functions but differ in that they have constraints that are relevant for measures authored by NCQA.\n\n//Condition\n//Returns conditions in the given list that either have no verification status or have a verification status of confirmed, unconfirmed, provisional, or differential\ndefine fluent function verified(conditions List<Choice<ConditionProblemsHealthConcerns, ConditionEncounterDiagnosis>>):\n  conditions C\n    where C.verificationStatus is not null implies\n      (C.verificationStatus ~ \"confirmed\"\n        or C.verificationStatus ~ \"unconfirmed\"\n        or C.verificationStatus ~ \"provisional\"\n        or C.verificationStatus ~ \"differential\"\n      )"
          }, {
            "url": "displaySequence",
            "valueInteger": 28
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "FHIRHelpers"
          }, {
            "url": "name",
            "valueString": "ToInterval"
          }, {
            "url": "statement",
            "valueString": "/*\n@description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)\nvalue to a CQL DateTime Interval\n@comment: If the start value of the given period is unspecified, the starting\nboundary of the resulting interval will be open (meaning the start of the interval\nis unknown, as opposed to interpreted as the beginning of time).\n*/\ndefine function ToInterval(period FHIR.Period):\n    if period is null then\n        null\n    else\n        if period.\"start\" is null then\n            Interval(period.\"start\".value, period.\"end\".value]\n        else\n            Interval[period.\"start\".value, period.\"end\".value]"
          }, {
            "url": "displaySequence",
            "valueInteger": 29
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "Status"
          }, {
            "url": "name",
            "valueString": "isInterventionPerformed"
          }, {
            "url": "statement",
            "valueString": "//Intervention, Performed\ndefine fluent function isInterventionPerformed(Proc List<Procedure>):\n  Proc P\n    where P.status ~ 'completed'"
          }, {
            "url": "displaySequence",
            "valueInteger": 30
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "QICoreCommon"
          }, {
            "url": "name",
            "valueString": "toInterval"
          }, {
            "url": "statement",
            "valueString": "/*\n@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval\n@comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types\nto an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible\nrepresentations for timing-valued elements in QICore, allowing this function to be used across any resource.\nThe input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>.\nThe intent of this function is to provide a clear and concise mechanism to treat single\nelements that have multiple possible representations as intervals so that logic doesn't have to account\nfor the variability. More complex calculations (such as medication request period or dispense period\ncalculation) need specific guidance and consideration. That guidance may make use of this function, but\nthe focus of this function is on single element calculations where the semantics are unambiguous.\nIf the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.\nIf the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,\nand the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.\nIf the input is a DateTime Interval, the result is the input.\nIf the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result\nis a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending\nimmediately before one year later than the date the patient turned the age given as the end of the quantity interval.\nIf the input is a Timing, an error will be thrown indicating that Timing calculations are not implemented. Any other input will reslt in a null DateTime Interval\n*/\ndefine fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>, Timing>):\n  case\n\t  when choice is DateTime then\n    \tInterval[choice as DateTime, choice as DateTime]\n\t\twhen choice is Interval<DateTime> then\n  \t\tchoice as Interval<DateTime>\n\t\twhen choice is Quantity then\n\t\t  Interval[Patient.birthDate + (choice as Quantity),\n\t\t\t  Patient.birthDate + (choice as Quantity) + 1 year)\n\t\twhen choice is Interval<Quantity> then\n\t\t  Interval[Patient.birthDate + (choice.low as Quantity),\n\t\t\t  Patient.birthDate + (choice.high as Quantity) + 1 year)\n\t\twhen choice is Timing then\n      Message(null, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported') as Interval<DateTime>\n\t\telse\n\t\t\tnull as Interval<DateTime>\n\tend"
          }, {
            "url": "displaySequence",
            "valueInteger": 31
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CQMCommon"
          }, {
            "url": "name",
            "valueString": "encounterDiagnosis"
          }, {
            "url": "statement",
            "valueString": "/*  \n@description: Returns the Condition resources referenced by the diagnosis element of the Encounter  \n*/\ndefine fluent function encounterDiagnosis(Encounter Encounter ):\n  Encounter.reasonReference D\n    return singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where D.references(C.id))"
          }, {
            "url": "displaySequence",
            "valueInteger": 32
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "QICoreCommon"
          }, {
            "url": "name",
            "valueString": "references"
          }, {
            "url": "statement",
            "valueString": "/*\n@description: Returns true if the given reference is to the given resourceId\n@comment: Returns true if the `resourceId` parameter exactly equals the tail of the given reference.\nNOTE: This function assumes resources from the same source server.\n*/\ndefine fluent function references(reference Reference, resourceId String):\n  resourceId = Last(Split(reference.reference, '/'))"
          }, {
            "url": "displaySequence",
            "valueInteger": 33
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "Status"
          }, {
            "url": "name",
            "valueString": "isMedicationOrder"
          }, {
            "url": "statement",
            "valueString": "//Medication, Order\ndefine fluent function isMedicationOrder(MedicationRequest List<MedicationRequest>):\n  MedicationRequest M\n    where M.status in { 'active', 'completed' }\n    and M.intent in {'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order'}"
          }, {
            "url": "displaySequence",
            "valueInteger": 34
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "Status"
          }, {
            "url": "name",
            "valueString": "isProcedurePerformed"
          }, {
            "url": "statement",
            "valueString": "//Procedure, Performed\ndefine fluent function isProcedurePerformed(Proc List<Procedure>):\n  Proc P\n    where P.status ~ 'completed'"
          }, {
            "url": "displaySequence",
            "valueInteger": 35
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "FHIRHelpers"
          }, {
            "url": "name",
            "valueString": "ToCode"
          }, {
            "url": "statement",
            "valueString": "/*\n@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.\n*/\ndefine function ToCode(coding FHIR.Coding):\n    if coding is null then\n        null\n    else\n        System.Code {\n          code: coding.code.value,\n          system: coding.system.value,\n          version: coding.version.value,\n          display: coding.display.value\n        }"
          }, {
            "url": "displaySequence",
            "valueInteger": 36
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "Status"
          }, {
            "url": "name",
            "valueString": "isAssessmentPerformed"
          }, {
            "url": "statement",
            "valueString": "//Assessment, Performed\ndefine fluent function isAssessmentPerformed(Obs List<ObservationScreeningAssessment>):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' }"
          }, {
            "url": "displaySequence",
            "valueInteger": 37
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "Status"
          }, {
            "url": "name",
            "valueString": "isInterventionOrder"
          }, {
            "url": "statement",
            "valueString": "//Intervention, Order\ndefine fluent function isInterventionOrder(ServiceRequest List<ServiceRequest>):\n  ServiceRequest S\n    where S.status in { 'active', 'completed' }\n      and S.intent in {'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order'}"
          }, {
            "url": "displaySequence",
            "valueInteger": 38
          } ]
        } ],
        "name": "EffectiveDataRequirements",
        "status": "active",
        "type": {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/library-type",
            "code": "module-definition"
          } ]
        },
        "relatedArtifact": [ {
          "type": "depends-on",
          "display": "QICore model information",
          "resource": "http://hl7.org/fhir/Library/QICore-ModelInfo"
        }, {
          "type": "depends-on",
          "display": "Library SDE",
          "resource": "https://madie.cms.gov/Library/SupplementalDataElements|5.1.000"
        }, {
          "type": "depends-on",
          "display": "Library FHIRHelpers",
          "resource": "https://madie.cms.gov/Library/FHIRHelpers|4.4.000"
        }, {
          "type": "depends-on",
          "display": "Library Status",
          "resource": "https://madie.cms.gov/Library/Status|1.15.000"
        }, {
          "type": "depends-on",
          "display": "Library QICoreCommon",
          "resource": "https://madie.cms.gov/Library/QICoreCommon|4.0.000"
        }, {
          "type": "depends-on",
          "display": "Library CQMCommon",
          "resource": "https://madie.cms.gov/Library/CQMCommon|4.1.000"
        }, {
          "type": "depends-on",
          "display": "Library Hospice",
          "resource": "https://madie.cms.gov/Library/Hospice|6.18.000"
        }, {
          "type": "depends-on",
          "display": "Code system SNOMEDCT",
          "resource": "http://snomed.info/sct"
        }, {
          "type": "depends-on",
          "display": "Code system ConditionVerificationStatusCodes",
          "resource": "http://terminology.hl7.org/CodeSystem/condition-ver-status"
        }, {
          "type": "depends-on",
          "display": "Code system LOINC",
          "resource": "http://loinc.org"
        }, {
          "type": "depends-on",
          "display": "Value set Office Visit",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001"
        }, {
          "type": "depends-on",
          "display": "Value set Emergency Department Evaluation and Management Visit",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010"
        }, {
          "type": "depends-on",
          "display": "Value set Detoxification Visit",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1059"
        }, {
          "type": "depends-on",
          "display": "Value set Initial Hospital Inpatient Visit",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1004"
        }, {
          "type": "depends-on",
          "display": "Value set Discharge Services Hospital Inpatient Same Day Discharge",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1006"
        }, {
          "type": "depends-on",
          "display": "Value set Discharge Services Hospital Inpatient",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1007"
        }, {
          "type": "depends-on",
          "display": "Value set Telephone Visits",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080"
        }, {
          "type": "depends-on",
          "display": "Value set Virtual Encounter",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089"
        }, {
          "type": "depends-on",
          "display": "Value set Substance Use Disorder",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1001"
        }, {
          "type": "depends-on",
          "display": "Value set Substance Use Disorder Treatment",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1005"
        }, {
          "type": "depends-on",
          "display": "Value set Psych Visit Psychotherapy",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496"
        }, {
          "type": "depends-on",
          "display": "Value set Substance Use Disorder Long Acting Medication Administration",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1156"
        }, {
          "type": "depends-on",
          "display": "Value set Substance Use Disorder Short Acting Medication Administration",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1157"
        }, {
          "type": "depends-on",
          "display": "Value set Substance Use Disorder Long Acting Medication",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1149"
        }, {
          "type": "depends-on",
          "display": "Value set Substance Use Disorder Short Acting Medication",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1150"
        }, {
          "type": "depends-on",
          "display": "Value set Payer Type",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
        }, {
          "type": "depends-on",
          "display": "Value set Encounter Inpatient",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
        }, {
          "type": "depends-on",
          "display": "Value set Hospice Encounter",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003"
        }, {
          "type": "depends-on",
          "display": "Value set Hospice Care Ambulatory",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584"
        }, {
          "type": "depends-on",
          "display": "Value set Hospice Diagnosis",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165"
        } ],
        "parameter": [ {
          "name": "Measurement Period",
          "use": "in",
          "min": 0,
          "max": "1",
          "type": "Period"
        }, {
          "name": "Denominator",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "boolean"
        }, {
          "name": "Numerator 1",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "boolean"
        }, {
          "name": "Numerator 2",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "boolean"
        }, {
          "name": "Initial Population",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "boolean"
        }, {
          "name": "Denominator Exclusions",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "boolean"
        }, {
          "name": "SDE Sex",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "Coding"
        }, {
          "name": "SDE Payer",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        }, {
          "name": "SDE Ethnicity",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "Resource"
        }, {
          "name": "SDE Race",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "Resource"
        }, {
          "name": "Stratification 3",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "boolean"
        }, {
          "name": "Stratification 2",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "boolean"
        }, {
          "name": "Stratification 1",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "boolean"
        } ],
        "dataRequirement": [ {
          "type": "Patient",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient" ],
          "mustSupport": [ "extension", "birthDate", "birthDate.value", "url" ]
        }, {
          "type": "Encounter",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
          "mustSupport": [ "type", "status", "status.value", "period" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001"
          } ]
        }, {
          "type": "Encounter",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
          "mustSupport": [ "type", "status", "status.value", "period" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1004"
          } ]
        }, {
          "type": "Encounter",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
          "mustSupport": [ "type", "status", "status.value", "period" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1006"
          } ]
        }, {
          "type": "Encounter",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
          "mustSupport": [ "type", "status", "status.value", "period" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1007"
          } ]
        }, {
          "type": "Encounter",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
          "mustSupport": [ "type", "status", "status.value", "period" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010"
          } ]
        }, {
          "type": "Encounter",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
          "mustSupport": [ "type", "status", "status.value", "period" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1059"
          } ]
        }, {
          "type": "Encounter",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
          "mustSupport": [ "type", "status", "status.value", "period" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080"
          } ]
        }, {
          "type": "Encounter",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
          "mustSupport": [ "type", "status", "status.value", "period" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089"
          } ]
        }, {
          "type": "Encounter",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
          "mustSupport": [ "type", "hospitalization", "hospitalization.dischargeDisposition", "period", "status", "status.value" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
          } ]
        }, {
          "type": "Encounter",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
          "mustSupport": [ "type", "period", "status", "status.value" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003"
          } ]
        }, {
          "type": "Condition",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis" ],
          "mustSupport": [ "code" ],
          "codeFilter": [ {
            "path": "code",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1001"
          } ]
        }, {
          "type": "Condition",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis" ]
        }, {
          "type": "Condition",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis" ],
          "mustSupport": [ "code" ],
          "codeFilter": [ {
            "path": "code",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165"
          } ]
        }, {
          "type": "Condition",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns" ]
        }, {
          "type": "Condition",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns" ],
          "mustSupport": [ "code" ],
          "codeFilter": [ {
            "path": "code",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165"
          } ]
        }, {
          "type": "Procedure",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
          "mustSupport": [ "code", "status", "status.value", "performed" ],
          "codeFilter": [ {
            "path": "code",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1005"
          } ]
        }, {
          "type": "Procedure",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
          "mustSupport": [ "code", "status", "status.value", "performed" ],
          "codeFilter": [ {
            "path": "code",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496"
          } ]
        }, {
          "type": "Procedure",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
          "mustSupport": [ "code", "status", "status.value", "performed" ],
          "codeFilter": [ {
            "path": "code",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1156"
          } ]
        }, {
          "type": "Procedure",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
          "mustSupport": [ "code", "status", "status.value", "performed" ],
          "codeFilter": [ {
            "path": "code",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1157"
          } ]
        }, {
          "type": "Procedure",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
          "mustSupport": [ "code", "performed", "status", "status.value" ],
          "codeFilter": [ {
            "path": "code",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584"
          } ]
        }, {
          "type": "MedicationRequest",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest" ],
          "mustSupport": [ "medication", "status", "status.value", "intent", "intent.value", "authoredOn", "authoredOn.value" ],
          "codeFilter": [ {
            "path": "medication",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1149"
          } ]
        }, {
          "type": "MedicationRequest",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest" ],
          "mustSupport": [ "medication", "status", "status.value", "intent", "intent.value", "authoredOn", "authoredOn.value" ],
          "codeFilter": [ {
            "path": "medication",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1150"
          } ]
        }, {
          "type": "MedicationRequest",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest" ],
          "mustSupport": [ "medication.reference.value", "status", "status.value", "intent", "intent.value", "authoredOn", "authoredOn.value" ]
        }, {
          "type": "Medication",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication" ],
          "mustSupport": [ "id.value", "code" ]
        }, {
          "type": "Coverage",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage" ],
          "mustSupport": [ "type", "period" ],
          "codeFilter": [ {
            "path": "type",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
          } ]
        }, {
          "type": "Observation",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment" ],
          "mustSupport": [ "code", "value", "effective", "status", "status.value" ],
          "codeFilter": [ {
            "path": "code",
            "code": [ {
              "system": "http://loinc.org",
              "code": "45755-6",
              "display": "Hospice care [Minimum Data Set]"
            } ]
          } ]
        }, {
          "type": "ServiceRequest",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest" ],
          "mustSupport": [ "code", "authoredOn", "authoredOn.value", "status", "status.value", "intent", "intent.value" ],
          "codeFilter": [ {
            "path": "code",
            "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584"
          } ]
        } ]
      } ],
      "extension": [ {
        "id": "supplementalDataGuidance",
        "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-supplementalDataGuidance",
        "extension": [ {
          "url": "guidance",
          "valueString": "For every patient evaluated by this measure also identify payer, race, ethnicity and sex"
        }, {
          "url": "usage",
          "valueCodeableConcept": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
              "code": "supplemental-data",
              "display": "Supplemental Data"
            } ],
            "text": "Supplemental Data Guidance"
          }
        } ]
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-definitionTerm",
        "extension": [ {
          "url": "term",
          "valueString": "Initiation of Treatment"
        }, {
          "url": "definition",
          "valueMarkdown": "The initiation of treatment is the first SUD treatment within 14 days of a new SUD episode. Treatment includes inpatient SUD admissions, outpatient visits, intensive outpatient encounters or partial hospitalizations, and medications for the treatment of SUD."
        } ]
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-definitionTerm",
        "extension": [ {
          "url": "term",
          "valueString": "New SUD Episode"
        }, {
          "url": "definition",
          "valueMarkdown": "The new SUD episode is the first encounter during the Intake Period with a diagnosis of SUD with no encounter or medication treatment for a diagnosis of SUD in the 60 days prior."
        } ]
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-definitionTerm",
        "extension": [ {
          "url": "term",
          "valueString": "The Intake Period"
        }, {
          "url": "definition",
          "valueMarkdown": "January 1-November 14 of the measurement year. The Intake Period is used to capture new SUD episodes. The November 14 cut-off date ensures that all services can occur before the measurement period ends."
        } ]
      }, {
        "url": "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements",
        "valueReference": {
          "reference": "#effective-data-requirements"
        }
      } ],
      "url": "https://madie.cms.gov/Measure/CMS137FHIRSUDTxInitEngagement",
      "identifier": [ {
        "use": "usual",
        "type": {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/artifact-identifier-type",
            "code": "short-name",
            "display": "Short Name"
          } ]
        },
        "system": "https://madie.cms.gov/measure/shortName",
        "value": "CMS137FHIR"
      }, {
        "use": "official",
        "type": {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/artifact-identifier-type",
            "code": "version-independent",
            "display": "Version Independent"
          } ]
        },
        "system": "urn:ietf:rfc:3986",
        "value": "urn:uuid:7738a412-7fff-4276-a140-8ee4c08503a2"
      }, {
        "use": "official",
        "type": {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/artifact-identifier-type",
            "code": "version-specific",
            "display": "Version Specific"
          } ]
        },
        "system": "urn:ietf:rfc:3986",
        "value": "urn:uuid:e156e1a3-4a76-4490-b3be-96a0d90f9b32"
      }, {
        "use": "official",
        "type": {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/artifact-identifier-type",
            "code": "publisher",
            "display": "Publisher"
          } ]
        },
        "system": "https://madie.cms.gov/measure/cmsId",
        "value": "137FHIR",
        "assigner": {
          "display": "CMS"
        }
      } ],
      "version": "1.0.000",
      "name": "CMS137FHIRSUDTxInitEngagement",
      "title": "Initiation and Engagement of Substance Use Disorder TreatmentFHIR",
      "status": "active",
      "experimental": false,
      "date": "2025-07-25T20:59:17+00:00",
      "publisher": "National Committee for Quality Assurance",
      "contact": [ {
        "telecom": [ {
          "system": "url",
          "value": "https://www.ncqa.org/"
        } ]
      } ],
      "description": "Percentage of patients 13 years of age and older with a new substance use disorder (SUD) episode who received the following (Two rates are reported): a. Percentage of patients who initiated treatment, including either an intervention or medication for the treatment of SUD, within 14 days of the new SUD episode. b. Percentage of patients who engaged in ongoing treatment, including two additional interventions or medication treatment events for SUD, or one long-acting medication event for the treatment of SUD, within 34 days of the initiation.",
      "usage": "This eCQM is a patient-based measure. This FHIR-based measure has been derived from the QDM-based measure: CMS137v14. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU6/) for more information on QI-Core and mapping recommendations from QDM to QI-Core STU 6. (https://hl7.org/fhir/us/qicore/STU6/qdm-to-qicore.html).",
      "copyright": "This Physician Performance Measure (Measure) and related data specifications are owned and were developed by the National Committee for Quality Assurance (NCQA). NCQA is not responsible for any use of the Measure. NCQA makes no representations, warranties or endorsements about the quality of any product, test or protocol identified as numerator compliant or otherwise identified as meeting the requirements of the measure or specification. NCQA makes no representations, warranties, or endorsement about the quality of any organization or physician that uses or reports performance measures and NCQA has no liability to anyone who relies on such measures or specifications. NCQA holds a copyright in the Measure. The Measure may be used for internal, noncommercial purposes (e.g., use by healthcare providers in connection with their practices) without obtaining approval from NCQA. All other uses, including a commercial use (including but not limited to vendors using or embedding the measures and specifications into any product or service to calculate measure results for customers for any purpose), must be approved by NCQA and are subject to a license at the discretion of NCQA. (C) 2012-2025 National Committee for Quality Assurance. All Rights Reserved. Limited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets. NCQA disclaims all liability for use or accuracy of any third-party codes contained in the specifications. CPT(R) codes, descriptions and other data are copyright 2025. American Medical Association. All rights reserved. CPT is a trademark of the American Medical Association. Fee schedules, relative value units, conversion factors and/or related components are not assigned by the AMA, are not part of CPT, and the AMA is not recommending their use. The AMA does not directly or indirectly practice medicine or dispense medical services. The AMA assumes no liability for data contained or not contained herein. Applicable FARS/DFARS restrictions apply to government use. Some measure specifications contain coding from LOINC(R) (https://loinc.org). The LOINC table, LOINC codes, LOINC panels and form file, LOINC linguistic variants file, LOINC/RSNA Radiology Playbook, and LOINC/IEEE Medical Device Code Mapping Table are copyright 2004-2025 Regenstrief Institute, Inc. and the Logical Observation Identifiers Names and Codes (LOINC) Committee, and are available at no cost under the license at https://loinc.org/kb/license/. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation. ICD-10 copyright 2025 World Health Organization. All Rights Reserved. Some measures use RxNorm, a standardized nomenclature and coding for clinical drugs and drug delivery devices, which is made publicly available courtesy of the U.S. National Library of Medicine (NLM), National Institutes of Health, Department of Health and Human Services. NLM is not responsible for the measures and does not endorse or recommend this or any other product. “HL7” is the registered trademark of Health Level Seven International.",
      "effectivePeriod": {
        "start": "2026-01-01",
        "end": "2026-12-31"
      },
      "author": [ {
        "name": "National Committee for Quality Assurance",
        "telecom": [ {
          "system": "url",
          "value": "https://www.ncqa.org/"
        } ]
      } ],
      "relatedArtifact": [ {
        "type": "citation",
        "citation": "American Psychiatric Association, Kleber, H. D., &amp; McIntyre, J. S. (2006). Practice Guideline for Treatment of Patients with Substance Use Disorders (pp. 1-276). Arlington, VA: American Psychiatric Association."
      }, {
        "type": "citation",
        "citation": "American Society of Addiction Medicine (ASAM). (2020). The ASAM National Practice Guideline for the Treatment of Opioid Use Disorder: 2020 Focused Update."
      }, {
        "type": "citation",
        "citation": "Department of Veteran Affairs, Department of Defense. (2015). VA/DoD Clinical Practice Guideline for the Management of Substance Use Disorders. Washington DC: Department of Veterans Affairs, Department of Defense."
      }, {
        "type": "citation",
        "citation": "Kampman, K., Jarvis, M. (2015). The ASAM National Practice Guideline for the Use of Medications in the Treatment of Addiction Involving Opioid Use. Journal of Addiction Medicine; 9(5), 358–367. https://doi.org/10.1097/ADM.0000000000000166"
      }, {
        "type": "citation",
        "citation": "Michigan Quality Improvement Consortium. (2021). Screening, Diagnosis and Referral for Substance Use Disorders. Southfield, (MI): Michigan Quality Improvement Consortium. Retrieved from https://www.improve.health/wp-content/uploads/2023/04/mqicscreeningdiagnosisandreferralforsubstanceusedisordersFINAL-1.pdf"
      }, {
        "type": "citation",
        "citation": "Reus, V. et al. (2018). Practice Guideline for the Pharmacological Treatment of Patients with Alcohol Use Disorder. American Journal of Psychiatry, 175(1), 86-90. https://doi.org/10.1176/appi.ajp.2017.1750101"
      }, {
        "type": "citation",
        "citation": "Substance Abuse and Mental Health Services Administration (SAMHSA). (2022). Key substance use and mental health indicators in the United States: Results from the 2021 National Survey on Drug Use and Health (HHS Publication No. PEP22-07-01-005, NSDUH Series H-57). Center for Behavioral Health Statistics and Quality, Substance Abuse and Mental Health Services Administration. https://www.samhsa.gov/data/report/2021-nsduh-annual-national-report"
      } ],
      "library": [ "https://madie.cms.gov/Library/CMS137FHIRSUDTxInitEngagement" ],
      "disclaimer": "The performance Measure is not a clinical guideline and does not establish a standard of medical care, and has not been tested for all potential applications. THE MEASURE AND SPECIFICATIONS ARE PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND. Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].",
      "rationale": "There are more deaths, illnesses and disabilities from substance abuse than from any other preventable health condition. In 2021, 46.3 million individuals in the U.S. age 12 or older (16.5 percent of the population) met the diagnosis criteria for having an SUD within the past year (Substance Abuse and Mental Health Services Administration [SAMHSA], 2022). Despite the high prevalence of SUD in the U.S., 94 percent of individuals aged 12 or older with an SUD did not receive any treatment (SAMHSA, 2022).",
      "clinicalRecommendationStatement": "American Society of Addiction Medicine (2020) - All Food and Drug Administration approved medications for the treatment of opioid use disorder should be available to all patients. Clinicians should consider the patient’s preferences, past treatment history, current state of illness, and treatment setting when deciding between the use of methadone, buprenorphine, and naltrexone. - There is no recommended time limit for pharmacological treatment - Patients’ psychosocial needs should be assessed, and patients should be offered or referred to psychosocial treatment based on their individual needs. However, a patient’s decision to decline psychosocial treatment or the absence of available psychosocial treatment should not preclude or delay pharmacotherapy, with appropriate medication management. Motivational interviewing or enhancement can be used to encourage patients to engage in psychosocial treatment services appropriate for addressing individual needs. American Psychiatric Association (2018) - Patients with alcohol use disorder should have a documented comprehensive and person-centered treatment plan that includes evidence-based nonpharmacological and pharmacological treatments. [1C] - Naltrexone or acamprosate should be offered to patients with moderate to severe alcohol use disorder who have a goal of reducing alcohol consumption or achieving abstinence, prefer pharmacotherapy or have not responded to nonpharmacological treatments alone, and have no contraindications to the use of these medications. [1B] - Disulfiram should be offered to patients with moderate to severe alcohol use disorder who have a goal of achieving abstinence, prefer disulfiram or are intolerant to or have not responded to naltrexone and acamprosate, are capable of understanding the risks of alcohol consumption while taking disulfiram, and have no contraindications to the use of this medication. [2C] - Topiramate or gabapentin should be offered to patients with moderate to severe alcohol use disorder who have a goal of reducing alcohol consumption or achieving abstinence, prefer topiramate or gabapentin or are intolerant to or have not responded to naltrexone and acamprosate, and have no contraindications to the use of these medications. [2C] American Psychiatric Association (2006) - Because many substance use disorders are chronic, patients usually require long-term treatment, although the intensity and specific components of treatment may vary over time [I rating]. - It is important to intensify the monitoring for substance use during periods when the patient is at a high risk of relapsing, including during the early stages of treatment, times of transition to less intensive levels of care, and the first year after active treatment has ceased [I rating]. - Outpatient treatment of substance use disorders is appropriate for patients whose clinical condition or environmental circumstances do not require a more intensive level of care [I rating]. As in other treatment settings, a comprehensive approach is optimal, using, where indicated, a variety of psychotherapeutic and pharmacological interventions along with behavioral monitoring [I rating]. - Disulfiram is also recommended for patients with alcohol dependence [II rating]. - Naltrexone, injectable naltrexone, acamprosate, a y-aminobutyric acid (GABA) are recommended for patients with alcohol dependence [I rating]. Disulfiram is also recommended for patients with alcohol dependence [II rating]. - Methadone and buprenorphine are recommended for patients with opioid dependence [I rating]. - Naltrexone is an alternative strategy [I rating]. American Society of Addiction Medicine (2015) - Methadone and buprenorphine are recommended for opioid use disorder treatment and withdrawal management. - Naltrexone (oral; extended-release injectable) is recommended for relapse prevention. Michigan Quality Improvement Consortium (2021) - Patients with substance use disorder or risky substance use: Patient Education and Brief Intervention by a Primary Care Physician (PCP) or Trained Staff (e.g., Registered Nurse [RN], Master of Social Work [MSW]) - If diagnosed with substance use disorder or risky substance use, initiate an intervention within 14 days. - Frequent follow-up is helpful to support behavior change; preferably 2 visits within 30 days. - Refer to a substance abuse health specialist, an addiction physician specialist, or a physician experienced in pharmacologic management of addiction. Department of Veterans Affairs/Department of Defense (2015) - Offer referral to specialty SUD care for addiction treatment based on willingness to engage. [B] - For patients with moderate-severe alcohol use disorder, we recommend: Acamprosate, Disulfiram, Naltrexone- oral or extended release, or Topiramate. [A] - Medications should be offered in combined with addiction-focused counseling, offering one or more of the following interventions considering patient preference and provider training/competence: Behavioral Couples Therapy for alcohol use disorder, Cognitive Behavioral Therapy for substance use disorders, Community Reinforcement Approach, Motivational Enhancement Therapy, 12-Step Facilitation. [A] - For patients with opioid use disorder we recommend buprenorphine/naloxone or methadone in an Opioid Treatment Program. For patients for whom agonist treatment is contraindicated, unacceptable, unavailable, or discontinued, we recommend extended-release injectable naltrexone. [A] - For patients initiated in an intensive phase of outpatient or residential treatment, recommend ongoing systematic relapse prevention efforts or recovery support, individualized on the basis of treatment response. [A]",
      "group": [ {
        "id": "Group_1",
        "extension": [ {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring",
          "valueCodeableConcept": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
              "code": "proportion",
              "display": "Proportion"
            } ]
          }
        }, {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis",
          "valueCode": "boolean"
        }, {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-type",
          "valueCodeableConcept": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-type",
              "code": "process",
              "display": "Process"
            } ]
          }
        }, {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-rateAggregation",
          "valueCode": "None"
        }, {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-improvementNotation",
          "valueCodeableConcept": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation",
              "code": "increase",
              "display": "Increased score indicates improvement"
            } ]
          }
        } ],
        "population": [ {
          "id": "InitialPopulation_1",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "initial-population",
              "display": "Initial Population"
            } ]
          },
          "description": "Patients 13 years of age and older as of the start of the measurement period who were diagnosed with a new SUD episode during a visit between January 1 and November 14 of the measurement period",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Initial Population"
          }
        }, {
          "id": "Denominator_1",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "denominator",
              "display": "Denominator"
            } ]
          },
          "description": "Equals Initial Population",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Denominator"
          }
        }, {
          "id": "DenominatorExclusion_1",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "denominator-exclusion",
              "display": "Denominator Exclusion"
            } ]
          },
          "description": "Exclude patients who are in hospice care for any part of the measurement period",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Denominator Exclusions"
          }
        }, {
          "id": "Numerator_1",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "numerator",
              "display": "Numerator"
            } ]
          },
          "description": "Initiation of treatment includes either an intervention or medication for the treatment of SUD within 14 days of the new SUD episode.",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Numerator 1"
          }
        } ],
        "stratifier": [ {
          "id": "Stratification_1_1",
          "extension": [ {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "initial-population",
                "display": "Initial Population"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator",
                "display": "Denominator"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator-exclusion",
                "display": "Denominator Exclusion"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "numerator",
                "display": "Numerator"
              } ]
            }
          } ],
          "description": "Report a total score, and each of the following strata: Stratum 1: Patients age 13-17 at the start of the measurement period",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Stratification 1"
          }
        }, {
          "id": "Stratification_1_2",
          "extension": [ {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "initial-population",
                "display": "Initial Population"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator",
                "display": "Denominator"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator-exclusion",
                "display": "Denominator Exclusion"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "numerator",
                "display": "Numerator"
              } ]
            }
          } ],
          "description": "Stratum 2: Patients age 18-64 at the start of the measurement period",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Stratification 2"
          }
        }, {
          "id": "Stratification_1_3",
          "extension": [ {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "initial-population",
                "display": "Initial Population"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator",
                "display": "Denominator"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator-exclusion",
                "display": "Denominator Exclusion"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "numerator",
                "display": "Numerator"
              } ]
            }
          } ],
          "description": "Stratum 3: Patients age 65 and older at the start of the measurement period",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Stratification 3"
          }
        } ]
      }, {
        "id": "Group_2",
        "extension": [ {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring",
          "valueCodeableConcept": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
              "code": "proportion",
              "display": "Proportion"
            } ]
          }
        }, {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis",
          "valueCode": "boolean"
        }, {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-type",
          "valueCodeableConcept": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-type",
              "code": "process",
              "display": "Process"
            } ]
          }
        }, {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-rateAggregation",
          "valueCode": "None"
        }, {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-improvementNotation",
          "valueCodeableConcept": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation",
              "code": "increase",
              "display": "Increased score indicates improvement"
            } ]
          }
        } ],
        "population": [ {
          "id": "InitialPopulation_2",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "initial-population",
              "display": "Initial Population"
            } ]
          },
          "description": "Patients 13 years of age and older as of the start of the measurement period who were diagnosed with a new SUD episode during a visit between January 1 and November 14 of the measurement period",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Initial Population"
          }
        }, {
          "id": "Denominator_2",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "denominator",
              "display": "Denominator"
            } ]
          },
          "description": "Equals Initial Population",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Denominator"
          }
        }, {
          "id": "DenominatorExclusion_2",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "denominator-exclusion",
              "display": "Denominator Exclusion"
            } ]
          },
          "description": "Exclude patients who are in hospice care for any part of the measurement period",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Denominator Exclusions"
          }
        }, {
          "id": "Numerator_2",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "numerator",
              "display": "Numerator"
            } ]
          },
          "description": "Engagement in ongoing SUD treatment within 34 days of initiation includes: 1. A long-acting SUD medication on the day after the initiation through 34 days after the initiation of treatment. 2. One of the following options on the day after the initiation of treatment through 34 days after the initiation of treatment: a) two engagement visits, b) two engagement medication treatment events, c) one engagement visit and one engagement medication treatment event.",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Numerator 2"
          }
        } ],
        "stratifier": [ {
          "id": "Stratification_2_1",
          "extension": [ {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "initial-population",
                "display": "Initial Population"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator",
                "display": "Denominator"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator-exclusion",
                "display": "Denominator Exclusion"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "numerator",
                "display": "Numerator"
              } ]
            }
          } ],
          "description": "Report a total score, and each of the following strata: Stratum 1: Patients age 13-17 at the start of the measurement period",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Stratification 1"
          }
        }, {
          "id": "Stratification_2_2",
          "extension": [ {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "initial-population",
                "display": "Initial Population"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator",
                "display": "Denominator"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator-exclusion",
                "display": "Denominator Exclusion"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "numerator",
                "display": "Numerator"
              } ]
            }
          } ],
          "description": "Stratum 2: Patients age 18-64 at the start of the measurement period",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Stratification 2"
          }
        }, {
          "id": "Stratification_2_3",
          "extension": [ {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "initial-population",
                "display": "Initial Population"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator",
                "display": "Denominator"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator-exclusion",
                "display": "Denominator Exclusion"
              } ]
            }
          }, {
            "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-appliesTo",
            "valueCodeableConcept": {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "numerator",
                "display": "Numerator"
              } ]
            }
          } ],
          "description": "Stratum 3: Patients age 65 and older at the start of the measurement period",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Stratification 3"
          }
        } ]
      } ],
      "supplementalData": [ {
        "id": "sde-ethnicity",
        "usage": [ {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
            "code": "supplemental-data"
          } ]
        } ],
        "description": "SDE Ethnicity",
        "criteria": {
          "language": "text/cql-identifier",
          "expression": "SDE Ethnicity"
        }
      }, {
        "id": "sde-payer",
        "usage": [ {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
            "code": "supplemental-data"
          } ]
        } ],
        "description": "SDE Payer",
        "criteria": {
          "language": "text/cql-identifier",
          "expression": "SDE Payer"
        }
      }, {
        "id": "sde-race",
        "usage": [ {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
            "code": "supplemental-data"
          } ]
        } ],
        "description": "SDE Race",
        "criteria": {
          "language": "text/cql-identifier",
          "expression": "SDE Race"
        }
      }, {
        "id": "sde-sex",
        "usage": [ {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
            "code": "supplemental-data"
          } ]
        } ],
        "description": "SDE Sex",
        "criteria": {
          "language": "text/cql-identifier",
          "expression": "SDE Sex"
        }
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Measure/CMS137FHIRSUDTxInitEngagement"
    }
  }, {
    "fullUrl": "https://madie.cms.gov/Library/CMS137FHIRSUDTxInitEngagement",
    "resource": {
      "resourceType": "Library",
      "id": "CMS137FHIRSUDTxInitEngagement",
      "meta": {
        "profile": [ "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-computablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-executablelibrary", "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-json-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-xml-library" ]
      },
      "language": "en",
      "text": {
        "status": "extensions",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"col-12\">\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n<td class=\"content-container\">CMS137FHIRSUDTxInitEngagement</td>\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n<td class=\"content-container\">1.0.000</td>\n</tr>\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n<td class=\"content-container\">CMS137FHIRSUDTxInitEngagement</td>\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward (Publisher)</th>\n\n\n<td class=\"content-container\">National Committee for Quality Assurance</td>\n</tr>\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n<td class=\"content-container\">CMS137FHIRSUDTxInitEngagement</td>\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/library-type#logic-library]</td>\n</tr>\n\n\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1004\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1006\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1007\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1059\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Condition\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1001\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, performed\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1005\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, performed\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, performed\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1156\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, performed\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1157\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: MedicationRequest\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: medication, authoredOn, authoredOn.value\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: medication</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1149\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: MedicationRequest\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: medication, authoredOn, authoredOn.value\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: medication</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1150\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: MedicationRequest\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: medication.reference.value, authoredOn, authoredOn.value\n    <br/>\n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Medication\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: id.value, code\n    <br/>\n   \n   \n  </td>\n</tr>\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">CQL Content</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">library CMS137FHIRSUDTxInitEngagement version '1.0.000'\r\n\r\nusing QICore version '6.0.0'\r\n\r\ninclude FHIRHelpers version '4.4.000' called FHIRHelpers\r\ninclude QICoreCommon version '4.0.000' called QICoreCommon\r\ninclude SupplementalDataElements version '5.1.000' called SDE\r\ninclude CQMCommon version '4.1.000' called CQMCommon\r\ninclude Hospice version '6.18.000' called Hospice\r\ninclude Status version '1.15.000' called Status\r\n\r\nvalueset &quot;Detoxification Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1059'\r\nvalueset &quot;Discharge Services Hospital Inpatient&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1007'\r\nvalueset &quot;Discharge Services Hospital Inpatient Same Day Discharge&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1006'\r\nvalueset &quot;Emergency Department Evaluation and Management Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010'\r\nvalueset &quot;Initial Hospital Inpatient Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1004'\r\nvalueset &quot;Office Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001'\r\nvalueset &quot;Psych Visit Psychotherapy&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496'\r\nvalueset &quot;Substance Use Disorder&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1001'\r\nvalueset &quot;Substance Use Disorder Long Acting Medication&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1149'\r\nvalueset &quot;Substance Use Disorder Long Acting Medication Administration&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1156'\r\nvalueset &quot;Substance Use Disorder Short Acting Medication&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1150'\r\nvalueset &quot;Substance Use Disorder Short Acting Medication Administration&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1157'\r\nvalueset &quot;Substance Use Disorder Treatment&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1005'\r\nvalueset &quot;Telephone Visits&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080'\r\nvalueset &quot;Virtual Encounter&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089'\r\n\r\nparameter &quot;Measurement Period&quot; Interval&lt;DateTime&gt;\r\n\r\ncontext Patient\r\n\r\ndefine &quot;Initial Population&quot;:\r\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) &gt;= 13\r\n    and &quot;First SUD Episode During Measurement Period&quot; is not null\r\n    and not exists &quot;History of SUD Diagnosis or Treatment&quot;\r\n\r\ndefine &quot;First SUD Episode During Measurement Period&quot;:\r\n  First((&quot;Qualifying Encounters&quot;) ValidEncounters\r\n      with(([ConditionEncounterDiagnosis: &quot;Substance Use Disorder&quot;]).verified()) SUDDiagnosis\r\n        such that ValidEncounters.period during &quot;Measurement Period&quot;\r\n          and SUDDiagnosis.prevalenceInterval() starts during ValidEncounters.period\r\n          and SUDDiagnosis.prevalenceInterval() starts 47 days or more before day of \r\n          end of &quot;Measurement Period&quot;\r\n      return {\r\n        ValidEncounterDate: date from start of ValidEncounters.period,\r\n        ValidEncounter: ValidEncounters\r\n      }\r\n      sort by ValidEncounterDate\r\n  ).ValidEncounter\r\n\r\ndefine &quot;Qualifying Encounters&quot;:\r\n  ( [Encounter: &quot;Office Visit&quot;]\r\n      union [Encounter: &quot;Emergency Department Evaluation and Management Visit&quot;]\r\n      union [Encounter: &quot;Detoxification Visit&quot;]\r\n      union [Encounter: &quot;Initial Hospital Inpatient Visit&quot;]\r\n      union [Encounter: &quot;Discharge Services Hospital Inpatient Same Day Discharge&quot;]\r\n      union [Encounter: &quot;Discharge Services Hospital Inpatient&quot;]\r\n      union [Encounter: &quot;Telephone Visits&quot;]\r\n      union [Encounter: &quot;Virtual Encounter&quot;]\r\n  ).isEncounterPerformed ( )\r\n\r\ndefine &quot;History of SUD Diagnosis or Treatment&quot;:\r\n  ( ( ( [Procedure: &quot;Substance Use Disorder Treatment&quot;]\r\n        union [Procedure: &quot;Psych Visit Psychotherapy&quot;]\r\n        union [Procedure: &quot;Substance Use Disorder Long Acting Medication Administration&quot;]\r\n        union [Procedure: &quot;Substance Use Disorder Short Acting Medication Administration&quot;]\r\n    ).isInterventionPerformed ( ) ) Interventions\r\n      with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\r\n        such that Interventions.performed.toInterval ( ) starts 60 days or less before day of date from start of FirstSUDEpisode.period\r\n  )\r\n    union ( ( ( &quot;Qualifying Encounters&quot;\r\n        except &quot;Emergency Department or Detoxification Visit&quot; ) QualifyingEncounter\r\n        where QualifyingEncounter.encounterDiagnosis ( ).code in &quot;Substance Use Disorder&quot; ) SUDEncounterDx\r\n        with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\r\n          such that SUDEncounterDx.period starts 60 days or less before day of date from start of FirstSUDEpisode.period\r\n    )\r\n    union ( ( ( [MedicationRequest: &quot;Substance Use Disorder Long Acting Medication&quot;]\r\n          union [MedicationRequest: &quot;Substance Use Disorder Short Acting Medication&quot;]\r\n      ).isMedicationOrder ( ) ) SUDMedication\r\n        with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\r\n          such that SUDMedication.authoredOn 60 days or less before day of date from start of FirstSUDEpisode.period\r\n    )\r\n\r\ndefine &quot;Emergency Department or Detoxification Visit&quot;:\r\n  ( [Encounter: &quot;Emergency Department Evaluation and Management Visit&quot;]\r\n      union [Encounter: &quot;Detoxification Visit&quot;]\r\n  ).isEncounterPerformed ( )\r\n\r\ndefine &quot;Denominator&quot;:\r\n  &quot;Initial Population&quot;\r\n\r\ndefine &quot;Denominator Exclusions&quot;:\r\n  Hospice.&quot;Has Hospice Services&quot;\r\n\r\ndefine &quot;Numerator 1&quot;:\r\n  exists &quot;Treatment Initiation With Non Medication Intervention Dates&quot;\r\n    or exists &quot;Treatment Initiation With Medication Order Dates&quot;\r\n\r\ndefine &quot;Treatment Initiation With Non Medication Intervention Dates&quot;:\r\n  ( &quot;Psychosocial Visit&quot; PsychosocialVisitProcedure\r\n      let treatmentDate: date from start of PsychosocialVisitProcedure.performed.toInterval ( )\r\n      with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\r\n        such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\r\n          and PsychosocialVisitProcedure.id !~ FirstSUDEpisode.id\r\n      return all treatmentDate\r\n  )\r\n    union ( &quot;Psychosocial Visit&quot; PsychosocialVisitEncounter\r\n        let treatmentDate: date from start of PsychosocialVisitEncounter.period\r\n        with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\r\n          such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\r\n            and PsychosocialVisitEncounter.id !~ FirstSUDEpisode.id\r\n        return all treatmentDate\r\n    )\r\n\r\ndefine &quot;Psychosocial Visit&quot;:\r\n  ( ( [Procedure: &quot;Substance Use Disorder Treatment&quot;]\r\n        union [Procedure: &quot;Psych Visit Psychotherapy&quot;]\r\n    ).isInterventionPerformed ( )\r\n  )\r\n    union ( ( [Encounter: &quot;Telephone Visits&quot;]\r\n        union [Encounter: &quot;Virtual Encounter&quot;]\r\n    ).isEncounterPerformed ( ) ) TelehealthEncounter\r\n      where TelehealthEncounter.encounterDiagnosis ( ).code in &quot;Substance Use Disorder&quot;\r\n\r\ndefine &quot;Treatment Initiation With Medication Order Dates&quot;:\r\n  ( ( ( [MedicationRequest: &quot;Substance Use Disorder Short Acting Medication&quot;]\r\n        union [MedicationRequest: &quot;Substance Use Disorder Long Acting Medication&quot;]\r\n    ).isMedicationOrder ( ) ) SUDMedication\r\n      let treatmentDate: date from start of SUDMedication.authoredOn.toInterval ( )\r\n      with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\r\n        such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\r\n      return all treatmentDate\r\n  )\r\n    union ( ( ( [Procedure: &quot;Substance Use Disorder Short Acting Medication Administration&quot;]\r\n          union [Procedure: &quot;Substance Use Disorder Long Acting Medication Administration&quot;]\r\n      ).isProcedurePerformed ( ) ) SUDMedAdministration\r\n        let treatmentDate: date from start of SUDMedAdministration.performed.toInterval ( )\r\n        with &quot;First SUD Episode During Measurement Period&quot; FirstSUDEpisode\r\n          such that treatmentDate during Interval[date from start of FirstSUDEpisode.period, date from start of FirstSUDEpisode.period + 14 days )\r\n        return all treatmentDate\r\n    )\r\n\r\ndefine &quot;Has Two or More Treatment Engagements With Short Acting Medication or Non Medication Intervention&quot;:\r\n  Count(((&quot;Psychosocial Visit&quot;\r\n        union(([Procedure: &quot;Substance Use Disorder Short Acting Medication Administration&quot;]).isProcedurePerformed())) ShortActingTreatment\r\n        with(Min(&quot;Treatment Initiation With Non Medication Intervention Dates&quot;\r\n            union &quot;Treatment Initiation With Medication Order Dates&quot;\r\n        )) InitiationTreatmentDate\r\n          such that date from start of ShortActingTreatment.performed.toInterval() 34 days or less after InitiationTreatmentDate\r\n            or date from start of ShortActingTreatment.period 34 days or less after InitiationTreatmentDate\r\n        return all ShortActingTreatment\r\n    )\r\n      union((([MedicationRequest: &quot;Substance Use Disorder Short Acting Medication&quot;]).isMedicationOrder()) ShortActingMedOrder\r\n          with(Min(&quot;Treatment Initiation With Non Medication Intervention Dates&quot;\r\n              union &quot;Treatment Initiation With Medication Order Dates&quot;\r\n          )) InitiationTreatmentDate\r\n            such that date from start of ShortActingMedOrder.authoredOn.toInterval() 34 days or less after InitiationTreatmentDate\r\n          return all ShortActingMedOrder\r\n      )\r\n  ) &gt;= 2\r\n\r\ndefine &quot;Numerator 2&quot;:\r\n  &quot;Has Treatment Engagement With Long Acting Medication&quot;\r\n    or &quot;Has Two or More Treatment Engagements With Short Acting Medication or Non Medication Intervention&quot;\r\n\r\ndefine &quot;Has Treatment Engagement With Long Acting Medication&quot;:\r\n  exists ( ( ( ( [MedicationRequest: &quot;Substance Use Disorder Long Acting Medication&quot;] ).isMedicationOrder ( ) ) LongActingMedOrder\r\n        with ( Min(&quot;Treatment Initiation With Non Medication Intervention Dates&quot;\r\n            union &quot;Treatment Initiation With Medication Order Dates&quot;\r\n        ) ) InitiationTreatmentDate\r\n          such that date from start of LongActingMedOrder.authoredOn.toInterval ( ) 34 days or less after InitiationTreatmentDate\r\n    )\r\n      union ( ( ( [Procedure: &quot;Substance Use Disorder Long Acting Medication Administration&quot;] ).isProcedurePerformed ( ) ) LongActingTreatment\r\n          with ( Min(&quot;Treatment Initiation With Non Medication Intervention Dates&quot;\r\n              union &quot;Treatment Initiation With Medication Order Dates&quot;\r\n          ) ) InitiationTreatmentDate\r\n            such that date from start of LongActingTreatment.performed.toInterval ( ) 34 days or less after InitiationTreatmentDate\r\n      )\r\n  )\r\n\r\ndefine &quot;SDE Ethnicity&quot;:\r\n  SDE.&quot;SDE Ethnicity&quot;\r\n\r\ndefine &quot;SDE Payer&quot;:\r\n  SDE.&quot;SDE Payer&quot;\r\n\r\ndefine &quot;SDE Race&quot;:\r\n  SDE.&quot;SDE Race&quot;\r\n\r\ndefine &quot;SDE Sex&quot;:\r\n  SDE.&quot;SDE Sex&quot;\r\n\r\ndefine &quot;Stratification 1&quot;:\r\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) in Interval[13, 17]\r\n\r\ndefine &quot;Stratification 2&quot;:\r\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) in Interval[18, 64]\r\n\r\ndefine &quot;Stratification 3&quot;:\r\n  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) &gt;= 65</code></pre>\n      </td>\n    </tr>\n    \n    \n    \n  \n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.4.8 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
      },
      "url": "https://madie.cms.gov/Library/CMS137FHIRSUDTxInitEngagement",
      "identifier": [ {
        "use": "official",
        "system": "https://madie.cms.gov/login",
        "value": "CMS137FHIRSUDTxInitEngagement"
      } ],
      "version": "1.0.000",
      "name": "CMS137FHIRSUDTxInitEngagement",
      "title": "CMS137FHIRSUDTxInitEngagement",
      "status": "active",
      "experimental": false,
      "type": {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/library-type",
          "code": "logic-library"
        } ]
      },
      "date": "2025-07-25T20:59:18+00:00",
      "publisher": "National Committee for Quality Assurance",
      "description": "CMS137FHIRSUDTxInitEngagement",
      "relatedArtifact": [ {
        "type": "depends-on",
        "display": "QICore model information",
        "resource": "http://hl7.org/fhir/Library/QICore-ModelInfo"
      }, {
        "type": "depends-on",
        "display": "Library SDE",
        "resource": "https://madie.cms.gov/Library/SupplementalDataElements|5.1.000"
      }, {
        "type": "depends-on",
        "display": "Library Status",
        "resource": "https://madie.cms.gov/Library/Status|1.15.000"
      }, {
        "type": "depends-on",
        "display": "Library QICoreCommon",
        "resource": "https://madie.cms.gov/Library/QICoreCommon|4.0.000"
      }, {
        "type": "depends-on",
        "display": "Library CQMCommon",
        "resource": "https://madie.cms.gov/Library/CQMCommon|4.1.000"
      }, {
        "type": "depends-on",
        "display": "Library Hospice",
        "resource": "https://madie.cms.gov/Library/Hospice|6.18.000"
      }, {
        "type": "depends-on",
        "display": "Value set Office Visit",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001"
      }, {
        "type": "depends-on",
        "display": "Value set Emergency Department Evaluation and Management Visit",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010"
      }, {
        "type": "depends-on",
        "display": "Value set Detoxification Visit",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1059"
      }, {
        "type": "depends-on",
        "display": "Value set Initial Hospital Inpatient Visit",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1004"
      }, {
        "type": "depends-on",
        "display": "Value set Discharge Services Hospital Inpatient Same Day Discharge",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1006"
      }, {
        "type": "depends-on",
        "display": "Value set Discharge Services Hospital Inpatient",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1007"
      }, {
        "type": "depends-on",
        "display": "Value set Telephone Visits",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080"
      }, {
        "type": "depends-on",
        "display": "Value set Virtual Encounter",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089"
      }, {
        "type": "depends-on",
        "display": "Value set Substance Use Disorder",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1001"
      }, {
        "type": "depends-on",
        "display": "Value set Substance Use Disorder Treatment",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1005"
      }, {
        "type": "depends-on",
        "display": "Value set Psych Visit Psychotherapy",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496"
      }, {
        "type": "depends-on",
        "display": "Value set Substance Use Disorder Long Acting Medication Administration",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1156"
      }, {
        "type": "depends-on",
        "display": "Value set Substance Use Disorder Short Acting Medication Administration",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1157"
      }, {
        "type": "depends-on",
        "display": "Value set Substance Use Disorder Long Acting Medication",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1149"
      }, {
        "type": "depends-on",
        "display": "Value set Substance Use Disorder Short Acting Medication",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1150"
      } ],
      "dataRequirement": [ {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1004"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1006"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1007"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1059"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089"
        } ]
      }, {
        "type": "Condition",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis" ],
        "mustSupport": [ "code" ],
        "codeFilter": [ {
          "path": "code",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1001"
        } ]
      }, {
        "type": "Procedure",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
        "mustSupport": [ "code", "performed" ],
        "codeFilter": [ {
          "path": "code",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.106.12.1005"
        } ]
      }, {
        "type": "Procedure",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
        "mustSupport": [ "code", "performed" ],
        "codeFilter": [ {
          "path": "code",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496"
        } ]
      }, {
        "type": "Procedure",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
        "mustSupport": [ "code", "performed" ],
        "codeFilter": [ {
          "path": "code",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1156"
        } ]
      }, {
        "type": "Procedure",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
        "mustSupport": [ "code", "performed" ],
        "codeFilter": [ {
          "path": "code",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1157"
        } ]
      }, {
        "type": "MedicationRequest",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest" ],
        "mustSupport": [ "medication", "authoredOn", "authoredOn.value" ],
        "codeFilter": [ {
          "path": "medication",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1149"
        } ]
      }, {
        "type": "MedicationRequest",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest" ],
        "mustSupport": [ "medication", "authoredOn", "authoredOn.value" ],
        "codeFilter": [ {
          "path": "medication",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1150"
        } ]
      }, {
        "type": "MedicationRequest",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest" ],
        "mustSupport": [ "medication.reference.value", "authoredOn", "authoredOn.value" ]
      }, {
        "type": "Medication",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication" ],
        "mustSupport": [ "id.value", "code" ]
      } ],
      "content": [ {
        "contentType": "text/cql",
        "data": "[encoded data, 15208 characters]"
      }, {
        "contentType": "application/elm+json",
        "data": "[encoded data, 368508 characters]"
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Library/CMS137FHIRSUDTxInitEngagement"
    }
  }, {
    "fullUrl": "https://madie.cms.gov/Library/CQMCommon",
    "resource": {
      "resourceType": "Library",
      "id": "CQMCommon",
      "meta": {
        "profile": [ "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-computablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-executablelibrary", "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-json-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-xml-library" ]
      },
      "language": "en",
      "text": {
        "status": "extensions",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"col-12\">\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n<td class=\"content-container\">CQMCommon</td>\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n<td class=\"content-container\">4.1.000</td>\n</tr>\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n<td class=\"content-container\">67dda0df9e9ab93ec36dad4f</td>\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward (Publisher)</th>\n\n\n<td class=\"content-container\">ICF</td>\n</tr>\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n<td class=\"content-container\">This library contains declarations that are commonly used in eCQMs and shared across the logic of multiple measures, such as the Encounter Inpatient value set, and the Inpatient Encounter population criteria definition. This library also contains functions for calculating hospitalization duration as well as hospital arrival and departure times.</td>\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/library-type#logic-library]</td>\n</tr>\n\n\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Location\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-location\n    <br/>        \n  \n   \n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Condition\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis\n    <br/>        \n  \n   \n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Condition\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns\n    <br/>        \n  \n   \n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period, rank, rank.value, use, condition, location, location.type, diagnosis, diagnosis.code, onAdmission\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period, rank, rank.value, use, condition, location, location.type, diagnosis, diagnosis.code, onAdmission\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, status, status.value, period, rank, rank.value, use, condition, location, location.type, diagnosis, diagnosis.code, onAdmission\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period, rank, rank.value, use, condition, location, location.type, diagnosis, diagnosis.code, onAdmission\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.38\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: period, rank, rank.value, use, condition, location, location.type, diagnosis, diagnosis.code, type, onAdmission\n    <br/>\n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Claim\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-claim\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: status, status.value, use, use.value, item\n    <br/>\n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: MedicationRequest\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: medication\n    <br/>\n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Medication\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code\n    <br/>\n   \n   \n  </td>\n</tr>\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">CQL Content</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">library CQMCommon version '4.1.000'\n\nusing QICore version '6.0.0'\n\ninclude FHIRHelpers version '4.4.000' called FHIRHelpers\ninclude QICoreCommon version '4.0.000' called QICoreCommon\n\ncodesystem DiagnosisRole: 'http://terminology.hl7.org/CodeSystem/diagnosis-role'\ncodesystem &quot;Diagnosis Type&quot;: 'http://terminology.hl7.org/CodeSystem/ex-diagnosistype'\ncodesystem &quot;Procedure Type&quot;: 'http://terminology.hl7.org/CodeSystem/ex-procedure-type'\ncodesystem &quot;Present On Admission Indicators&quot;: 'https://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/HospitalAcqCond/Coding'\n\nvalueset &quot;Emergency Department Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'\nvalueset &quot;Encounter Inpatient&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'\nvalueset &quot;Intensive Care Unit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.206'\nvalueset &quot;Observation Services&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143'\nvalueset &quot;Outpatient Surgery Service&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.38'\nvalueset &quot;Present on Admission or Clinically Undetermined&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1147.197'\n\ncode &quot;Billing&quot;: 'billing' from DiagnosisRole display 'Billing'\ncode &quot;Admitting Diagnosis&quot;: 'admitting' from &quot;Diagnosis Type&quot; display 'Admitting Diagnosis'\ncode &quot;Clinical Diagnosis&quot;: 'clinical' from &quot;Diagnosis Type&quot; display 'Clinical Diagnosis'\ncode &quot;Differential Diagnosis&quot;: 'differential' from &quot;Diagnosis Type&quot; display 'Differential Diagnosis'\ncode &quot;Discharge Diagnosis&quot;: 'discharge' from &quot;Diagnosis Type&quot; display 'Discharge Diagnosis'\ncode &quot;Laboratory Diagnosis&quot;: 'laboratory' from &quot;Diagnosis Type&quot; display 'Laboratory Diagnosis'\ncode &quot;Nursing Diagnosis&quot;: 'nursing' from &quot;Diagnosis Type&quot; display 'Nursing Diagnosis'\ncode &quot;Prenatal Diagnosis&quot;: 'prenatal' from &quot;Diagnosis Type&quot; display 'Prenatal Diagnosis'\ncode &quot;Principal Diagnosis&quot;: 'principal' from &quot;Diagnosis Type&quot; display 'Principal Diagnosis'\ncode &quot;Radiology Diagnosis&quot;: 'radiology' from &quot;Diagnosis Type&quot; display 'Radiology Diagnosis'\ncode &quot;Remote Diagnosis&quot;: 'remote' from &quot;Diagnosis Type&quot; display 'Remote Diagnosis'\ncode &quot;Retrospective Diagnosis&quot;: 'retrospective' from &quot;Diagnosis Type&quot; display 'Retrospetive Diagnosis'\ncode &quot;Self Diagnosis&quot;: 'self' from &quot;Diagnosis Type&quot; display 'Self Diagnosis'\ncode &quot;Primary procedure&quot;: 'primary' from &quot;Procedure Type&quot; display 'Primary procedure'\ncode &quot;POA-Y&quot;: 'Y' from &quot;Present On Admission Indicators&quot; display 'POA-Y'\ncode &quot;POA-N&quot;: 'N' from &quot;Present On Admission Indicators&quot; display 'POA-N'\ncode &quot;POA-W&quot;: 'W' from &quot;Present On Admission Indicators&quot; display 'POA-W'\ncode &quot;POA-1&quot;: '1' from &quot;Present On Admission Indicators&quot; display 'POA-1'\ncode &quot;POA-U&quot;: 'U' from &quot;Present On Admission Indicators&quot; display 'POA-U'\n\nparameter &quot;Measurement Period&quot; Interval&lt;DateTime&gt;\n\ncontext Patient\n\ndefine &quot;Inpatient Encounter&quot;:\n  [Encounter: &quot;Encounter Inpatient&quot;] EncounterInpatient\n    where EncounterInpatient.status = 'finished'\n      and EncounterInpatient.period ends during day of &quot;Measurement Period&quot;\n\n/*\n@description: Returns an interval of date values extracted from the input interval of date-time values\n@comment: This function returns an interval constructed using the `date from` extractor on the start\nand end values of the input date-time interval. Note that using a precision specifier such as `day of`\nas part of a timing phrase is preferred to communicate intent to perform day-level comparison, as well\nas for general readability.\n*/\ndefine function &quot;ToDateInterval&quot;(period Interval&lt;DateTime&gt;):\n  Interval[date from start of period, date from end of period]\n\n/*\n@description: Calculates the difference in calendar days between the start and end of the given interval.\n@deprecated: This function in deprecated. Use the fluent function `lengthInDays()` instead.\n*/\ndefine function &quot;LengthInDays&quot;(Value Interval&lt;DateTime&gt; ):\n  difference in days between start of Value and end of Value\n\n/*\n@description: Calculates the difference in calendar days between the start and end of the given interval.\n*/\ndefine fluent function lengthInDays(Value Interval&lt;DateTime&gt; ):\n  difference in days between start of Value and end of Value\n\n/*\n@description: Returns the most recent emergency department visit, if any, that occurs 1 hour or less prior to the given encounter.\n@deprecated: This function is deprecated. Use the fluent function `edVisit()` instead.\n*/\ndefine function &quot;ED Visit&quot;(TheEncounter Encounter ):\n  Last(\n    [Encounter: &quot;Emergency Department Visit&quot;] EDVisit\n      where EDVisit.status = 'finished'\n        and EDVisit.period ends 1 hour or less on or before start of TheEncounter.period\n      sort by end of period\n    )\n\n/*\n@description: Returns the most recent emergency department visit, if any, that occurs 1 hour or less prior to the given encounter.\n*/\ndefine fluent function edVisit(TheEncounter Encounter ):\n  Last(\n    [Encounter: &quot;Emergency Department Visit&quot;] EDVisit\n      where EDVisit.status = 'finished'\n        and EDVisit.period ends 1 hour or less on or before start of TheEncounter.period\n      sort by end of period\n    )\n\n/*\n@description: Hospitalization returns the total interval for admission to discharge for the given encounter, or for the admission of any immediately prior emergency department visit to the discharge of the given encounter.\n@deprecated: This function is deprecated. Use the fluent function `hospitalization()` instead.\n*/\ndefine function &quot;Hospitalization&quot;(TheEncounter Encounter ):\n  ( &quot;ED Visit&quot;(TheEncounter) ) X\n    return\n        if X is null then TheEncounter.period\n        else Interval[start of X.period, end of TheEncounter.period)\n\n/*\n@description: Hospitalization returns the total interval for admission to discharge for the given encounter, or for the admission of any immediately prior emergency department visit to the discharge of the given encounter.\n*/\ndefine fluent function hospitalization(TheEncounter Encounter ):\n  (TheEncounter.&quot;edVisit&quot;()) X\n    return\n        if X is null then TheEncounter.period\n        else Interval[start of X.period, end of TheEncounter.period]\n\n/*\n@description: Returns list of all locations within an encounter, including locations for immediately prior ED visit.\n@deprecated: This function is deprecated. Use the fluent function `hospitalizationLocations()` instead.\n*/\ndefine function &quot;Hospitalization Locations&quot;(TheEncounter Encounter ):\n  ( &quot;ED Visit&quot;(TheEncounter) ) EDEncounter\n    return\n        if EDEncounter is null then TheEncounter.location\n        else flatten { EDEncounter.location, TheEncounter.location }\n\n/*\n@description: Returns list of all locations within an encounter, including locations for immediately prior ED visit.\n*/\ndefine fluent function hospitalizationLocations(TheEncounter Encounter ):\n  ( TheEncounter.&quot;edVisit&quot;()) EDEncounter\n    return\n        if EDEncounter is null then TheEncounter.location\n        else flatten { EDEncounter.location, TheEncounter.location }\n\n/*\n@description: Returns the length of stay in days (i.e. the number of days between admission and discharge) for the given encounter, or from the admission of any immediately prior emergency department visit to the discharge of the encounter\n@deprecated: This function is deprecated. Use the fluent function `hospitalizationLengthOfStay()` instead.\n*/\ndefine function &quot;Hospitalization Length of Stay&quot;(TheEncounter Encounter ):\n  LengthInDays(&quot;Hospitalization&quot;(TheEncounter))\n\n/*\n@description: Returns the length of stay in days (i.e. the number of days between admission and discharge) for the given encounter, or from the admission of any immediately prior emergency department visit to the discharge of the encounter\n*/\ndefine fluent function hospitalizationLengthOfStay(TheEncounter Encounter ):\n   TheEncounter.&quot;hospitalization&quot;().&quot;lengthInDays&quot;()\n\n/*\n@description: Returns admission time for an encounter or for immediately prior emergency department visit.\n@deprecated: This function is deprecated. Use the fluent function `hospitalAdmissionTime()` instead.\n*/\ndefine function &quot;Hospital Admission Time&quot;(TheEncounter Encounter ):\n  start of &quot;Hospitalization&quot;(TheEncounter)\n\n/*\n@description: Returns admission time for an encounter or for immediately prior emergency department visit.\n*/\ndefine fluent function hospitalAdmissionTime(TheEncounter Encounter ):\n  start of (TheEncounter.&quot;hospitalization&quot;())\n\n/*\n@description: Hospital Discharge Time returns the discharge time for an encounter\n@deprecated: This function is deprecated. Use the fluent function `hospitalDischargeTime()` instead.\n*/\ndefine function &quot;Hospital Discharge Time&quot;(TheEncounter Encounter ):\n  end of TheEncounter.period\n\n/*\n@description: Hospital Discharge Time returns the discharge time for an encounter\n*/\ndefine fluent function hospitalDischargeTime(TheEncounter Encounter ):\n  end of TheEncounter.period\n\n/*\n@description: Returns earliest arrival time for an encounter including any prior ED visit.\n@deprecated: This function is deprecated. Use the fluent function `hospitalArrivalTime()` instead.\n*/\ndefine function &quot;Hospital Arrival Time&quot;(TheEncounter Encounter ):\n  start of First(\n  \t    (&quot;Hospitalization Locations&quot;(TheEncounter) ) HospitalLocation\n  \t\t\tsort by start of period\n  \t).period\n\n/*\n@description: Returns earliest arrival time for an encounter including any prior ED visit.\n*/\ndefine fluent function hospitalArrivalTime(TheEncounter Encounter ):\n  start of First(\n  \t    (TheEncounter.&quot;hospitalizationLocations&quot;()) HospitalLocation\n  \t\t\tsort by start of period\n  \t).period\n\n/*\n@description: Returns the latest departure time for encounter including any prior ED visit.\n@deprecated: This function is deprecated. Use the fluent function `hospitalDepartureTime()` instead.\n*/\ndefine function &quot;Hospital Departure Time&quot;(TheEncounter Encounter):\n\tend of Last(\n\t    ( &quot;Hospitalization Locations&quot;(TheEncounter) ) HospitalLocation\n\t\t\tsort by start of period\n\t).period\n\n/*\n@description: Returns the latest departure time for encounter including any prior ED visit.\n*/\ndefine fluent function hospitalDepartureTime(TheEncounter Encounter):\n\tend of Last(\n\t    (TheEncounter.&quot;hospitalizationLocations&quot;()) HospitalLocation\n\t\t\tsort by start of period\n\t).period\n\n/*\n@description: Returns the emergency department arrival time for the encounter.\n@deprecated. This function is deprecated. Use the fluent function `emergencyDepartmentArrivalTime()` instead.\n*/\ndefine function &quot;Emergency Department Arrival Time&quot;(TheEncounter Encounter):\n\tstart of (\n\t    singleton from (\n\t        ( &quot;Hospitalization Locations&quot;(TheEncounter) ) HospitalLocation\n\t\t\t\twhere GetLocation(HospitalLocation.location).type in &quot;Emergency Department Visit&quot;\n\t\t)\n\t).period\n\n/*\n@description: Returns the emergency department arrival time for the encounter.\n*/\ndefine fluent function emergencyDepartmentArrivalTime(TheEncounter Encounter):\n\tstart of (\n\t    singleton from (\n\t        ( (TheEncounter.&quot;hospitalizationLocations&quot;()) ) HospitalLocation\n\t\t\t\twhere GetLocation(HospitalLocation.location).type in &quot;Emergency Department Visit&quot;\n\t\t)\n\t).period\n\n/*\n@description: Hospitalization with Observation and Outpatient Surgery Service returns the total interval from the start of any immediately prior emergency department visit, outpatient surgery visit or observation visit to the discharge of the given encounter.\n@deprecated: This function is deprecated. Use the fluent function `hospitalizationWithObservationAndOutpatientSurgeryService()` instead.\n*/\ndefine function &quot;HospitalizationWithObservationAndOutpatientSurgeryService&quot;(TheEncounter &quot;Encounter&quot; ):\n  TheEncounter Visit\n\t  let ObsVisit: Last([Encounter: &quot;Observation Services&quot;] LastObs\n\t\t  \twhere LastObs.status = 'finished'\n          and LastObs.period ends 1 hour or less on or before start of Visit.period\n\t\t\t  sort by\tend of period\n    \t),\n    \tVisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),\n    \tEDVisit: Last([Encounter: &quot;Emergency Department Visit&quot;] LastED\n\t\t\t  where LastED.status = 'finished'\n          and LastED.period ends 1 hour or less on or before VisitStart\n\t\t\t  sort by\tend of period\n    \t),\n    \tVisitStartWithED: Coalesce(start of EDVisit.period, VisitStart),\n    \tOutpatientSurgeryVisit: Last([Encounter: &quot;Outpatient Surgery Service&quot;] LastSurgeryOP\n\t\t\t  where LastSurgeryOP.period ends 1 hour or less on or before VisitStartWithED\n\t\t\t  sort by\tend of period\n    \t)\n  \treturn Interval[Coalesce(start of OutpatientSurgeryVisit.period, VisitStartWithED), end of Visit.period]\n\n/*\n@description: Hospitalization with Observation and Outpatient Surgery Service returns the total interval from the start of any immediately prior emergency department visit, outpatient surgery visit or observation visit to the discharge of the given encounter.\n*/\ndefine fluent function hospitalizationWithObservationAndOutpatientSurgeryService(TheEncounter &quot;Encounter&quot; ):\n  TheEncounter Visit\n\t  let ObsVisit: Last([Encounter: &quot;Observation Services&quot;] LastObs\n\t\t  \twhere LastObs.status = 'finished'\n          and LastObs.period ends 1 hour or less on or before start of Visit.period\n\t\t\t  sort by\tend of period\n    \t),\n    \tVisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),\n    \tEDVisit: Last([Encounter: &quot;Emergency Department Visit&quot;] LastED\n\t\t\t  where LastED.status = 'finished'\n          and LastED.period ends 1 hour or less on or before VisitStart\n\t\t\t  sort by\tend of period\n    \t),\n    \tVisitStartWithED: Coalesce(start of EDVisit.period, VisitStart),\n    \tOutpatientSurgeryVisit: Last([Encounter: &quot;Outpatient Surgery Service&quot;] LastSurgeryOP\n\t\t\t  where LastSurgeryOP.period ends 1 hour or less on or before VisitStartWithED\n\t\t\t  sort by\tend of period\n    \t)\n  \treturn Interval[Coalesce(start of OutpatientSurgeryVisit.period, VisitStartWithED), end of Visit.period]\n\n/*\n@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\n@deprecated: This function is deprecated. Use the fluent function `hospitalizationWithObservation()` instead.\n*/\ndefine function &quot;HospitalizationWithObservation&quot;(TheEncounter Encounter ):\n  TheEncounter Visit\n  \t\tlet ObsVisit: Last([Encounter: &quot;Observation Services&quot;] LastObs\n  \t\t\t\twhere LastObs.status = 'finished'\n            and LastObs.period ends 1 hour or less on or before start of Visit.period\n  \t\t\t\tsort by end of period\n  \t\t\t),\n  \t\t\tVisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),\n  \t\t\tEDVisit: Last([Encounter: &quot;Emergency Department Visit&quot;] LastED\n  \t\t\t\twhere LastED.status = 'finished'\n            and LastED.period ends 1 hour or less on or before VisitStart\n  \t\t\t\tsort by end of period\n  \t\t\t)\n  \t\treturn Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]\n\n/*\n@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\n*/\ndefine fluent function hospitalizationWithObservation(TheEncounter Encounter ):\n  TheEncounter Visit\n  \t\tlet ObsVisit: Last([Encounter: &quot;Observation Services&quot;] LastObs\n  \t\t\t\twhere LastObs.status = 'finished'\n            and LastObs.period ends 1 hour or less on or before start of Visit.period\n  \t\t\t\tsort by end of period\n  \t\t\t),\n  \t\t\tVisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),\n  \t\t\tEDVisit: Last([Encounter: &quot;Emergency Department Visit&quot;] LastED\n  \t\t\t\twhere LastED.status = 'finished'\n            and LastED.period ends 1 hour or less on or before VisitStart\n  \t\t\t\tsort by end of period\n  \t\t\t)\n  \t\treturn Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]\n\n/*\n@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\n@deprecated: This function is deprecated. Use the fluent function `hospitalizationWithObservationLengthofStay()` instead.\n*/\ndefine function &quot;HospitalizationWithObservationLengthofStay&quot;(TheEncounter &quot;Encounter&quot; ):\n  &quot;LengthInDays&quot;(&quot;HospitalizationWithObservation&quot;(TheEncounter))\n\n/*\n@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\n*/\ndefine fluent function hospitalizationWithObservationLengthofStay(TheEncounter &quot;Encounter&quot; ):\n  ((TheEncounter.&quot;hospitalizationWithObservation&quot;().&quot;lengthInDays&quot;()))\n\n/*\n@description: First Inpatient Intensive Care Unit returns the first intensive care unit for the given encounter, without considering any immediately prior emergency department visit.\n@deprecated: This function is deprecated. Use the fluent function `firstInpatientIntensiveCareUnit()` instead.\n*/\ndefine function &quot;FirstInpatientIntensiveCareUnit&quot;(Encounter Encounter ):\n  First((Encounter.location)HospitalLocation\n  \t\t\twhere GetLocation(HospitalLocation.location).type in &quot;Intensive Care Unit&quot;\n  \t\t\t\tand HospitalLocation.period during Encounter.period\n  \t\t\tsort by start of period\n  \t)\n\n/*\n@description: First Inpatient Intensive Care Unit returns the first intensive care unit for the given encounter, without considering any immediately prior emergency department visit.\n*/\ndefine fluent function firstInpatientIntensiveCareUnit(Encounter Encounter ):\n  First((Encounter.location)HospitalLocation\n  \t\t\twhere GetLocation(HospitalLocation.location).type in &quot;Intensive Care Unit&quot;\n  \t\t\t\tand HospitalLocation.period during Encounter.period\n  \t\t\tsort by start of period\n  \t)\n\n/*\n@description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter\n@deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead.\n*/\ndefine function &quot;EncounterDiagnosis&quot;(Encounter Encounter ):\n  Encounter.diagnosis D\n\treturn singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where D.condition.references(C.id))\n\n/*  \n@description: Returns the Condition resources referenced by the diagnosis element of the Encounter  \n*/\ndefine fluent function encounterDiagnosis(Encounter Encounter ):\n  Encounter.reasonReference D\n    return singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where D.references(C.id))\n\n\n/*\n@description: Returns the Condition resource for the given reference\n@deprecated: This function is deprecated. Use the fluent function `getCondition()` instead\n*/\ndefine function &quot;GetCondition&quot;(reference Reference):\n  singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where reference.references(C.id))\n\n/*\n@description: Returns the Condition resource for the given reference\n*/\ndefine fluent function getCondition(reference Reference):\n  singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where reference.references(C.id))\n\n/*\n@description: Returns the condition that is specified as the principal diagnosis for the encounter\n@deprecated: This function is deprecated. Use the fluent function `principalDiagnosis()` instead.\n*/\ndefine function &quot;PrincipalDiagnosis&quot;(Encounter Encounter):\n\tsingleton from (\n\t(Encounter.diagnosis D where D.rank = 1 and D.use ~ &quot;Billing&quot;) PD\n      return singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where PD.condition.references(C.id))\n\t)\n\n/*\n@description: Returns the claim diagnosis element that is specified as the principal diagnosis for the encounter\n @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information\n*/\ndefine fluent function principalDiagnosis(encounter Encounter):\nsingleton from (\n     (encounter.claimDiagnosis()) CD\n       where CD.type.includesCode(&quot;Principal Diagnosis&quot;)\n   )\n/*\n@description: Returns the claim diagnosis elements for the given encounter\n@comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information\n*/\ndefine fluent function claimDiagnosis(encounter Encounter):\n  encounter E\n    let \n      claim: ([Claim] C where C.status = 'active' and C.use = 'claim' and exists (C.item I where I.encounter.references(E))),\n      claimItem: (claim.item I where I.encounter.references(E))\n    return claim.diagnosis D where D.sequence in claimItem.diagnosisSequence\n\n\n/*\n @description: Returns the condition that is specified as the principal diagnosis for the encounter and has a code in the given valueSet.\n @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information\n */\n define fluent function hasPrincipalDiagnosisOf(encounter Encounter, valueSet ValueSet):\n   (encounter.principalDiagnosis()) PD\n     return PD.diagnosis in valueSet\n       or PD.diagnosis.getCondition().code in valueSet\n\n/*\n @description: Returns true if the given diagnosis is present on admission, based on the given poaValueSet\n @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information\n */\n define fluent function isDiagnosisPresentOnAdmission(encounter Encounter, diagnosisValueSet ValueSet, poaValueSet ValueSet):\n   exists (\n     (encounter.claimDiagnosis()) CD\n       where CD.onAdmission in poaValueSet\n         and (\n           CD.diagnosis in diagnosisValueSet\n             or CD.diagnosis.getCondition().code in diagnosisValueSet\n         )\n   )\n\n/*\n@description: Returns the Location resource specified by the given reference\n@deprecated: This function is deprecated. Use the fluent function `getLocation()` instead.\n*/\ndefine function &quot;GetLocation&quot;(reference Reference):\n  singleton from (\n    [Location] L where reference.references(L)\n  )\n\n/*\n@description: Returns the Location resource specified by the given reference.\n*/\ndefine fluent function getLocation(reference Reference):\n  singleton from (\n    [Location] L where reference.references(L)\n  )\n\n/*\n@description: Returns the medication code for the given MedicationRequest\n@deprecated: This function is deprecated. Use the fluent function `getMedicationCode()` instead.\n*/\ndefine function &quot;GetMedicationCode&quot;(request MedicationRequest):\n  if request.medication is Concept then\n  \t  request.medication as Concept\n  \telse\n  \t  (singleton from ([Medication] M where request.medication.references(M))).code\n\n/*\n@description: Returns the medication code for the given MedicationRequest\n*/\ndefine fluent function getMedicationCode(request MedicationRequest):\n  if request.medication is Concept then\n  \t  request.medication as Concept\n  \telse\n  \t  (singleton from ([Medication] M where request.medication.references(M))).code\n  \t  \n/*\n@description: Returns the claim procedure elements for the given encounter\n*/\ndefine fluent function principalProcedure(encounter Encounter):  \t  \n  \t encounter E\n  \t let \n        claim: [Claim] C where C.status = 'active' and C.use = 'claim' and exists (C.item I where I.encounter.references(E)),\n        claimItem: claim.item I where I.encounter.references(E),\n        princProcedure: singleton from (claim.procedure P where P.sequence in claimItem.procedureSequence and P.type.includesCode(&quot;Primary procedure&quot;))\n    return princProcedure</code></pre>\n      </td>\n    </tr>\n    \n    \n    \n  \n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.4.8 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
      },
      "extension": [ {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
          "code": "billing",
          "display": "Billing"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "admitting",
          "display": "Admitting Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "clinical",
          "display": "Clinical Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "differential",
          "display": "Differential Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "discharge",
          "display": "Discharge Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "laboratory",
          "display": "Laboratory Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "nursing",
          "display": "Nursing Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "prenatal",
          "display": "Prenatal Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "principal",
          "display": "Principal Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "radiology",
          "display": "Radiology Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "remote",
          "display": "Remote Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "retrospective",
          "display": "Retrospective Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype",
          "code": "self",
          "display": "Self Diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/ex-procedure-type",
          "code": "primary",
          "display": "Primary procedure"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "https://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/HospitalAcqCond/Coding",
          "code": "Y",
          "display": "POA-Y"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "https://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/HospitalAcqCond/Coding",
          "code": "N",
          "display": "POA-N"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "https://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/HospitalAcqCond/Coding",
          "code": "W",
          "display": "POA-W"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "https://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/HospitalAcqCond/Coding",
          "code": "1",
          "display": "POA-1"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "https://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/HospitalAcqCond/Coding",
          "code": "U",
          "display": "POA-U"
        }
      } ],
      "url": "https://madie.cms.gov/Library/CQMCommon",
      "identifier": [ {
        "use": "official",
        "system": "https://madie.cms.gov/login",
        "value": "67dda0df9e9ab93ec36dad4f"
      } ],
      "version": "4.1.000",
      "name": "CQMCommon",
      "title": "CQMCommon",
      "status": "active",
      "experimental": false,
      "type": {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/library-type",
          "code": "logic-library"
        } ]
      },
      "date": "2025-07-25T20:59:19+00:00",
      "publisher": "ICF",
      "description": "This library contains declarations that are commonly used in eCQMs and shared across the logic of multiple measures, such as the Encounter Inpatient value set, and the Inpatient Encounter population criteria definition. This library also contains functions for calculating hospitalization duration as well as hospital arrival and departure times.",
      "relatedArtifact": [ {
        "type": "depends-on",
        "display": "QICore model information",
        "resource": "http://hl7.org/fhir/Library/QICore-ModelInfo"
      }, {
        "type": "depends-on",
        "display": "Library QICoreCommon",
        "resource": "https://madie.cms.gov/Library/QICoreCommon|4.0.000"
      }, {
        "type": "depends-on",
        "display": "Library FHIRHelpers",
        "resource": "https://madie.cms.gov/Library/FHIRHelpers|4.4.000"
      }, {
        "type": "depends-on",
        "display": "Code system DiagnosisRole",
        "resource": "http://terminology.hl7.org/CodeSystem/diagnosis-role"
      }, {
        "type": "depends-on",
        "display": "Code system Diagnosis Type",
        "resource": "http://terminology.hl7.org/CodeSystem/ex-diagnosistype"
      }, {
        "type": "depends-on",
        "display": "Code system Procedure Type",
        "resource": "http://terminology.hl7.org/CodeSystem/ex-procedure-type"
      }, {
        "type": "depends-on",
        "display": "Value set Observation Services",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"
      }, {
        "type": "depends-on",
        "display": "Value set Emergency Department Visit",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
      }, {
        "type": "depends-on",
        "display": "Value set Outpatient Surgery Service",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.38"
      }, {
        "type": "depends-on",
        "display": "Value set Encounter Inpatient",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
      }, {
        "type": "depends-on",
        "display": "Value set Intensive Care Unit",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.206"
      } ],
      "dataRequirement": [ {
        "type": "Location",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-location" ]
      }, {
        "type": "Condition",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis" ]
      }, {
        "type": "Condition",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns" ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "status", "status.value", "period", "rank", "rank.value", "use", "condition", "location", "location.type", "diagnosis", "diagnosis.code", "onAdmission" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "status", "status.value", "period", "rank", "rank.value", "use", "condition", "location", "location.type", "diagnosis", "diagnosis.code", "onAdmission" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "status", "status.value", "period", "rank", "rank.value", "use", "condition", "location", "location.type", "diagnosis", "diagnosis.code", "onAdmission" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "period", "rank", "rank.value", "use", "condition", "location", "location.type", "diagnosis", "diagnosis.code", "onAdmission" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.38"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "period", "rank", "rank.value", "use", "condition", "location", "location.type", "diagnosis", "diagnosis.code", "type", "onAdmission" ]
      }, {
        "type": "Claim",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-claim" ],
        "mustSupport": [ "status", "status.value", "use", "use.value", "item" ]
      }, {
        "type": "MedicationRequest",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest" ],
        "mustSupport": [ "medication" ]
      }, {
        "type": "Medication",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication" ],
        "mustSupport": [ "code" ]
      } ],
      "content": [ {
        "contentType": "text/cql",
        "data": "[encoded data, 32192 characters]"
      }, {
        "contentType": "application/elm+xml",
        "data": "[encoded data, 704780 characters]"
      }, {
        "contentType": "application/elm+json",
        "data": "[encoded data, 1082368 characters]"
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Library/CQMCommon"
    }
  }, {
    "fullUrl": "https://madie.cms.gov/Library/SupplementalDataElements",
    "resource": {
      "resourceType": "Library",
      "id": "SupplementalDataElements",
      "meta": {
        "profile": [ "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-computablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-executablelibrary", "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-json-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-xml-library" ]
      },
      "language": "en",
      "text": {
        "status": "extensions",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"col-12\">\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n<td class=\"content-container\">SupplementalDataElements</td>\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n<td class=\"content-container\">5.1.000</td>\n</tr>\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n<td class=\"content-container\">67e5bc4d88f4d211353e632e</td>\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward (Publisher)</th>\n\n\n<td class=\"content-container\">ICF</td>\n</tr>\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n<td class=\"content-container\">This is the QI-Core 6.0.0 version of the Supplemental Data Elements library containing the CMS SDE definitions for Payer, Race, Ethnicity and Sex</td>\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/library-type#logic-library]</td>\n</tr>\n\n\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Patient\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: extension, url\n    <br/>\n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Coverage\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">CQL Content</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">/*\r\n@update: GCW 2025-03-27 -&gt;\r\nUpdated to reflect valueset name change from CMS Sex to Federal Administrative Sex\r\n*/\r\nlibrary SupplementalDataElements version '5.1.000'\r\n\r\nusing QICore version '6.0.0'\r\n\r\ninclude FHIRHelpers version '4.4.000' called FHIRHelpers\r\n\r\ncodesystem &quot;SNOMEDCT&quot;: 'http://snomed.info/sct'\r\n\r\nvalueset &quot;Ethnicity&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837'\r\nvalueset &quot;Federal Administrative Sex&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1021.121'\r\nvalueset &quot;Payer Type&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591'\r\nvalueset &quot;Race&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836'\r\n\r\ncode &quot;Male (finding)&quot;: '248153007' from &quot;SNOMEDCT&quot; display 'Male (finding)'\r\ncode &quot;Female (finding)&quot;: '248152002' from &quot;SNOMEDCT&quot; display 'Female (finding)'\r\n\r\ncontext Patient\r\n\r\ndefine &quot;SDE Ethnicity&quot;:\r\n  Patient.ethnicity E\r\n    return Tuple {\r\n      codes: { E.ombCategory } union E.detailed,\r\n      display: E.text\r\n    }\r\n\r\ndefine &quot;SDE Payer&quot;:\r\n  [Coverage: type in &quot;Payer Type&quot;] Payer\r\n    return {\r\n      code: Payer.type,\r\n      period: Payer.period\r\n    }\r\n\r\ndefine &quot;SDE Race&quot;:\r\n  Patient.race R\r\n    return Tuple {\r\n      codes: R.ombCategory union R.detailed,\r\n      display: R.text\r\n    }\r\n\r\ndefine &quot;SDE Sex&quot;:\r\n  case\r\n    when Patient.sex = '248153007' then &quot;Male (finding)&quot;\r\n    when Patient.sex = '248152002' then &quot;Female (finding)&quot;\r\n    else null\r\n  end</code></pre>\n      </td>\n    </tr>\n    \n    \n    \n  \n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.4.8 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
      },
      "extension": [ {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://snomed.info/sct",
          "code": "248153007",
          "display": "Male (finding)"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://snomed.info/sct",
          "code": "248152002",
          "display": "Female (finding)"
        }
      } ],
      "url": "https://madie.cms.gov/Library/SupplementalDataElements",
      "identifier": [ {
        "use": "official",
        "system": "https://madie.cms.gov/login",
        "value": "67e5bc4d88f4d211353e632e"
      } ],
      "version": "5.1.000",
      "name": "SupplementalDataElements",
      "title": "SupplementalDataElements",
      "status": "active",
      "experimental": false,
      "type": {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/library-type",
          "code": "logic-library"
        } ]
      },
      "date": "2025-07-25T20:59:19+00:00",
      "publisher": "ICF",
      "description": "This is the QI-Core 6.0.0 version of the Supplemental Data Elements library containing the CMS SDE definitions for Payer, Race, Ethnicity and Sex",
      "relatedArtifact": [ {
        "type": "depends-on",
        "display": "QICore model information",
        "resource": "http://hl7.org/fhir/Library/QICore-ModelInfo"
      }, {
        "type": "depends-on",
        "display": "Library FHIRHelpers",
        "resource": "https://madie.cms.gov/Library/FHIRHelpers|4.4.000"
      }, {
        "type": "depends-on",
        "display": "Code system SNOMEDCT",
        "resource": "http://snomed.info/sct"
      }, {
        "type": "depends-on",
        "display": "Value set Payer Type",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
      } ],
      "dataRequirement": [ {
        "type": "Patient",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient" ],
        "mustSupport": [ "extension", "url" ]
      }, {
        "type": "Coverage",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage" ],
        "mustSupport": [ "type", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
        } ]
      } ],
      "content": [ {
        "contentType": "text/cql",
        "data": "LyoNCkB1cGRhdGU6IEdDVyAyMDI1LTAzLTI3IC0+DQpVcGRhdGVkIHRvIHJlZmxlY3QgdmFsdWVzZXQgbmFtZSBjaGFuZ2UgZnJvbSBDTVMgU2V4IHRvIEZlZGVyYWwgQWRtaW5pc3RyYXRpdmUgU2V4DQoqLw0KbGlicmFyeSBTdXBwbGVtZW50YWxEYXRhRWxlbWVudHMgdmVyc2lvbiAnNS4xLjAwMCcNCg0KdXNpbmcgUUlDb3JlIHZlcnNpb24gJzYuMC4wJw0KDQppbmNsdWRlIEZISVJIZWxwZXJzIHZlcnNpb24gJzQuNC4wMDAnIGNhbGxlZCBGSElSSGVscGVycw0KDQpjb2Rlc3lzdGVtICJTTk9NRURDVCI6ICdodHRwOi8vc25vbWVkLmluZm8vc2N0Jw0KDQp2YWx1ZXNldCAiRXRobmljaXR5IjogJ2h0dHA6Ly9jdHMubmxtLm5paC5nb3YvZmhpci9WYWx1ZVNldC8yLjE2Ljg0MC4xLjExNDIyMi40LjExLjgzNycNCnZhbHVlc2V0ICJGZWRlcmFsIEFkbWluaXN0cmF0aXZlIFNleCI6ICdodHRwOi8vY3RzLm5sbS5uaWguZ292L2ZoaXIvVmFsdWVTZXQvMi4xNi44NDAuMS4xMTM3NjIuMS40LjEwMjEuMTIxJw0KdmFsdWVzZXQgIlBheWVyIFR5cGUiOiAnaHR0cDovL2N0cy5ubG0ubmloLmdvdi9maGlyL1ZhbHVlU2V0LzIuMTYuODQwLjEuMTE0MjIyLjQuMTEuMzU5MScNCnZhbHVlc2V0ICJSYWNlIjogJ2h0dHA6Ly9jdHMubmxtLm5paC5nb3YvZmhpci9WYWx1ZVNldC8yLjE2Ljg0MC4xLjExNDIyMi40LjExLjgzNicNCg0KY29kZSAiTWFsZSAoZmluZGluZykiOiAnMjQ4MTUzMDA3JyBmcm9tICJTTk9NRURDVCIgZGlzcGxheSAnTWFsZSAoZmluZGluZyknDQpjb2RlICJGZW1hbGUgKGZpbmRpbmcpIjogJzI0ODE1MjAwMicgZnJvbSAiU05PTUVEQ1QiIGRpc3BsYXkgJ0ZlbWFsZSAoZmluZGluZyknDQoNCmNvbnRleHQgUGF0aWVudA0KDQpkZWZpbmUgIlNERSBFdGhuaWNpdHkiOg0KICBQYXRpZW50LmV0aG5pY2l0eSBFDQogICAgcmV0dXJuIFR1cGxlIHsNCiAgICAgIGNvZGVzOiB7IEUub21iQ2F0ZWdvcnkgfSB1bmlvbiBFLmRldGFpbGVkLA0KICAgICAgZGlzcGxheTogRS50ZXh0DQogICAgfQ0KDQpkZWZpbmUgIlNERSBQYXllciI6DQogIFtDb3ZlcmFnZTogdHlwZSBpbiAiUGF5ZXIgVHlwZSJdIFBheWVyDQogICAgcmV0dXJuIHsNCiAgICAgIGNvZGU6IFBheWVyLnR5cGUsDQogICAgICBwZXJpb2Q6IFBheWVyLnBlcmlvZA0KICAgIH0NCg0KZGVmaW5lICJTREUgUmFjZSI6DQogIFBhdGllbnQucmFjZSBSDQogICAgcmV0dXJuIFR1cGxlIHsNCiAgICAgIGNvZGVzOiBSLm9tYkNhdGVnb3J5IHVuaW9uIFIuZGV0YWlsZWQsDQogICAgICBkaXNwbGF5OiBSLnRleHQNCiAgICB9DQoNCmRlZmluZSAiU0RFIFNleCI6DQogIGNhc2UNCiAgICB3aGVuIFBhdGllbnQuc2V4ID0gJzI0ODE1MzAwNycgdGhlbiAiTWFsZSAoZmluZGluZykiDQogICAgd2hlbiBQYXRpZW50LnNleCA9ICcyNDgxNTIwMDInIHRoZW4gIkZlbWFsZSAoZmluZGluZykiDQogICAgZWxzZSBudWxsDQogIGVuZA=="
      }, {
        "contentType": "application/elm+xml",
        "data": "[encoded data, 61716 characters]"
      }, {
        "contentType": "application/elm+json",
        "data": "[encoded data, 121536 characters]"
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Library/SupplementalDataElements"
    }
  }, {
    "fullUrl": "https://madie.cms.gov/Library/Hospice",
    "resource": {
      "resourceType": "Library",
      "id": "Hospice",
      "meta": {
        "profile": [ "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-computablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-executablelibrary", "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-json-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-xml-library" ]
      },
      "language": "en",
      "text": {
        "status": "extensions",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"col-12\">\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n<td class=\"content-container\">Hospice</td>\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n<td class=\"content-container\">6.18.000</td>\n</tr>\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n<td class=\"content-container\">684c52bf0d70b65363c69ee2</td>\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward (Publisher)</th>\n\n\n<td class=\"content-container\">National Committee for Quality Assurance</td>\n</tr>\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n<td class=\"content-container\">This library contains a definition used to exclude patients who are in hospice care for any part of the measurement period.</td>\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/library-type#logic-library]</td>\n</tr>\n\n\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, hospitalization, hospitalization.dischargeDisposition, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Encounter\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: type, period\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: type</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Observation\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, value, effective\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n  \n    <span class=\"tab-one\"><em>Code(s)</em>: \n    \n      \n      http://loinc.org#45755-6: 'Hospice care [Minimum Data Set]'\n      \n    \n    </span>\n    <br/>\n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: ServiceRequest\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, authoredOn, authoredOn.value\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, performed\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Condition\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Condition\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code\n    <br/>\n   \n  \n    <em>Code Filter(s)</em>: \n    <br/>\n  \n  \n    <span class=\"tab-one\"><em>Path</em>: code</span>\n    <br/>\n  \n  \n  \n    <span class=\"tab-one\"><em>ValueSet</em>:</span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165\n    <br/> \n  \n  \n  \n   \n  </td>\n</tr>\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">CQL Content</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">library Hospice version '6.18.000'\n\nusing QICore version '6.0.0'\n\ninclude FHIRHelpers version '4.4.000' called FHIRHelpers\ninclude QICoreCommon version '4.0.000' called QICoreCommon\ninclude Status version '1.15.000' called Status\n\ncodesystem &quot;LOINC&quot;: 'http://loinc.org'\ncodesystem &quot;SNOMEDCT&quot;: 'http://snomed.info/sct'\n\nvalueset &quot;Encounter Inpatient&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'\nvalueset &quot;Hospice Care Ambulatory&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584'\nvalueset &quot;Hospice Encounter&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003'\nvalueset &quot;Hospice Diagnosis&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165'\n\ncode &quot;Discharge to healthcare facility for hospice care (procedure)&quot;: '428371000124100' from &quot;SNOMEDCT&quot; display 'Discharge to healthcare facility for hospice care (procedure)'\ncode &quot;Discharge to home for hospice care (procedure)&quot;: '428361000124107' from &quot;SNOMEDCT&quot; display 'Discharge to home for hospice care (procedure)'\ncode &quot;Hospice care [Minimum Data Set]&quot;: '45755-6' from &quot;LOINC&quot; display 'Hospice care [Minimum Data Set]'\ncode &quot;Yes (qualifier value)&quot;: '373066001' from &quot;SNOMEDCT&quot; display 'Yes (qualifier value)'\n\nparameter &quot;Measurement Period&quot; Interval&lt;DateTime&gt;\n\ncontext Patient\n\ndefine &quot;Has Hospice Services&quot;:\n  exists ((([Encounter: &quot;Encounter Inpatient&quot;]).isEncounterPerformed()) InpatientEncounter\n      where (InpatientEncounter.hospitalization.dischargeDisposition ~ &quot;Discharge to home for hospice care (procedure)&quot;\n          or InpatientEncounter.hospitalization.dischargeDisposition ~ &quot;Discharge to healthcare facility for hospice care (procedure)&quot;\n      )\n        and InpatientEncounter.period ends during day of &quot;Measurement Period&quot;\n  )\n    or exists ((([Encounter: &quot;Hospice Encounter&quot;]).isEncounterPerformed()) HospiceEncounter\n        where HospiceEncounter.period overlaps day of &quot;Measurement Period&quot;\n    )\n    or exists ((([ObservationScreeningAssessment: &quot;Hospice care [Minimum Data Set]&quot;]).isAssessmentPerformed()) HospiceAssessment\n        where HospiceAssessment.value ~ &quot;Yes (qualifier value)&quot;\n          and HospiceAssessment.effective.toInterval() overlaps day of &quot;Measurement Period&quot;\n    )\n    or exists ((([ServiceRequest: &quot;Hospice Care Ambulatory&quot;]).isInterventionOrder()) HospiceOrder\n        where HospiceOrder.authoredOn during day of &quot;Measurement Period&quot;\n    )\n    or exists ((([Procedure: &quot;Hospice Care Ambulatory&quot;]).isInterventionPerformed()) HospicePerformed\n        where HospicePerformed.performed.toInterval() overlaps day of &quot;Measurement Period&quot;\n    )\n    or exists ((([ConditionProblemsHealthConcerns: &quot;Hospice Diagnosis&quot;]\n        union [ConditionEncounterDiagnosis: &quot;Hospice Diagnosis&quot;]).verified()) HospiceCareDiagnosis\n        where HospiceCareDiagnosis.prevalenceInterval() overlaps day of &quot;Measurement Period&quot;\n    )</code></pre>\n      </td>\n    </tr>\n    \n    \n    \n  \n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.4.8 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
      },
      "extension": [ {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://snomed.info/sct",
          "code": "428371000124100",
          "display": "Discharge to healthcare facility for hospice care (procedure)"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://snomed.info/sct",
          "code": "428361000124107",
          "display": "Discharge to home for hospice care (procedure)"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://loinc.org",
          "code": "45755-6",
          "display": "Hospice care [Minimum Data Set]"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://snomed.info/sct",
          "code": "373066001",
          "display": "Yes (qualifier value)"
        }
      } ],
      "url": "https://madie.cms.gov/Library/Hospice",
      "identifier": [ {
        "use": "official",
        "system": "https://madie.cms.gov/login",
        "value": "684c52bf0d70b65363c69ee2"
      } ],
      "version": "6.18.000",
      "name": "Hospice",
      "title": "Hospice",
      "status": "active",
      "experimental": false,
      "type": {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/library-type",
          "code": "logic-library"
        } ]
      },
      "date": "2025-07-25T20:59:19+00:00",
      "publisher": "National Committee for Quality Assurance",
      "description": "This library contains a definition used to exclude patients who are in hospice care for any part of the measurement period.",
      "relatedArtifact": [ {
        "type": "depends-on",
        "display": "QICore model information",
        "resource": "http://hl7.org/fhir/Library/QICore-ModelInfo"
      }, {
        "type": "depends-on",
        "display": "Library Status",
        "resource": "https://madie.cms.gov/Library/Status|1.15.000"
      }, {
        "type": "depends-on",
        "display": "Library FHIRHelpers",
        "resource": "https://madie.cms.gov/Library/FHIRHelpers|4.4.000"
      }, {
        "type": "depends-on",
        "display": "Library QICoreCommon",
        "resource": "https://madie.cms.gov/Library/QICoreCommon|4.0.000"
      }, {
        "type": "depends-on",
        "display": "Code system SNOMEDCT",
        "resource": "http://snomed.info/sct"
      }, {
        "type": "depends-on",
        "display": "Code system LOINC",
        "resource": "http://loinc.org"
      }, {
        "type": "depends-on",
        "display": "Value set Encounter Inpatient",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
      }, {
        "type": "depends-on",
        "display": "Value set Hospice Encounter",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003"
      }, {
        "type": "depends-on",
        "display": "Value set Hospice Care Ambulatory",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584"
      }, {
        "type": "depends-on",
        "display": "Value set Hospice Diagnosis",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165"
      } ],
      "dataRequirement": [ {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "hospitalization", "hospitalization.dischargeDisposition", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
        } ]
      }, {
        "type": "Encounter",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter" ],
        "mustSupport": [ "type", "period" ],
        "codeFilter": [ {
          "path": "type",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003"
        } ]
      }, {
        "type": "Observation",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment" ],
        "mustSupport": [ "code", "value", "effective" ],
        "codeFilter": [ {
          "path": "code",
          "code": [ {
            "system": "http://loinc.org",
            "code": "45755-6",
            "display": "Hospice care [Minimum Data Set]"
          } ]
        } ]
      }, {
        "type": "ServiceRequest",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest" ],
        "mustSupport": [ "code", "authoredOn", "authoredOn.value" ],
        "codeFilter": [ {
          "path": "code",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584"
        } ]
      }, {
        "type": "Procedure",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
        "mustSupport": [ "code", "performed" ],
        "codeFilter": [ {
          "path": "code",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1584"
        } ]
      }, {
        "type": "Condition",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns" ],
        "mustSupport": [ "code" ],
        "codeFilter": [ {
          "path": "code",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165"
        } ]
      }, {
        "type": "Condition",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis" ],
        "mustSupport": [ "code" ],
        "codeFilter": [ {
          "path": "code",
          "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165"
        } ]
      } ],
      "content": [ {
        "contentType": "text/cql",
        "data": "bGlicmFyeSBIb3NwaWNlIHZlcnNpb24gJzYuMTguMDAwJwoKdXNpbmcgUUlDb3JlIHZlcnNpb24gJzYuMC4wJwoKaW5jbHVkZSBGSElSSGVscGVycyB2ZXJzaW9uICc0LjQuMDAwJyBjYWxsZWQgRkhJUkhlbHBlcnMKaW5jbHVkZSBRSUNvcmVDb21tb24gdmVyc2lvbiAnNC4wLjAwMCcgY2FsbGVkIFFJQ29yZUNvbW1vbgppbmNsdWRlIFN0YXR1cyB2ZXJzaW9uICcxLjE1LjAwMCcgY2FsbGVkIFN0YXR1cwoKY29kZXN5c3RlbSAiTE9JTkMiOiAnaHR0cDovL2xvaW5jLm9yZycKY29kZXN5c3RlbSAiU05PTUVEQ1QiOiAnaHR0cDovL3Nub21lZC5pbmZvL3NjdCcKCnZhbHVlc2V0ICJFbmNvdW50ZXIgSW5wYXRpZW50IjogJ2h0dHA6Ly9jdHMubmxtLm5paC5nb3YvZmhpci9WYWx1ZVNldC8yLjE2Ljg0MC4xLjExMzg4My4zLjY2Ni41LjMwNycKdmFsdWVzZXQgIkhvc3BpY2UgQ2FyZSBBbWJ1bGF0b3J5IjogJ2h0dHA6Ly9jdHMubmxtLm5paC5nb3YvZmhpci9WYWx1ZVNldC8yLjE2Ljg0MC4xLjExMzg4My4zLjUyNi4zLjE1ODQnCnZhbHVlc2V0ICJIb3NwaWNlIEVuY291bnRlciI6ICdodHRwOi8vY3RzLm5sbS5uaWguZ292L2ZoaXIvVmFsdWVTZXQvMi4xNi44NDAuMS4xMTM4ODMuMy40NjQuMTAwMy4xMDAzJwp2YWx1ZXNldCAiSG9zcGljZSBEaWFnbm9zaXMiOiAnaHR0cDovL2N0cy5ubG0ubmloLmdvdi9maGlyL1ZhbHVlU2V0LzIuMTYuODQwLjEuMTEzODgzLjMuNDY0LjEwMDMuMTE2NScKCmNvZGUgIkRpc2NoYXJnZSB0byBoZWFsdGhjYXJlIGZhY2lsaXR5IGZvciBob3NwaWNlIGNhcmUgKHByb2NlZHVyZSkiOiAnNDI4MzcxMDAwMTI0MTAwJyBmcm9tICJTTk9NRURDVCIgZGlzcGxheSAnRGlzY2hhcmdlIHRvIGhlYWx0aGNhcmUgZmFjaWxpdHkgZm9yIGhvc3BpY2UgY2FyZSAocHJvY2VkdXJlKScKY29kZSAiRGlzY2hhcmdlIHRvIGhvbWUgZm9yIGhvc3BpY2UgY2FyZSAocHJvY2VkdXJlKSI6ICc0MjgzNjEwMDAxMjQxMDcnIGZyb20gIlNOT01FRENUIiBkaXNwbGF5ICdEaXNjaGFyZ2UgdG8gaG9tZSBmb3IgaG9zcGljZSBjYXJlIChwcm9jZWR1cmUpJwpjb2RlICJIb3NwaWNlIGNhcmUgW01pbmltdW0gRGF0YSBTZXRdIjogJzQ1NzU1LTYnIGZyb20gIkxPSU5DIiBkaXNwbGF5ICdIb3NwaWNlIGNhcmUgW01pbmltdW0gRGF0YSBTZXRdJwpjb2RlICJZZXMgKHF1YWxpZmllciB2YWx1ZSkiOiAnMzczMDY2MDAxJyBmcm9tICJTTk9NRURDVCIgZGlzcGxheSAnWWVzIChxdWFsaWZpZXIgdmFsdWUpJwoKcGFyYW1ldGVyICJNZWFzdXJlbWVudCBQZXJpb2QiIEludGVydmFsPERhdGVUaW1lPgoKY29udGV4dCBQYXRpZW50CgpkZWZpbmUgIkhhcyBIb3NwaWNlIFNlcnZpY2VzIjoKICBleGlzdHMgKCgoW0VuY291bnRlcjogIkVuY291bnRlciBJbnBhdGllbnQiXSkuaXNFbmNvdW50ZXJQZXJmb3JtZWQoKSkgSW5wYXRpZW50RW5jb3VudGVyCiAgICAgIHdoZXJlIChJbnBhdGllbnRFbmNvdW50ZXIuaG9zcGl0YWxpemF0aW9uLmRpc2NoYXJnZURpc3Bvc2l0aW9uIH4gIkRpc2NoYXJnZSB0byBob21lIGZvciBob3NwaWNlIGNhcmUgKHByb2NlZHVyZSkiCiAgICAgICAgICBvciBJbnBhdGllbnRFbmNvdW50ZXIuaG9zcGl0YWxpemF0aW9uLmRpc2NoYXJnZURpc3Bvc2l0aW9uIH4gIkRpc2NoYXJnZSB0byBoZWFsdGhjYXJlIGZhY2lsaXR5IGZvciBob3NwaWNlIGNhcmUgKHByb2NlZHVyZSkiCiAgICAgICkKICAgICAgICBhbmQgSW5wYXRpZW50RW5jb3VudGVyLnBlcmlvZCBlbmRzIGR1cmluZyBkYXkgb2YgIk1lYXN1cmVtZW50IFBlcmlvZCIKICApCiAgICBvciBleGlzdHMgKCgoW0VuY291bnRlcjogIkhvc3BpY2UgRW5jb3VudGVyIl0pLmlzRW5jb3VudGVyUGVyZm9ybWVkKCkpIEhvc3BpY2VFbmNvdW50ZXIKICAgICAgICB3aGVyZSBIb3NwaWNlRW5jb3VudGVyLnBlcmlvZCBvdmVybGFwcyBkYXkgb2YgIk1lYXN1cmVtZW50IFBlcmlvZCIKICAgICkKICAgIG9yIGV4aXN0cyAoKChbT2JzZXJ2YXRpb25TY3JlZW5pbmdBc3Nlc3NtZW50OiAiSG9zcGljZSBjYXJlIFtNaW5pbXVtIERhdGEgU2V0XSJdKS5pc0Fzc2Vzc21lbnRQZXJmb3JtZWQoKSkgSG9zcGljZUFzc2Vzc21lbnQKICAgICAgICB3aGVyZSBIb3NwaWNlQXNzZXNzbWVudC52YWx1ZSB+ICJZZXMgKHF1YWxpZmllciB2YWx1ZSkiCiAgICAgICAgICBhbmQgSG9zcGljZUFzc2Vzc21lbnQuZWZmZWN0aXZlLnRvSW50ZXJ2YWwoKSBvdmVybGFwcyBkYXkgb2YgIk1lYXN1cmVtZW50IFBlcmlvZCIKICAgICkKICAgIG9yIGV4aXN0cyAoKChbU2VydmljZVJlcXVlc3Q6ICJIb3NwaWNlIENhcmUgQW1idWxhdG9yeSJdKS5pc0ludGVydmVudGlvbk9yZGVyKCkpIEhvc3BpY2VPcmRlcgogICAgICAgIHdoZXJlIEhvc3BpY2VPcmRlci5hdXRob3JlZE9uIGR1cmluZyBkYXkgb2YgIk1lYXN1cmVtZW50IFBlcmlvZCIKICAgICkKICAgIG9yIGV4aXN0cyAoKChbUHJvY2VkdXJlOiAiSG9zcGljZSBDYXJlIEFtYnVsYXRvcnkiXSkuaXNJbnRlcnZlbnRpb25QZXJmb3JtZWQoKSkgSG9zcGljZVBlcmZvcm1lZAogICAgICAgIHdoZXJlIEhvc3BpY2VQZXJmb3JtZWQucGVyZm9ybWVkLnRvSW50ZXJ2YWwoKSBvdmVybGFwcyBkYXkgb2YgIk1lYXN1cmVtZW50IFBlcmlvZCIKICAgICkKICAgIG9yIGV4aXN0cyAoKChbQ29uZGl0aW9uUHJvYmxlbXNIZWFsdGhDb25jZXJuczogIkhvc3BpY2UgRGlhZ25vc2lzIl0KICAgICAgICB1bmlvbiBbQ29uZGl0aW9uRW5jb3VudGVyRGlhZ25vc2lzOiAiSG9zcGljZSBEaWFnbm9zaXMiXSkudmVyaWZpZWQoKSkgSG9zcGljZUNhcmVEaWFnbm9zaXMKICAgICAgICB3aGVyZSBIb3NwaWNlQ2FyZURpYWdub3Npcy5wcmV2YWxlbmNlSW50ZXJ2YWwoKSBvdmVybGFwcyBkYXkgb2YgIk1lYXN1cmVtZW50IFBlcmlvZCIKICAgICk="
      }, {
        "contentType": "application/elm+xml",
        "data": "[encoded data, 115132 characters]"
      }, {
        "contentType": "application/elm+json",
        "data": "[encoded data, 232668 characters]"
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Library/Hospice"
    }
  }, {
    "fullUrl": "https://madie.cms.gov/Library/Status",
    "resource": {
      "resourceType": "Library",
      "id": "Status",
      "meta": {
        "profile": [ "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-computablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-executablelibrary", "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-json-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-xml-library" ]
      },
      "language": "en",
      "text": {
        "status": "extensions",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"col-12\">\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n<td class=\"content-container\">Status</td>\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n<td class=\"content-container\">1.15.000</td>\n</tr>\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n<td class=\"content-container\">684c4d910d70b65363c69edf</td>\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward (Publisher)</th>\n\n\n<td class=\"content-container\">National Committee for Quality Assurance</td>\n</tr>\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n<td class=\"content-container\">This library contains functions used to constrain FHIR resource elements for measures authored by NCQA, based on QICore 6.0.0 resources including IG and authoring patterns. The functions may appear similar to some QICoreCommon functions but differ in that they have constraints that are relevant for measures authored by NCQA.</td>\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/library-type#logic-library]</td>\n</tr>\n\n\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">CQL Content</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">library Status version '1.15.000'\n\nusing QICore version '6.0.0'\n\ninclude FHIRHelpers version '4.4.000' called FHIRHelpers\n\ncodesystem &quot;ObservationCategoryCodes&quot;: 'http://terminology.hl7.org/CodeSystem/observation-category'\ncodesystem &quot;ConditionVerificationStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/condition-ver-status'\n\ncode &quot;exam&quot;: 'exam' from &quot;ObservationCategoryCodes&quot; display 'exam'\ncode &quot;imaging&quot;: 'imaging' from &quot;ObservationCategoryCodes&quot; display 'imaging'\ncode &quot;confirmed&quot;: 'confirmed' from ConditionVerificationStatusCodes display 'confirmed'\ncode &quot;unconfirmed&quot;: 'unconfirmed' from ConditionVerificationStatusCodes display 'unconfirmed'\ncode &quot;provisional&quot;: 'provisional' from ConditionVerificationStatusCodes display 'provisional'\ncode &quot;differential&quot;: 'differential' from ConditionVerificationStatusCodes display 'differential'\n\ncontext Patient\n\n//This library contains functions used to constrain FHIR resource elements for measures authored by NCQA, based on QICore 6.0.0 resources including IG and authoring patterns. The functions may appear similar to some QICoreCommon functions but differ in that they have constraints that are relevant for measures authored by NCQA.\n\n//Condition\n//Returns conditions in the given list that either have no verification status or have a verification status of confirmed, unconfirmed, provisional, or differential\ndefine fluent function verified(conditions List&lt;Choice&lt;ConditionProblemsHealthConcerns, ConditionEncounterDiagnosis&gt;&gt;):\n  conditions C\n    where C.verificationStatus is not null implies\n      (C.verificationStatus ~ &quot;confirmed&quot;\n        or C.verificationStatus ~ &quot;unconfirmed&quot;\n        or C.verificationStatus ~ &quot;provisional&quot;\n        or C.verificationStatus ~ &quot;differential&quot;\n      )\n\n//Assessment, Performed\ndefine fluent function isAssessmentPerformed(Obs List&lt;ObservationScreeningAssessment&gt;):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' }\n\n//Device, Order - Personal Use Devices\ndefine fluent function isDeviceOrderPersonalUseDevices(DeviceRequest List&lt;DeviceRequest&gt;):\n  DeviceRequest D\n    where D.status in { 'active', 'completed' }\n      and D.intent in {'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order'}\n\n//Diagnostic Study, Order\ndefine fluent function isDiagnosticStudyOrder(ServiceRequest List&lt;ServiceRequest&gt;):\n  ServiceRequest S\n    where S.status in { 'active', 'completed' }\n      and S.intent in {'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order'}\n      \n//Intervention, Order\ndefine fluent function isInterventionOrder(ServiceRequest List&lt;ServiceRequest&gt;):\n  ServiceRequest S\n    where S.status in { 'active', 'completed' }\n      and S.intent in {'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order'}    \n\n//Laboratory Test, Order\ndefine fluent function isLaboratoryTestOrder(ServiceRequest List&lt;ServiceRequest&gt;):\n  ServiceRequest S\n    where S.status in { 'active', 'completed' }\n      and S.intent in {'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order'}       \n\n//Diagnostic Study, Performed\ndefine fluent function isDiagnosticStudyPerformed(Obs List&lt;ObservationClinicalResult&gt;):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' }\n        and exists ( O.category ObservationCategory\n        where ( ObservationCategory ) ~ &quot;imaging&quot;\n    )\n    \n//Encounter, Performed\n//General usage unless required otherwise by measure intent (e.g., follow-up encounters)\ndefine fluent function isEncounterPerformed(Enc List&lt;Encounter&gt;):\n  Enc E\n    where E.status = 'finished'\n\n//Immunization, Administered\ndefine fluent function isImmunizationAdministered(Immunization List&lt;Immunization&gt;):\n  Immunization I\n    where I.status ~ 'completed'\n\n//Intervention, Performed\ndefine fluent function isInterventionPerformed(Proc List&lt;Procedure&gt;):\n  Proc P\n    where P.status ~ 'completed'\n\n//Procedure, Performed\ndefine fluent function isProcedurePerformed(Proc List&lt;Procedure&gt;):\n  Proc P\n    where P.status ~ 'completed'\n\n//Laboratory Test, Performed\ndefine fluent function isLaboratoryTestPerformed(Obs List&lt;LaboratoryResultObservation&gt;):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' }\n\n//Medication, Active\ndefine fluent function isMedicationActive(MedicationRequest List&lt;MedicationRequest&gt;):\n  MedicationRequest M\n    where M.status = 'active'\n      and M.intent in {'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order'}\n\n//Medication, Dispensed\ndefine fluent function isMedicationDispensed(Med List&lt;MedicationDispense&gt;):\n  Med M\n    where M.status in { 'completed', 'in-progress', 'on-hold' }\n\n//Medication, Order\ndefine fluent function isMedicationOrder(MedicationRequest List&lt;MedicationRequest&gt;):\n  MedicationRequest M\n    where M.status in { 'active', 'completed' }\n    and M.intent in {'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order'}\n\n//Physical Exam, Performed\ndefine fluent function isPhysicalExamPerformed(Obs List&lt;ObservationClinicalResult&gt;):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' }\n      and exists ( O.category ObservationCategory\n          where ( ObservationCategory ) ~ &quot;exam&quot;\n      )\n\n//Observation Vital Signs\ndefine fluent function isObservationBP(Obs List&lt;USCoreBloodPressureProfile&gt;):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' }\n      \ndefine fluent function isObservationBodyHeight(Obs List&lt;USCoreBodyHeightProfile&gt;):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' }\n      \ndefine fluent function isObservationBodyWeight(Obs List&lt;USCoreBodyWeightProfile&gt;):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' }\n      \ndefine fluent function isObservationBMI(Obs List&lt;USCoreBMIProfile&gt;):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' }\n \n//Observation Pediatric BMI\ndefine fluent function isObservationPediatricBMI(Obs List&lt;USCorePediatricBMIforAgeObservationProfile&gt;):\n  Obs O\n    where O.status in { 'final', 'amended', 'corrected' } \n   \n//Observation Smoking Status\ndefine fluent function isObservationSmokingStatus(Obs List&lt;USCoreSmokingStatusProfile&gt;):\n  Obs O\n    where O.status = 'final' \n\n//Symptom\ndefine fluent function isSymptom(Obs List&lt;SimpleObservation&gt;):\n  Obs O\n    where O.status in { 'preliminary', 'final', 'amended', 'corrected' }</code></pre>\n      </td>\n    </tr>\n    \n    \n    \n  \n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.4.8 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
      },
      "extension": [ {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "exam",
          "display": "exam"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "imaging",
          "display": "imaging"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
          "code": "confirmed",
          "display": "confirmed"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
          "code": "unconfirmed",
          "display": "unconfirmed"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
          "code": "provisional",
          "display": "provisional"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
          "code": "differential",
          "display": "differential"
        }
      } ],
      "url": "https://madie.cms.gov/Library/Status",
      "identifier": [ {
        "use": "official",
        "system": "https://madie.cms.gov/login",
        "value": "684c4d910d70b65363c69edf"
      } ],
      "version": "1.15.000",
      "name": "Status",
      "title": "Status",
      "status": "active",
      "experimental": false,
      "type": {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/library-type",
          "code": "logic-library"
        } ]
      },
      "date": "2025-07-25T20:59:20+00:00",
      "publisher": "National Committee for Quality Assurance",
      "description": "This library contains functions used to constrain FHIR resource elements for measures authored by NCQA, based on QICore 6.0.0 resources including IG and authoring patterns. The functions may appear similar to some QICoreCommon functions but differ in that they have constraints that are relevant for measures authored by NCQA.",
      "relatedArtifact": [ {
        "type": "depends-on",
        "display": "QICore model information",
        "resource": "http://hl7.org/fhir/Library/QICore-ModelInfo"
      }, {
        "type": "depends-on",
        "display": "Library FHIRHelpers",
        "resource": "https://madie.cms.gov/Library/FHIRHelpers|4.4.000"
      }, {
        "type": "depends-on",
        "display": "Code system ObservationCategoryCodes",
        "resource": "http://terminology.hl7.org/CodeSystem/observation-category"
      }, {
        "type": "depends-on",
        "display": "Code system ConditionVerificationStatusCodes",
        "resource": "http://terminology.hl7.org/CodeSystem/condition-ver-status"
      } ],
      "content": [ {
        "contentType": "text/cql",
        "data": "[encoded data, 8456 characters]"
      }, {
        "contentType": "application/elm+xml",
        "data": "[encoded data, 208832 characters]"
      }, {
        "contentType": "application/elm+json",
        "data": "[encoded data, 391068 characters]"
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Library/Status"
    }
  }, {
    "fullUrl": "https://madie.cms.gov/Library/QICoreCommon",
    "resource": {
      "resourceType": "Library",
      "id": "QICoreCommon",
      "meta": {
        "profile": [ "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-computablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-executablelibrary", "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-json-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-xml-library" ]
      },
      "language": "en",
      "text": {
        "status": "extensions",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"col-12\">\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n<td class=\"content-container\">QICoreCommon</td>\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n<td class=\"content-container\">4.0.000</td>\n</tr>\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n<td class=\"content-container\">67cb33c19e9ab93ec36dad45</td>\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward (Publisher)</th>\n\n\n<td class=\"content-container\">ICF</td>\n</tr>\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n<td class=\"content-container\">Common terminologies and functions used in QI-Core-based CQL artifacts</td>\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/library-type#logic-library]</td>\n</tr>\n\n\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Resource\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/StructureDefinition/Resource\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: id, id.value\n    <br/>\n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: Patient\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: birthDate, birthDate.value\n    <br/>\n   \n   \n  </td>\n</tr>\n\n<tr>\n  <th scope=\"row\" class=\"row-header\">Data Requirement</th>\n  <td class=\"content-container\">\n    <em>Type</em>: DeviceRequest\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-devicerequest\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: modifierExtension\n    <br/>\n   \n   \n  </td>\n</tr>\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">CQL Content</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">library QICoreCommon version '4.0.000'\n\nusing QICore version '6.0.0'\n\ninclude FHIRHelpers version '4.4.000' called FHIRHelpers\n\ncodesystem &quot;LOINC&quot;: 'http://loinc.org'\ncodesystem &quot;SNOMEDCT&quot;: 'http://snomed.info/sct'\ncodesystem &quot;ActCode&quot;: 'http://terminology.hl7.org/CodeSystem/v3-ActCode'\ncodesystem &quot;RoleCode&quot;: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode'\ncodesystem &quot;Diagnosis Role&quot;: 'http://terminology.hl7.org/CodeSystem/diagnosis-role'\ncodesystem &quot;RequestIntent&quot;: 'http://hl7.org/fhir/request-intent'\ncodesystem &quot;MedicationRequestCategory&quot;: 'http://terminology.hl7.org/CodeSystem/medicationrequest-category'\ncodesystem &quot;ConditionClinicalStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/condition-clinical'\ncodesystem &quot;ConditionVerificationStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/condition-ver-status'\ncodesystem &quot;AllergyIntoleranceClinicalStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical'\ncodesystem &quot;AllergyIntoleranceVerificationStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification'\ncodesystem &quot;ObservationCategoryCodes&quot;: 'http://terminology.hl7.org/CodeSystem/observation-category'\ncodesystem &quot;USCoreObservationCategoryExtensionCodes&quot;: 'http://hl7.org/fhir/us/core/CodeSystem/us-core-observation-category'  \ncodesystem &quot;ConditionCategory&quot;: 'http://terminology.hl7.org/CodeSystem/condition-category'\ncodesystem &quot;USCoreConditionCategoryExtensionCodes&quot;: 'http://hl7.org/fhir/us/core/CodeSystem/condition-category'\ncodesystem &quot;TaskCodeSystem&quot;: 'http://hl7.org/fhir/CodeSystem/task-code' \n\n\n\ncode &quot;Birthdate&quot;: '21112-8' from &quot;LOINC&quot; display 'Birth date'\ncode &quot;Dead&quot;: '419099009' from &quot;SNOMEDCT&quot; display 'Dead'\ncode &quot;ER&quot;: 'ER' from &quot;RoleCode&quot; display 'Emergency room'\ncode &quot;ICU&quot;: 'ICU' from &quot;RoleCode&quot; display 'Intensive care unit'\ncode &quot;Billing&quot;: 'billing' from &quot;Diagnosis Role&quot; display 'Billing'\n\n//Task codes\ncode &quot;Fulfill&quot;: 'fulfill' from &quot;TaskCodeSystem&quot; display 'Fulfill'\n\n// Encounter Class Codes\ncode &quot;ambulatory&quot;: 'AMB' from ActCode display 'ambulatory'\ncode &quot;emergency&quot;: 'EMER' from ActCode display 'emergency'\ncode &quot;field&quot;: 'FLD' from ActCode display 'field'\ncode &quot;home health&quot;: 'HH' from ActCode display 'home health'\ncode &quot;inpatient encounter&quot;: 'IMP' from ActCode display 'inpatient encounter'\ncode &quot;inpatient acute&quot;: 'ACUTE' from ActCode display 'inpatient acute'\ncode &quot;inpatient non-acute&quot;: 'NONAC' from ActCode display 'inpatient non-acute'\ncode &quot;observation encounter&quot;: 'OBSENC' from ActCode display 'observation encounter'\ncode &quot;pre-admission&quot;: 'PRENC' from ActCode display 'pre-admission'\ncode &quot;short stay&quot;: 'SS' from ActCode display 'short stay'\ncode &quot;virtual&quot;: 'VR' from ActCode display 'Virtual'\n\n// Condition Category Codes\ncode &quot;problem-list-item&quot;: 'problem-list-item' from &quot;ConditionCategory&quot; display 'Problem List Item'\ncode &quot;encounter-diagnosis&quot;: 'encounter-diagnosis' from &quot;ConditionCategory&quot; display 'Encounter Diagnosis'\ncode &quot;health-concern&quot;: 'health-concern' from &quot;USCoreConditionCategoryExtensionCodes&quot; display 'Health Concern'\n\n// Condition Clinical Status Codes - Consider value sets for these\ncode &quot;active&quot;: 'active' from &quot;ConditionClinicalStatusCodes&quot; display 'Active'\ncode &quot;recurrence&quot;: 'recurrence' from &quot;ConditionClinicalStatusCodes&quot; display 'Recurrence'\ncode &quot;relapse&quot;: 'relapse' from &quot;ConditionClinicalStatusCodes&quot; display 'Relapse'\ncode &quot;inactive&quot;: 'inactive' from &quot;ConditionClinicalStatusCodes&quot; display 'Inactive'\ncode &quot;remission&quot;: 'remission' from &quot;ConditionClinicalStatusCodes&quot; display 'Remission'\ncode &quot;resolved&quot;: 'resolved' from &quot;ConditionClinicalStatusCodes&quot; display 'Resolved'\n\n// Condition Verification Status Codes - Consider value sets for these\ncode &quot;unconfirmed&quot;: 'unconfirmed' from ConditionVerificationStatusCodes display 'Unconfirmed'\ncode &quot;provisional&quot;: 'provisional' from ConditionVerificationStatusCodes display 'Provisional'\ncode &quot;differential&quot;: 'differential' from ConditionVerificationStatusCodes display 'Differential'\ncode &quot;confirmed&quot;: 'confirmed' from ConditionVerificationStatusCodes display 'Confirmed'\ncode &quot;refuted&quot;: 'refuted' from ConditionVerificationStatusCodes display 'Refuted'\ncode &quot;entered-in-error&quot;: 'entered-in-error' from ConditionVerificationStatusCodes display 'Entered in Error'\n\ncode &quot;allergy-active&quot;: 'active' from &quot;AllergyIntoleranceClinicalStatusCodes&quot; display 'Active'\ncode &quot;allergy-inactive&quot;: 'inactive' from &quot;AllergyIntoleranceClinicalStatusCodes&quot; display 'Inactive'\ncode &quot;allergy-resolved&quot;: 'resolved' from &quot;AllergyIntoleranceClinicalStatusCodes&quot; display 'Resolved'\n\n// Allergy/Intolerance Verification Status Codes - Consider value sets for these\ncode &quot;allergy-unconfirmed&quot;: 'unconfirmed' from AllergyIntoleranceVerificationStatusCodes display 'Unconfirmed'\ncode &quot;allergy-confirmed&quot;: 'confirmed' from AllergyIntoleranceVerificationStatusCodes display 'Confirmed'\ncode &quot;allergy-refuted&quot;: 'refuted' from AllergyIntoleranceVerificationStatusCodes display 'Refuted'\n\n// MedicationRequest Category Codes\ncode &quot;Inpatient&quot;: 'inpatient' from &quot;MedicationRequestCategory&quot; display 'Inpatient'\ncode &quot;Outpatient&quot;: 'outpatient' from &quot;MedicationRequestCategory&quot; display 'Outpatient'\ncode &quot;Community&quot;: 'community' from &quot;MedicationRequestCategory&quot; display 'Community'\ncode &quot;Discharge&quot;: 'discharge' from &quot;MedicationRequestCategory&quot; display 'Discharge'\n\n// Diagnosis Role Codes\ncode &quot;AD&quot;: 'AD' from &quot;Diagnosis Role&quot; display 'Admission diagnosis'\ncode &quot;DD&quot;: 'DD' from &quot;Diagnosis Role&quot; display 'Discharge diagnosis'\ncode &quot;CC&quot;: 'CC' from &quot;Diagnosis Role&quot; display 'Chief complaint'\ncode &quot;CM&quot;: 'CM' from &quot;Diagnosis Role&quot; display 'Comorbidity diagnosis'\ncode &quot;pre-op&quot;: 'pre-op' from &quot;Diagnosis Role&quot; display 'pre-op diagnosis'\ncode &quot;post-op&quot;: 'post-op' from &quot;Diagnosis Role&quot; display 'post-op diagnosis'\ncode &quot;billing&quot;: 'billing' from &quot;Diagnosis Role&quot; display 'Billing'\n\n// Observation Category Codes\ncode &quot;social-history&quot;: 'social-history' from &quot;ObservationCategoryCodes&quot; display 'Social History'\ncode &quot;vital-signs&quot;: 'vital-signs' from &quot;ObservationCategoryCodes&quot; display 'Vital Signs'\ncode &quot;imaging&quot;: 'imaging' from &quot;ObservationCategoryCodes&quot; display 'Imaging'\ncode &quot;laboratory&quot;: 'laboratory' from &quot;ObservationCategoryCodes&quot; display 'Laboratory'\ncode &quot;procedure&quot;: 'procedure' from &quot;ObservationCategoryCodes&quot; display 'Procedure'\ncode &quot;survey&quot;: 'survey' from &quot;ObservationCategoryCodes&quot; display 'Survey'\ncode &quot;exam&quot;: 'exam' from &quot;ObservationCategoryCodes&quot; display 'Exam'\ncode &quot;therapy&quot;: 'therapy' from &quot;ObservationCategoryCodes&quot; display 'Therapy'\ncode &quot;activity&quot;: 'activity' from &quot;ObservationCategoryCodes&quot; display 'Activity'\n\ncontext Patient\n\n/* Candidates for FHIRCommon */\n\n/*\n@description: Returns true if the given condition has a clinical status of active, recurrence, or relapse\n*/\ndefine fluent function isActive(condition Choice&lt;&quot;ConditionEncounterDiagnosis&quot;, &quot;ConditionProblemsHealthConcerns&quot;&gt;):\n  condition.clinicalStatus ~ &quot;active&quot;\n    or condition.clinicalStatus ~ &quot;recurrence&quot;\n    or condition.clinicalStatus ~ &quot;relapse&quot;\n\n/*\n@description: Returns true if the given condition has the given category\n*/\ndefine fluent function hasCategory(condition Choice&lt;&quot;ConditionEncounterDiagnosis&quot;, &quot;ConditionProblemsHealthConcerns&quot;&gt;, category Code):\n  exists (condition.category C\n    where C ~ category\n  )\n\n/*\n@description: Returns true if the given condition is a problem list item.\n*/\ndefine fluent function isProblemListItem(condition Choice&lt;&quot;ConditionEncounterDiagnosis&quot;, &quot;ConditionProblemsHealthConcerns&quot;&gt;):\n  exists (condition.category C\n    where C ~ &quot;problem-list-item&quot;\n  )\n\n/*\n@description: Returns true if the given condition is an encounter diagnosis\n*/\ndefine fluent function isEncounterDiagnosis(condition Choice&lt;&quot;ConditionEncounterDiagnosis&quot;, &quot;ConditionProblemsHealthConcerns&quot;&gt;):\n  exists (condition.category C\n    where C ~ &quot;encounter-diagnosis&quot;\n  )\n\n/*\n@description: Returns true if the given condition is a health concern\n*/\ndefine fluent function isHealthConcern(condition Choice&lt;&quot;ConditionEncounterDiagnosis&quot;, &quot;ConditionProblemsHealthConcerns&quot;&gt;):\n  exists (condition.category C\n    where C ~ &quot;health-concern&quot;\n  )\n\n/*\n@description: Returns true if the given observation has the given category\n*/\ndefine fluent function hasCategory(observation Choice&lt;&quot;SimpleObservation&quot;, \n&quot;ObservationCancelled&quot;,\n&quot;NonPatientObservation&quot;,\n&quot;LaboratoryResultObservation&quot;,\n&quot;ObservationClinicalResult&quot;,\n&quot;ObservationScreeningAssessment&quot;&gt;, \ncategory Code):\n  exists (observation.category C\n    where C ~ category\n  )\n\n/*\n@description: Returns true if the given observation is a social history observation\n*/\ndefine fluent function isSocialHistory(observation Choice&lt;&quot;SimpleObservation&quot;, \n&quot;ObservationCancelled&quot;,\n&quot;NonPatientObservation&quot;,\n&quot;LaboratoryResultObservation&quot;,\n&quot;ObservationClinicalResult&quot;,\n&quot;ObservationScreeningAssessment&quot;&gt;):\n  exists (observation.category C\n    where C ~ &quot;social-history&quot;\n  )\n\n/*\n@description: Returns true if the given observation is a vital sign\n*/\ndefine fluent function isVitalSign(observation Choice&lt;&quot;SimpleObservation&quot;, \n&quot;ObservationCancelled&quot;,\n&quot;NonPatientObservation&quot;,\n&quot;LaboratoryResultObservation&quot;,\n&quot;ObservationClinicalResult&quot;,\n&quot;ObservationScreeningAssessment&quot;&gt;):\n  exists (observation.category C\n    where C ~ &quot;vital-signs&quot;\n  )\n\n/*\n@description: Returns true if the given observation is an imaging observation\n*/\ndefine fluent function isImaging(observation Choice&lt;&quot;SimpleObservation&quot;, \n&quot;ObservationCancelled&quot;,\n&quot;NonPatientObservation&quot;,\n&quot;LaboratoryResultObservation&quot;,\n&quot;ObservationClinicalResult&quot;,\n&quot;ObservationScreeningAssessment&quot;&gt;):\n  exists (observation.category C\n    where C ~ &quot;imaging&quot;\n  )\n\n/*\n@description: Returns true if the given observation is a laboratory observation\n*/\ndefine fluent function isLaboratory(observation Choice&lt;&quot;SimpleObservation&quot;, \n&quot;ObservationCancelled&quot;,\n&quot;NonPatientObservation&quot;,\n&quot;LaboratoryResultObservation&quot;,\n&quot;ObservationClinicalResult&quot;,\n&quot;ObservationScreeningAssessment&quot;&gt;):\n  exists (observation.category C\n    where C ~ &quot;laboratory&quot;\n  )\n\n/*\n@description: Returns true if the given observation is a procedure observation\n*/\ndefine fluent function isProcedure(observation Choice&lt;&quot;SimpleObservation&quot;, \n&quot;ObservationCancelled&quot;,\n&quot;NonPatientObservation&quot;,\n&quot;LaboratoryResultObservation&quot;,\n&quot;ObservationClinicalResult&quot;,\n&quot;ObservationScreeningAssessment&quot;&gt;):\n  exists (observation.category C\n    where C ~ &quot;procedure&quot;\n  )\n\n/*\n@description: Returns true if the given observation is a survey observation\n*/\ndefine fluent function isSurvey(observation Choice&lt;&quot;SimpleObservation&quot;, \n&quot;ObservationCancelled&quot;,\n&quot;NonPatientObservation&quot;,\n&quot;LaboratoryResultObservation&quot;,\n&quot;ObservationClinicalResult&quot;,\n&quot;ObservationScreeningAssessment&quot;&gt;):\n  exists (observation.category C\n    where C ~ &quot;survey&quot;\n  )\n\n/*\n@description: Returns true if the given observation is an exam observation\n*/\ndefine fluent function isExam(observation Choice&lt;&quot;SimpleObservation&quot;, \n&quot;ObservationCancelled&quot;,\n&quot;NonPatientObservation&quot;,\n&quot;LaboratoryResultObservation&quot;,\n&quot;ObservationClinicalResult&quot;,\n&quot;ObservationScreeningAssessment&quot;&gt;):\n  exists (observation.category C\n    where C ~ &quot;exam&quot;\n  )\n\n/*\n@description: Returns true if the given observation is a therapy observation\n*/\ndefine fluent function isTherapy(observation Choice&lt;&quot;SimpleObservation&quot;, \n&quot;ObservationCancelled&quot;,\n&quot;NonPatientObservation&quot;,\n&quot;LaboratoryResultObservation&quot;,\n&quot;ObservationClinicalResult&quot;,\n&quot;ObservationScreeningAssessment&quot;&gt;):\n  exists (observation.category C\n    where C ~ &quot;therapy&quot;\n  )\n\n/*\n@description: Returns true if the given observation is an activity observation\n*/\ndefine fluent function isActivity(observation Choice&lt;&quot;SimpleObservation&quot;, \n&quot;ObservationCancelled&quot;,\n&quot;NonPatientObservation&quot;,\n&quot;LaboratoryResultObservation&quot;,\n&quot;ObservationClinicalResult&quot;,\n&quot;ObservationScreeningAssessment&quot;&gt;):\n  exists (observation.category C\n    where C ~ &quot;activity&quot;\n  )\n\n/*\n@description: Returns true if the given MedicationRequest has a category of Community\n*/\ndefine fluent function isCommunity(medicationRequest Choice&lt;MedicationRequest, MedicationNotRequested&gt;):\n  exists (medicationRequest.category C\n    where C ~ Community\n  )\n\n/*\n@description: Returns true if the given MedicationRequest has a category of Discharge\n*/\ndefine fluent function isDischarge(medicationRequest Choice&lt;MedicationRequest, MedicationNotRequested&gt;):\n  exists (medicationRequest.category C\n    where C ~ Discharge\n  )\n\n/*\n@description: Returns true if the given DeviceRequest is a negation (i.e. do not perform this order)\n@deprecated: This function is no longer required in QICore 6.0.0 and above\n*/\ndefine fluent function doNotPerform(deviceRequest DeviceRequest):\n  // KNOWN ISSUE: The translator reports this as an error but the execution still works, this is under investigation\n  deviceRequest.doNotPerform\n\n/*\n@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval\n@comment: Normalizes a choice type of DateTime, Quanitty, Interval&lt;DateTime&gt;, or Interval&lt;Quantity&gt; types\nto an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible\nrepresentations for timing-valued elements in QICore, allowing this function to be used across any resource.\nThe input can be provided as a DateTime, Quantity, Interval&lt;DateTime&gt; or Interval&lt;Quantity&gt;.\nThe intent of this function is to provide a clear and concise mechanism to treat single\nelements that have multiple possible representations as intervals so that logic doesn't have to account\nfor the variability. More complex calculations (such as medication request period or dispense period\ncalculation) need specific guidance and consideration. That guidance may make use of this function, but\nthe focus of this function is on single element calculations where the semantics are unambiguous.\nIf the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.\nIf the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,\nand the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.\nIf the input is a DateTime Interval, the result is the input.\nIf the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result\nis a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending\nimmediately before one year later than the date the patient turned the age given as the end of the quantity interval.\nIf the input is a Timing, an error will be thrown indicating that Timing calculations are not implemented. Any other input will reslt in a null DateTime Interval\n@deprecated: This function is deprecated. Use the fluent function `toInterval()` instead\n*/\ndefine function ToInterval(choice Choice&lt;DateTime, Quantity, Interval&lt;DateTime&gt;, Interval&lt;Quantity&gt;, Timing&gt;):\n  case\n\t  when choice is DateTime then\n    \tInterval[choice as DateTime, choice as DateTime]\n\t\twhen choice is Interval&lt;DateTime&gt; then\n  \t\tchoice as Interval&lt;DateTime&gt;\n\t\twhen choice is Quantity then\n\t\t  Interval[Patient.birthDate + (choice as Quantity),\n\t\t\t  Patient.birthDate + (choice as Quantity) + 1 year)\n\t\twhen choice is Interval&lt;Quantity&gt; then\n\t\t  Interval[Patient.birthDate + (choice.low as Quantity),\n\t\t\t  Patient.birthDate + (choice.high as Quantity) + 1 year)\n\t\twhen choice is Timing then\n      Message(null, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported') as Interval&lt;DateTime&gt;\n\t\telse\n\t\t\tnull as Interval&lt;DateTime&gt;\n\tend\n\n/*\n@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval\n@comment: Normalizes a choice type of DateTime, Quanitty, Interval&lt;DateTime&gt;, or Interval&lt;Quantity&gt; types\nto an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible\nrepresentations for timing-valued elements in QICore, allowing this function to be used across any resource.\nThe input can be provided as a DateTime, Quantity, Interval&lt;DateTime&gt; or Interval&lt;Quantity&gt;.\nThe intent of this function is to provide a clear and concise mechanism to treat single\nelements that have multiple possible representations as intervals so that logic doesn't have to account\nfor the variability. More complex calculations (such as medication request period or dispense period\ncalculation) need specific guidance and consideration. That guidance may make use of this function, but\nthe focus of this function is on single element calculations where the semantics are unambiguous.\nIf the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.\nIf the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,\nand the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.\nIf the input is a DateTime Interval, the result is the input.\nIf the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result\nis a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending\nimmediately before one year later than the date the patient turned the age given as the end of the quantity interval.\nIf the input is a Timing, an error will be thrown indicating that Timing calculations are not implemented. Any other input will reslt in a null DateTime Interval\n*/\ndefine fluent function toInterval(choice Choice&lt;DateTime, Quantity, Interval&lt;DateTime&gt;, Interval&lt;Quantity&gt;, Timing&gt;):\n  case\n\t  when choice is DateTime then\n    \tInterval[choice as DateTime, choice as DateTime]\n\t\twhen choice is Interval&lt;DateTime&gt; then\n  \t\tchoice as Interval&lt;DateTime&gt;\n\t\twhen choice is Quantity then\n\t\t  Interval[Patient.birthDate + (choice as Quantity),\n\t\t\t  Patient.birthDate + (choice as Quantity) + 1 year)\n\t\twhen choice is Interval&lt;Quantity&gt; then\n\t\t  Interval[Patient.birthDate + (choice.low as Quantity),\n\t\t\t  Patient.birthDate + (choice.high as Quantity) + 1 year)\n\t\twhen choice is Timing then\n      Message(null, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported') as Interval&lt;DateTime&gt;\n\t\telse\n\t\t\tnull as Interval&lt;DateTime&gt;\n\tend\n\n/*\n@description: Returns an interval representing the normalized abatement of a given Condition.\n@comment: If the abatement element of the Condition is represented as a DateTime, the result\nis an interval beginning and ending on that DateTime.\nIf the abatement is represented as a Quantity, the quantity is expected to be a calendar-duration and is interpreted as the age of the patient. The\nresult is an interval from the date the patient turned that age to immediately before one year later.\nIf the abatement is represented as a Quantity Interval, the quantities are expected to be calendar-durations and are interpreted as an age range during\nwhich the abatement occurred. The result is an interval from the date the patient turned the starting age of the quantity interval, and ending immediately\nbefore one year later than the date the patient turned the ending age of the quantity interval.\n@deprecated: This function is deprecated. Use the fluent function `abatementInterval()` instead.\n*/\ndefine function ToAbatementInterval(condition Choice&lt;&quot;ConditionEncounterDiagnosis&quot;, &quot;ConditionProblemsHealthConcerns&quot;&gt;):\n\tif condition.abatement is DateTime then\n\t  Interval[condition.abatement as DateTime, condition.abatement as DateTime]\n\telse if condition.abatement is Quantity then\n\t\tInterval[Patient.birthDate + (condition.abatement as Quantity),\n\t\t\tPatient.birthDate + (condition.abatement as Quantity) + 1 year)\n\telse if condition.abatement is Interval&lt;Quantity&gt; then\n\t  Interval[Patient.birthDate + (condition.abatement.low as Quantity),\n\t\t  Patient.birthDate + (condition.abatement.high as Quantity) + 1 year)\n\telse if condition.abatement is Interval&lt;DateTime&gt; then\n\t  Interval[condition.abatement.low, condition.abatement.high)\n\telse null as Interval&lt;DateTime&gt;\n\n/*\n@description: Returns an interval representing the normalized abatement of a given Condition.\n@comment: If the abatement element of the Condition is represented as a DateTime, the result\nis an interval beginning and ending on that DateTime.\nIf the abatement is represented as a Quantity, the quantity is expected to be a calendar-duration and is interpreted as the age of the patient. The\nresult is an interval from the date the patient turned that age to immediately before one year later.\nIf the abatement is represented as a Quantity Interval, the quantities are expected to be calendar-durations and are interpreted as an age range during\nwhich the abatement occurred. The result is an interval from the date the patient turned the starting age of the quantity interval, and ending immediately\nbefore one year later than the date the patient turned the ending age of the quantity interval.\n*/\ndefine fluent function abatementInterval(condition Choice&lt;&quot;ConditionEncounterDiagnosis&quot;, &quot;ConditionProblemsHealthConcerns&quot;&gt;):\n\tif condition.abatement is DateTime then\n\t  Interval[condition.abatement as DateTime, condition.abatement as DateTime]\n\telse if condition.abatement is Quantity then\n\t\tInterval[Patient.birthDate + (condition.abatement as Quantity),\n\t\t\tPatient.birthDate + (condition.abatement as Quantity) + 1 year)\n\telse if condition.abatement is Interval&lt;Quantity&gt; then\n\t  Interval[Patient.birthDate + (condition.abatement.low as Quantity),\n\t\t  Patient.birthDate + (condition.abatement.high as Quantity) + 1 year)\n\telse if condition.abatement is Interval&lt;DateTime&gt; then\n\t  Interval[condition.abatement.low, condition.abatement.high)\n\telse null as Interval&lt;DateTime&gt;\n\n/*\n@description: Returns an interval representing the normalized prevalence period of a given Condition.\n@comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from\nonset to abatement as specified in the given Condition. If the condition is active, or has an abatement date the resulting \ninterval will have a closed ending boundary. Otherwise, the resulting interval will have an open ending boundary.\n@deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead\n*/\ndefine function ToPrevalenceInterval(condition Choice&lt;&quot;ConditionEncounterDiagnosis&quot;, &quot;ConditionProblemsHealthConcerns&quot;&gt;):\nif condition.clinicalStatus ~ &quot;active&quot;\n  or condition.clinicalStatus ~ &quot;recurrence&quot;\n  or condition.clinicalStatus ~ &quot;relapse&quot; then\n  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]\nelse\n   (end of ToAbatementInterval(condition)) abatementDate\n    return if abatementDate is null then\n      Interval[start of ToInterval(condition.onset), abatementDate)\n    else\n      Interval[start of ToInterval(condition.onset), abatementDate]\n\n/*\n@description: Returns an interval representing the normalized prevalence period of a given Condition.\n@comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from\nonset to abatement as specified in the given Condition. If the condition is active, or has an abatement date the resulting \ninterval will have a closed ending boundary. Otherwise, the resulting interval will have an open ending boundary.\n*/\ndefine fluent function prevalenceInterval(condition Choice&lt;&quot;ConditionEncounterDiagnosis&quot;, &quot;ConditionProblemsHealthConcerns&quot;&gt;):\nif condition.clinicalStatus ~ &quot;active&quot;\n  or condition.clinicalStatus ~ &quot;recurrence&quot;\n  or condition.clinicalStatus ~ &quot;relapse&quot; then\n  Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]\nelse\n    (end of condition.abatementInterval()) abatementDate\n    return if abatementDate is null then\n      Interval[start of condition.onset.toInterval(), abatementDate)\n    else\n      Interval[start of condition.onset.toInterval(), abatementDate]\n\n/*\n@description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).\n@comment: This function can be used to determine the logical id of a given resource. It can be used in\na single-server environment to trace references. However, this function does not attempt to resolve\nor distinguish the base of the given url, and so cannot be used safely in multi-server environments.\n@deprecated: This function is deprecated. Use the fluent function `getId()` instead\n*/\ndefine function GetId(uri String):\n  Last(Split(uri, '/'))\n\n/*\n@description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).\n@comment: This function can be used to determine the logical id of a given resource. It can be used in\na single-server environment to trace references. However, this function does not attempt to resolve\nor distinguish the base of the given url, and so cannot be used safely in multi-server environments.\n*/\ndefine fluent function getId(uri String):\n  Last(Split(uri, '/'))\n\n/*\n@description: Returns true if the given reference is to the given resource\n@comment: Returns true if the `id` element of the given resource exactly equals the tail of the given reference.\nNOTE: This function assumes resources from the same source server.\n*/\ndefine fluent function references(reference Reference, resource Resource):\n  resource.id = Last(Split(reference.reference, '/'))  \n\n/*\n@description: Returns true if the given reference is to the given resourceId\n@comment: Returns true if the `resourceId` parameter exactly equals the tail of the given reference.\nNOTE: This function assumes resources from the same source server.\n*/\ndefine fluent function references(reference Reference, resourceId String):\n  resourceId = Last(Split(reference.reference, '/'))\n\n/*\n@description: Returns true if any of the given references are to the given resource\n@comment: Returns true if the `id` element of the given resource exactly equals the tail of any of the given references.\nNOTE: This function assumes resources from the same source server.\n*/\ndefine fluent function references(references List&lt;Reference&gt;, resource Resource):\n  exists (references R where R.references(resource))\n  \n/*\n@description: Returns true if any of the given references are to the given resourceId\n@comment: Returns true if the `resourceId` parameter exactly equals the tail of any of the given references.\nNOTE: This function assumes resources from the same source server.\n*/\ndefine fluent function references(references List&lt;Reference&gt;, resourceId String):\n  exists (references R where R.references(resourceId))\n\n/*\n@description: Returns true if the given code is in the given codeList\n@comment: Returns true if the `code` is equivalent to any of the codes in the given `codeList`, false otherwise.\n*/\ndefine fluent function includesCode(codeList List&lt;Concept&gt;, code Code):\n  exists (codeList C where C ~ code)\n\n/*\n@description: Given an interval, return true if the interval has a starting boundary specified\n(i.e. the start of the interval is not null and not the minimum DateTime value)\n@deprecated: This function is deprecated. Uee the fluent function `hasStart()` instead\n*/\ndefine function &quot;HasStart&quot;(period Interval&lt;DateTime&gt; ):\n  not ( start of period is null\n      or start of period = minimum DateTime\n  )\n\n/*\n@description: Given an interval, return true if the interval has a starting boundary specified\n(i.e. the start of the interval is not null and not the minimum DateTime value)\n*/\ndefine fluent function hasStart(period Interval&lt;DateTime&gt; ):\n  not ( start of period is null\n      or start of period = minimum DateTime\n  )\n\n/*\n@description: Given an interval, returns true if the interval has an ending boundary specified\n(i.e. the end of the interval is not null and not the maximum DateTime value)\n@deprecated: This function is deprecated. Use the fluent function `hasEnd()` instead\n*/\ndefine function &quot;HasEnd&quot;(period Interval&lt;DateTime&gt; ):\n  not (\n    end of period is null\n      or end of period = maximum DateTime\n  )\n\n/*\n@description: Given an interval, returns true if the interval has an ending boundary specified\n(i.e. the end of the interval is not null and not the maximum DateTime value)\n*/\ndefine fluent function hasEnd(period Interval&lt;DateTime&gt; ):\n  not (\n    end of period is null\n      or end of period = maximum DateTime\n  )\n\n/*\n@description: Given an interval, returns the ending point if the interval has an ending boundary specified,\notherwise, returns the starting point\n@deprecated: This function is deprecated. Use the fluent function `latest()` instead\n*/\ndefine function &quot;Latest&quot;(choice Choice&lt;DateTime, Quantity, Interval&lt;DateTime&gt;, Interval&lt;Quantity&gt;&gt; ):\n  (choice.toInterval()) period\n    return\n      if (HasEnd(period)) then end of period\n      else start of period\n\n/*\n@description: Given an interval, returns the ending point if the interval has an ending boundary specified,\notherwise, returns the starting point\n*/\ndefine fluent function latest(choice Choice&lt;DateTime, Quantity, Interval&lt;DateTime&gt;, Interval&lt;Quantity&gt;&gt; ):\n  (choice.toInterval()) period\n    return\n      if (period.&quot;hasEnd&quot;()) then end of period\n      else start of period\n\n/*\n@description: Given an interval, return the starting point if the interval has a starting boundary specified,\notherwise, return the ending point\n@deprecated: This function is deprecated. Use the fluent function `earliest()` instead\n*/\ndefine function &quot;Earliest&quot;(choice Choice&lt;DateTime, Quantity, Interval&lt;DateTime&gt;, Interval&lt;Quantity&gt;&gt; ):\n  (choice.toInterval()) period\n    return\n      if (HasStart(period)) then start of period\n      else end of period\n\n/*\n@description: Given an interval, return the starting point if the interval has a starting boundary specified,\notherwise, return the ending point\n*/\ndefine fluent function earliest(choice Choice&lt;DateTime, Quantity, Interval&lt;DateTime&gt;, Interval&lt;Quantity&gt;&gt; ):\n  (choice.toInterval()) period\n    return\n      if (period.&quot;hasStart&quot;()) then start of period\n      else end of period\n\n/*\n@description: Creates a list of integers from 1 to how many days are in the interval. Note, this wont create an index for\nthe final day if it is less than 24 hours. This also includes the first 24 hour period.\n@deprecated: This function is deprecated. Use the fluent function `toDayNumbers()` instead\n*/\ndefine function &quot;Interval To Day Numbers&quot;(Period Interval&lt;DateTime&gt;):\n  ( expand { Interval[1, duration in days between start of Period and end of Period]} ) DayNumber\n    return end of DayNumber\n\n/*\n@description: Creates a list of integers from 1 to how many days are in the interval. Note, this wont create an index for\nthe final day if it is less than 24 hours. This also includes the first 24 hour period.\n*/\ndefine fluent function toDayNumbers(Period Interval&lt;DateTime&gt;):\n  ( expand { Interval[1, duration in days between start of Period and end of Period]} ) DayNumber\n    return end of DayNumber\n\n/*\n@description: Creates a list of 24 hour long intervals in an interval paired with the index (1 indexed) to which 24 hour interval it is.\nNote that the result will include intervals that are closed at the beginning and open at the end\n@deprecated: This function is deprecated. Use the fluent function `daysInPeriod()` instead\n*/\ndefine function &quot;Days In Period&quot;(Period Interval&lt;DateTime&gt;):\n  ( &quot;Interval To Day Numbers&quot;(Period)) DayIndex\n    let startPeriod: start of Period + (24 hours * (DayIndex - 1)),\n    endPeriod: if (hours between startPeriod and end of Period &lt; 24) then startPeriod\n      else start of Period + (24 hours * DayIndex)\n    return Tuple {\n      dayIndex: DayIndex,\n      dayPeriod: Interval[startPeriod, endPeriod)\n    }\n\n/*\n@description: Creates a list of 24 hour long intervals in an interval paired with the index (1 indexed) to which 24 hour interval it is.\nNote that the result will include intervals that are closed at the beginning and open at the end\n*/\ndefine fluent function daysInPeriod(Period Interval&lt;DateTime&gt;):\n  ( &quot;Interval To Day Numbers&quot;(Period)) DayIndex\n    let startPeriod: start of Period + (24 hours * (DayIndex - 1)),\n    endPeriod: if (hours between startPeriod and end of Period &lt; 24) then startPeriod\n      else start of Period + (24 hours * DayIndex)\n    return Tuple {\n      dayIndex: DayIndex,\n      dayPeriod: Interval[startPeriod, endPeriod)\n    }</code></pre>\n      </td>\n    </tr>\n    \n    \n    \n  \n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.4.8 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
      },
      "extension": [ {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://loinc.org",
          "code": "21112-8",
          "display": "Birthdate"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://snomed.info/sct",
          "code": "419099009",
          "display": "Dead"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode",
          "code": "ER",
          "display": "ER"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode",
          "code": "ICU",
          "display": "ICU"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
          "code": "billing",
          "display": "Billing"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://hl7.org/fhir/CodeSystem/task-code",
          "code": "fulfill",
          "display": "Fulfill"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "AMB",
          "display": "ambulatory"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "EMER",
          "display": "emergency"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "FLD",
          "display": "field"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "HH",
          "display": "home health"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "IMP",
          "display": "inpatient encounter"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "ACUTE",
          "display": "inpatient acute"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "NONAC",
          "display": "inpatient non-acute"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "OBSENC",
          "display": "observation encounter"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "PRENC",
          "display": "pre-admission"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "SS",
          "display": "short stay"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "VR",
          "display": "virtual"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-category",
          "code": "problem-list-item",
          "display": "problem-list-item"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-category",
          "code": "encounter-diagnosis",
          "display": "encounter-diagnosis"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://hl7.org/fhir/us/core/CodeSystem/condition-category",
          "code": "health-concern",
          "display": "health-concern"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
          "code": "active",
          "display": "active"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
          "code": "recurrence",
          "display": "recurrence"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
          "code": "relapse",
          "display": "relapse"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
          "code": "inactive",
          "display": "inactive"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
          "code": "remission",
          "display": "remission"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
          "code": "resolved",
          "display": "resolved"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
          "code": "unconfirmed",
          "display": "unconfirmed"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
          "code": "provisional",
          "display": "provisional"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
          "code": "differential",
          "display": "differential"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
          "code": "confirmed",
          "display": "confirmed"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
          "code": "refuted",
          "display": "refuted"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
          "code": "entered-in-error",
          "display": "entered-in-error"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
          "code": "active",
          "display": "allergy-active"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
          "code": "inactive",
          "display": "allergy-inactive"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
          "code": "resolved",
          "display": "allergy-resolved"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
          "code": "unconfirmed",
          "display": "allergy-unconfirmed"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
          "code": "confirmed",
          "display": "allergy-confirmed"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
          "code": "refuted",
          "display": "allergy-refuted"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
          "code": "inpatient",
          "display": "Inpatient"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
          "code": "outpatient",
          "display": "Outpatient"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
          "code": "community",
          "display": "Community"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
          "code": "discharge",
          "display": "Discharge"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
          "code": "AD",
          "display": "AD"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
          "code": "DD",
          "display": "DD"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
          "code": "CC",
          "display": "CC"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
          "code": "CM",
          "display": "CM"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
          "code": "pre-op",
          "display": "pre-op"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
          "code": "post-op",
          "display": "post-op"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
          "code": "billing",
          "display": "billing"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "social-history",
          "display": "social-history"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "vital-signs",
          "display": "vital-signs"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "imaging",
          "display": "imaging"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "laboratory",
          "display": "laboratory"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "procedure",
          "display": "procedure"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "survey",
          "display": "survey"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "exam",
          "display": "exam"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "therapy",
          "display": "therapy"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "activity",
          "display": "activity"
        }
      } ],
      "url": "https://madie.cms.gov/Library/QICoreCommon",
      "identifier": [ {
        "use": "official",
        "system": "https://madie.cms.gov/login",
        "value": "67cb33c19e9ab93ec36dad45"
      } ],
      "version": "4.0.000",
      "name": "QICoreCommon",
      "title": "QICoreCommon",
      "status": "active",
      "experimental": false,
      "type": {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/library-type",
          "code": "logic-library"
        } ]
      },
      "date": "2025-07-25T20:59:18+00:00",
      "publisher": "ICF",
      "description": "Common terminologies and functions used in QI-Core-based CQL artifacts",
      "relatedArtifact": [ {
        "type": "depends-on",
        "display": "QICore model information",
        "resource": "http://hl7.org/fhir/Library/QICore-ModelInfo"
      }, {
        "type": "depends-on",
        "display": "Library FHIRHelpers",
        "resource": "https://madie.cms.gov/Library/FHIRHelpers|4.4.000"
      }, {
        "type": "depends-on",
        "display": "Code system USCoreConditionCategoryExtensionCodes",
        "resource": "http://hl7.org/fhir/us/core/CodeSystem/condition-category"
      }, {
        "type": "depends-on",
        "display": "Code system ObservationCategoryCodes",
        "resource": "http://terminology.hl7.org/CodeSystem/observation-category"
      }, {
        "type": "depends-on",
        "display": "Code system ConditionClinicalStatusCodes",
        "resource": "http://terminology.hl7.org/CodeSystem/condition-clinical"
      }, {
        "type": "depends-on",
        "display": "Code system MedicationRequestCategory",
        "resource": "http://terminology.hl7.org/CodeSystem/medicationrequest-category"
      }, {
        "type": "depends-on",
        "display": "Code system ConditionCategory",
        "resource": "http://terminology.hl7.org/CodeSystem/condition-category"
      } ],
      "dataRequirement": [ {
        "type": "Resource",
        "profile": [ "http://hl7.org/fhir/StructureDefinition/Resource" ],
        "mustSupport": [ "id", "id.value" ]
      }, {
        "type": "Patient",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient" ],
        "mustSupport": [ "birthDate", "birthDate.value" ]
      }, {
        "type": "DeviceRequest",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-devicerequest" ],
        "mustSupport": [ "modifierExtension" ]
      } ],
      "content": [ {
        "contentType": "text/cql",
        "data": "[encoded data, 43100 characters]"
      }, {
        "contentType": "application/elm+xml",
        "data": "[encoded data, 1733416 characters]"
      }, {
        "contentType": "application/elm+json",
        "data": "[encoded data, 2930368 characters]"
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Library/QICoreCommon"
    }
  }, {
    "fullUrl": "https://madie.cms.gov/Library/FHIRHelpers",
    "resource": {
      "resourceType": "Library",
      "id": "FHIRHelpers",
      "meta": {
        "profile": [ "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-computablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary", "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-executablelibrary", "http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-json-library", "http://hl7.org/fhir/uv/cql/StructureDefinition/elm-xml-library" ]
      },
      "language": "en",
      "text": {
        "status": "extensions",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"col-12\">\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n<td class=\"content-container\">FHIRHelpers</td>\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n<td class=\"content-container\">4.4.000</td>\n</tr>\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n<td class=\"content-container\">660d90bc01598d085de46056</td>\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward (Publisher)</th>\n\n\n<td class=\"content-container\">ICF</td>\n</tr>\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n<td class=\"content-container\">This library defines functions to convert between FHIR\n data types and CQL system-defined types, as well as functions to support\n FHIRPath implementation. For more information, the FHIRHelpers wiki page:\n https://github.com/cqframework/clinical_quality_language/wiki/FHIRHelpers</td>\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n<td class=\"content-container\">[http://terminology.hl7.org/CodeSystem/library-type#logic-library]</td>\n</tr>\n\n\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">CQL Content</th>\n      <td>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">library FHIRHelpers version '4.4.000'\n\r\nusing FHIR version '4.0.1'\r\n\r\n/*\r\n@description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)\r\nvalue to a CQL DateTime Interval\r\n@comment: If the start value of the given period is unspecified, the starting\r\nboundary of the resulting interval will be open (meaning the start of the interval\r\nis unknown, as opposed to interpreted as the beginning of time).\r\n*/\r\ndefine function ToInterval(period FHIR.Period):\r\n    if period is null then\r\n        null\r\n    else\r\n        if period.&quot;start&quot; is null then\r\n            Interval(period.&quot;start&quot;.value, period.&quot;end&quot;.value]\r\n        else\r\n            Interval[period.&quot;start&quot;.value, period.&quot;end&quot;.value]\r\n\r\n/*\r\n@description: Converts a UCUM definite duration unit to a CQL calendar duration\r\nunit using conversions specified in the [quantities](https://cql.hl7.org/02-authorsguide.html#quantities) \r\ntopic of the CQL specification.\r\n@comment: Note that for durations above days (or weeks), the conversion is understood to be approximate\r\n*/\r\ndefine function ToCalendarUnit(unit System.String):\r\n    case unit\r\n        when 'ms' then 'millisecond'\r\n        when 's' then 'second'\r\n        when 'min' then 'minute'\r\n        when 'h' then 'hour'\r\n        when 'd' then 'day'\r\n        when 'wk' then 'week'\r\n        when 'mo' then 'month'\r\n        when 'a' then 'year'\r\n        else unit\r\n    end\r\n\r\n/*\r\n@description: Converts the given FHIR [Quantity](https://hl7.org/fhir/datatypes.html#Quantity) \r\nvalue to a CQL Quantity\r\n@comment: If the given quantity has a comparator specified, a runtime error is raised. If the given quantity\r\nhas a system other than UCUM (i.e. `http://unitsofmeasure.org`) or CQL calendar units (i.e. `http://hl7.org/fhirpath/CodeSystem/calendar-units`)\r\nan error is raised. For UCUM to calendar units, the `ToCalendarUnit` function is used.\r\n@seealso: ToCalendarUnit\r\n*/\r\ndefine function ToQuantity(quantity FHIR.Quantity):\r\n    case\r\n        when quantity is null then null\r\n        when quantity.value is null then null\r\n        when quantity.comparator is not null then\r\n            Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.')\r\n        when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'\r\n              or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then\r\n            System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }\r\n        else\r\n            Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' &amp; quantity.unit.value &amp; ' (' &amp; quantity.system.value &amp; '|' &amp; quantity.code.value &amp; ')')\r\n    end\r\n\r\n/*\r\n@description: Converts the given FHIR [Quantity](https://hl7.org/fhir/datatypes.html#Quantity) value to a CQL Quantity, ignoring\r\nthe comparator element. This function should only be used when an application is justified in ignoring the comparator value (i.e. the\r\ncontext is looking for boundary).\r\n@comment: If the given quantity has a system other than UCUM (i.e. `http://unitsofmeasure.org`) or CQL calendar units \r\n(i.e. `http://hl7.org/fhirpath/CodeSystem/calendar-units`) an error is raised. For UCUM to calendar units, the `ToCalendarUnit` function \r\nis used.\r\n@seealso: ToCalendarUnit\r\n*/\r\ndefine function ToQuantityIgnoringComparator(quantity FHIR.Quantity):\r\n    case\r\n        when quantity is null then null\r\n        when quantity.value is null then null\r\n        when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'\r\n              or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then\r\n            System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }\r\n        else\r\n            Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' &amp; quantity.unit.value &amp; ' (' &amp; quantity.system.value &amp; '|' &amp; quantity.code.value &amp; ')')\r\n    end\r\n\r\n/*\r\n@description: Converts the given FHIR [Quantity](https://hl7.org/fhir/datatypes.html#Quantity) value to a CQL Interval of Quantity.\r\n@comment: If the given quantity has a comparator, it is used to construct an interval based on the value of the comparator. If the comparator\r\nis less than, the resulting interval will start with a null closed boundary and end with an open boundary on the quantity. If the comparator\r\nis less than or equal, the resulting interval will start with a null closed boundary and end with a closed boundary on the quantity. If the \r\ncomparator is greater or equal, the resulting interval will start with a closed boundary on the quantity and end with a closed null boundary.\r\nIf the comparator is greatter than, the resulting interval will start with an open boundary on the quantity and end with a closed null boundary.\r\nIf no comparator is specified, the resulting interval will start and end with a closed boundary on the quantity.\r\n*/\r\ndefine function ToInterval(quantity FHIR.Quantity):\r\n    if quantity is null then null else\r\n        case quantity.comparator.value\r\n            when '&lt;' then\r\n                Interval[\r\n                    null,\r\n                    ToQuantityIgnoringComparator(quantity)\r\n                )\r\n            when '&lt;=' then\r\n                Interval[\r\n                    null,\r\n                    ToQuantityIgnoringComparator(quantity)\r\n                ]\r\n            when '&gt;=' then\r\n                Interval[\r\n                    ToQuantityIgnoringComparator(quantity),\r\n                    null\r\n                ]\r\n            when '&gt;' then\r\n                Interval(\r\n                    ToQuantityIgnoringComparator(quantity),\r\n                    null\r\n                ]\r\n            else\r\n                Interval[ToQuantity(quantity), ToQuantity(quantity)]\r\n        end\r\n\r\n/*\r\n@description: Converts the given FHIR [Ratio](https://hl7.org/fhir/datatypes.html#Ratio) value to a CQL Ratio.\r\n*/\r\ndefine function ToRatio(ratio FHIR.Ratio):\r\n    if ratio is null then\r\n        null\r\n    else\r\n        System.Ratio { numerator: ToQuantity(ratio.numerator), denominator: ToQuantity(ratio.denominator) }\r\n\r\n/*\r\n@description: Converts the given FHIR [Range](https://hl7.org/fhir/datatypes.html#Range) value to a CQL Interval of Quantity\r\n*/\r\ndefine function ToInterval(range FHIR.Range):\r\n    if range is null then\r\n        null\r\n    else\r\n        Interval[ToQuantity(range.low), ToQuantity(range.high)]\r\n\r\n/*\r\n@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.\r\n*/\r\ndefine function ToCode(coding FHIR.Coding):\r\n    if coding is null then\r\n        null\r\n    else\r\n        System.Code {\r\n          code: coding.code.value,\r\n          system: coding.system.value,\r\n          version: coding.version.value,\r\n          display: coding.display.value\r\n        }\r\n\r\n/*\r\n@description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.\r\n*/\r\ndefine function ToConcept(concept FHIR.CodeableConcept):\r\n    if concept is null then\r\n        null\r\n    else\r\n        System.Concept {\r\n            codes: concept.coding C return ToCode(C),\r\n            display: concept.text.value\r\n        }\r\n\r\n/*\r\n@description: Converts the given value (assumed to be a URI) to a CQL [ValueSet](https://cql.hl7.org/09-b-cqlreference.html#valueset)\r\n*/\r\ndefine function ToValueSet(uri String):\r\n    if uri is null then\r\n        null\r\n    else\r\n        System.ValueSet {\r\n            id: uri\r\n        }\r\n\r\n/*\r\n@description: Constructs a FHIR [Reference](https://hl7.org/fhir/datatypes.html#Reference) from the given reference (assumed to be a FHIR resource URL)\r\n*/\r\ndefine function reference(reference String):\r\n    if reference is null then\r\n        null\r\n    else\r\n        Reference { reference: string { value: reference } }\r\n\r\n/*\r\n@description: Converts the given value to a CQL value using the appropriate accessor or conversion function.\r\n@comment: TODO: document conversion\r\n*/\r\ndefine function ToValue(value Choice&lt;base64Binary,\r\n        boolean,\r\n        canonical,\r\n        code,\r\n        date,\r\n        dateTime,\r\n        decimal,\r\n        id,\r\n        instant,\r\n        integer,\r\n        markdown,\r\n        oid,\r\n        positiveInt,\r\n        string,\r\n        time,\r\n        unsignedInt,\r\n        uri,\r\n        url,\r\n        uuid,\r\n        Address,\r\n        Age,\r\n        Annotation,\r\n        Attachment,\r\n        CodeableConcept,\r\n        Coding,\r\n        ContactPoint,\r\n        Count,\r\n        Distance,\r\n        Duration,\r\n        HumanName,\r\n        Identifier,\r\n        Money,\r\n        Period,\r\n        Quantity,\r\n        Range,\r\n        Ratio,\r\n        Reference,\r\n        SampledData,\r\n        Signature,\r\n        Timing,\r\n        ContactDetail,\r\n        Contributor,\r\n        DataRequirement,\r\n        Expression,\r\n        ParameterDefinition,\r\n        RelatedArtifact,\r\n        TriggerDefinition,\r\n        UsageContext,\r\n        Dosage,\r\n        Meta&gt;):\r\n    case\r\n      when value is base64Binary then (value as base64Binary).value\r\n      when value is boolean then (value as boolean).value\r\n      when value is canonical then (value as canonical).value\r\n      when value is code then (value as code).value\r\n      when value is date then (value as date).value\r\n      when value is dateTime then (value as dateTime).value\r\n      when value is decimal then (value as decimal).value\r\n      when value is id then (value as id).value\r\n      when value is instant then (value as instant).value\r\n      when value is integer then (value as integer).value\r\n      when value is markdown then (value as markdown).value\r\n      when value is oid then (value as oid).value\r\n      when value is positiveInt then (value as positiveInt).value\r\n      when value is string then (value as string).value\r\n      when value is time then (value as time).value\r\n      when value is unsignedInt then (value as unsignedInt).value\r\n      when value is uri then (value as uri).value\r\n      when value is url then (value as url).value\r\n      when value is uuid then (value as uuid).value\r\n      when value is Age then ToQuantity(value as Age)\r\n      when value is CodeableConcept then ToConcept(value as CodeableConcept)\r\n      when value is Coding then ToCode(value as Coding)\r\n      when value is Count then ToQuantity(value as Count)\r\n      when value is Distance then ToQuantity(value as Distance)\r\n      when value is Duration then ToQuantity(value as Duration)\r\n      when value is Quantity then ToQuantity(value as Quantity)\r\n      when value is Range then ToInterval(value as Range)\r\n      when value is Period then ToInterval(value as Period)\r\n      when value is Ratio then ToRatio(value as Ratio)\r\n      else value as Choice&lt;Address,\r\n        Annotation,\r\n        Attachment,\r\n        ContactPoint,\r\n        HumanName,\r\n        Identifier,\r\n        Money,\r\n        Reference,\r\n        SampledData,\r\n        Signature,\r\n        Timing,\r\n        ContactDetail,\r\n        Contributor,\r\n        DataRequirement,\r\n        Expression,\r\n        ParameterDefinition,\r\n        RelatedArtifact,\r\n        TriggerDefinition,\r\n        UsageContext,\r\n        Dosage,\r\n        Meta&gt;\r\n    end\r\n\r\n/*\r\n@description: Resolve the given reference as a url to a resource. If the item resolves, the Resource is returned, otherwise the result is null.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function resolve(reference String) returns Resource: external\r\n/*\r\n@description: Resolve the reference element of the given Reference. If the item resolves, the Resource is returned, otherwise the result is null.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function resolve(reference Reference) returns Resource: external\r\n/*\r\n@description: Constructs a Reference to the given Resource. The resulting reference will typically be relative, but implementations may provide a base URL if one can be unambiguously determined.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function reference(resource Resource) returns Reference: external\r\n/*\r\n@description: Returns any extensions with the given url defined on the given element.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function extension(element Element, url String) returns List&lt;Extension&gt;: external\r\n/*\r\n@description: Returns any extensions with the given url defined on the given resource.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function extension(resource DomainResource, url String) returns List&lt;Extension&gt;: external\r\n/*\r\n@description: Returns any modifier extensions with the given url defined on the given element.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function modifierExtension(element BackboneElement, url String) returns List&lt;Extension&gt;: external\r\n/*\r\n@description: Returns any modifier extensions with the given url defined on the given resource.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function modifierExtension(resource DomainResource, url String) returns List&lt;Extension&gt;: external\r\n/*\r\n@description: Returns true if the element is a FHIR primitive type with a value element (as opposed to having only extensions); false otherwise\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function hasValue(element Element) returns Boolean: external\r\n/*\r\n@description: Returns the value of the FHIR primitive; null otherwise\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function getValue(element Element) returns Any: external\r\n/*\r\n@description: Returns a list containing only those elements in the input that are of the given type, specified as a string.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function ofType(identifier String) returns List&lt;Any&gt;: external\r\n/*\r\n@description: Returns true if the input is of the given type; false otherwise\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function is(identifier String) returns Boolean: external\r\n/*\r\n@description: If the input is of the given type; returns the value as that type; null otherwise.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function as(identifier String) returns Any: external\r\n/*\r\n@description: Returns the FHIR element definition for the given element\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function elementDefinition(element Element) returns ElementDefinition: external\r\n/*\r\n@description: Returns the given slice as defined in the given structure definition. The structure argument is a uri that resolves to the structure definition, and the name must be the name of a slice within that structure definition. If the structure cannot be resolved, or the name of the slice within the resolved structure is not present, an error is thrown.\r\n@comment: For every element in the input collection, if the resolved slice is present on the element, it will be returned. If the slice does not match any element in the input collection, or if the input collection is empty, the result is an empty collection ({ }).\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function slice(element Element, url String, name String) returns List&lt;Element&gt;: external\r\n/*\r\n@description: For each element in the input collection, verifies that there are no modifying extensions defined other than the ones given by the modifier argument. If the check passes, the input collection is returned. Otherwise, an error is thrown.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function checkModifiers(resource Resource) returns Resource: external\r\n/*\r\n@description: For each element in the input collection, verifies that there are no modifying extensions defined other than the ones given by the modifier argument. If the check passes, the input collection is returned. Otherwise, an error is thrown.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function checkModifiers(resource Resource, modifier String) returns Resource: external\r\n/*\r\n@description: For each element in the input collection, verifies that there are no modifying extensions defined other than the ones given by the modifier argument. If the check passes, the input collection is returned. Otherwise, an error is thrown.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function checkModifiers(element Element) returns Element: external\r\n/*\r\n@description: For each element in the input collection, verifies that there are no modifying extensions defined other than the ones given by the modifier argument. If the check passes, the input collection is returned. Otherwise, an error is thrown.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function checkModifiers(element Element, modifier String) returns Element: external\r\n/*\r\n@description: Returns true if the single input element conforms to the profile specified by the structure argument, and false otherwise. If the structure cannot be resolved to a valid profile, an error is thrown. If the input contains more than one element, an error is thrown. If the input is empty, the result is empty.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function conformsTo(resource Resource, structure String) returns Boolean: external\r\n/*\r\n@description: Returns true if the given code is equal to a code in the valueset, so long as the valueset only contains one codesystem. If the valueset contains more than one codesystem, an error is thrown.\r\n@comment: If the valueset cannot be resolved as a uri to a value set, an error is thrown.\r\nNote that implementations are encouraged to make use of a terminology service to provide this functionality.\r\nFor example:\r\n```fhirpath\r\nObservation.component.where(code.memberOf('http://hl7.org/fhir/ValueSet/observation-vitalsignresult'))\r\n```\r\nThis expression returns components that have a code that is a member of the observation-vitalsignresult valueset.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function memberOf(code code, valueSet String) returns Boolean: external\r\n/*\r\n@description: Returns true if the code is a member of the given valueset.\r\n@comment: If the valueset cannot be resolved as a uri to a value set, an error is thrown.\r\nNote that implementations are encouraged to make use of a terminology service to provide this functionality.\r\nFor example:\r\n```fhirpath\r\nObservation.component.where(code.memberOf('http://hl7.org/fhir/ValueSet/observation-vitalsignresult'))\r\n```\r\nThis expression returns components that have a code that is a member of the observation-vitalsignresult valueset.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function memberOf(coding Coding, valueSet String) returns Boolean: external\r\n/*\r\n@description: Returns true if any code in the concept is a member of the given valueset.\r\n@comment: If the valueset cannot be resolved as a uri to a value set, an error is thrown.\r\nNote that implementations are encouraged to make use of a terminology service to provide this functionality.\r\nFor example:\r\n```fhirpath\r\nObservation.component.where(code.memberOf('http://hl7.org/fhir/ValueSet/observation-vitalsignresult'))\r\n```\r\nThis expression returns components that have a code that is a member of the observation-vitalsignresult valueset.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function memberOf(concept CodeableConcept, valueSet String) returns Boolean: external\r\n/*\r\n@description: Returns true if the source code is equivalent to the given code, or if the source code subsumes the given code (i.e. the source code is an ancestor of the given code in a subsumption hierarchy), and false otherwise.\r\n@comment: If the Codings are from different code systems, the relationships between the code systems must be well-defined or a run-time error is thrown.\r\nNote that implementations are encouraged to make use of a terminology service to provide this functionality.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function subsumes(coding Coding, subsumedCoding Coding) returns Boolean: external\r\n/*\r\n@description: Returns true if any Coding in the source or given elements is equivalent to or subsumes the given code.\r\n@comment: If the Codings are from different code systems, the relationships between the code systems must be well-defined or a run-time error is thrown.\r\nNote that implementations are encouraged to make use of a terminology service to provide this functionality.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function subsumes(concept CodeableConcept, subsumedConcept CodeableConcept) returns Boolean: external\r\n/*\r\n@description: Returns true if the source code is equivalent to the given code, or if the source code is subsumed by the given code (i.e. the source code is a descendant of the given code in a subsumption hierarchy), and false otherwise.\r\n@comment: If the Codings are from different code systems, the relationships between the code systems must be well-defined or a run-time error is thrown.\r\nNote that implementations are encouraged to make use of a terminology service to provide this functionality.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function subsumedBy(coding Coding, subsumingCoding Coding) returns Boolean: external\r\n/*\r\n@description: Returns true if any Coding in the source or given elements is equivalent to or subsumed by the given code.\r\n@comment: If the Codings are from different code systems, the relationships between the code systems must be well-defined or a run-time error is thrown.\r\nNote that implementations are encouraged to make use of a terminology service to provide this functionality.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function subsumedBy(concept CodeableConcept, subsumingConcept CodeableConcept) returns Boolean: external\r\n/*\r\n@description: When invoked on an xhtml element, returns true if the rules around HTML usage are met, and false if they are not. The return value is undefined (null) on any other kind of element.\r\n@seealso: https://hl7.org/fhir/fhirpath.html#functions\r\n*/\r\ndefine function htmlChecks(element Element) returns Boolean: external\r\n\r\ndefine function ToString(value AccountStatus): value.value\r\ndefine function ToString(value ActionCardinalityBehavior): value.value\r\ndefine function ToString(value ActionConditionKind): value.value\r\ndefine function ToString(value ActionGroupingBehavior): value.value\r\ndefine function ToString(value ActionParticipantType): value.value\r\ndefine function ToString(value ActionPrecheckBehavior): value.value\r\ndefine function ToString(value ActionRelationshipType): value.value\r\ndefine function ToString(value ActionRequiredBehavior): value.value\r\ndefine function ToString(value ActionSelectionBehavior): value.value\r\ndefine function ToString(value ActivityDefinitionKind): value.value\r\ndefine function ToString(value ActivityParticipantType): value.value\r\ndefine function ToString(value AddressType): value.value\r\ndefine function ToString(value AddressUse): value.value\r\ndefine function ToString(value AdministrativeGender): value.value\r\ndefine function ToString(value AdverseEventActuality): value.value\r\ndefine function ToString(value AggregationMode): value.value\r\ndefine function ToString(value AllergyIntoleranceCategory): value.value\r\ndefine function ToString(value AllergyIntoleranceCriticality): value.value\r\ndefine function ToString(value AllergyIntoleranceSeverity): value.value\r\ndefine function ToString(value AllergyIntoleranceType): value.value\r\ndefine function ToString(value AppointmentStatus): value.value\r\ndefine function ToString(value AssertionDirectionType): value.value\r\ndefine function ToString(value AssertionOperatorType): value.value\r\ndefine function ToString(value AssertionResponseTypes): value.value\r\ndefine function ToString(value AuditEventAction): value.value\r\ndefine function ToString(value AuditEventAgentNetworkType): value.value\r\ndefine function ToString(value AuditEventOutcome): value.value\r\ndefine function ToString(value BindingStrength): value.value\r\ndefine function ToString(value BiologicallyDerivedProductCategory): value.value\r\ndefine function ToString(value BiologicallyDerivedProductStatus): value.value\r\ndefine function ToString(value BiologicallyDerivedProductStorageScale): value.value\r\ndefine function ToString(value BundleType): value.value\r\ndefine function ToString(value CapabilityStatementKind): value.value\r\ndefine function ToString(value CarePlanActivityKind): value.value\r\ndefine function ToString(value CarePlanActivityStatus): value.value\r\ndefine function ToString(value CarePlanIntent): value.value\r\ndefine function ToString(value CarePlanStatus): value.value\r\ndefine function ToString(value CareTeamStatus): value.value\r\ndefine function ToString(value CatalogEntryRelationType): value.value\r\ndefine function ToString(value ChargeItemDefinitionPriceComponentType): value.value\r\ndefine function ToString(value ChargeItemStatus): value.value\r\ndefine function ToString(value ClaimResponseStatus): value.value\r\ndefine function ToString(value ClaimStatus): value.value\r\ndefine function ToString(value ClinicalImpressionStatus): value.value\r\ndefine function ToString(value CodeSearchSupport): value.value\r\ndefine function ToString(value CodeSystemContentMode): value.value\r\ndefine function ToString(value CodeSystemHierarchyMeaning): value.value\r\ndefine function ToString(value CommunicationPriority): value.value\r\ndefine function ToString(value CommunicationRequestStatus): value.value\r\ndefine function ToString(value CommunicationStatus): value.value\r\ndefine function ToString(value CompartmentCode): value.value\r\ndefine function ToString(value CompartmentType): value.value\r\ndefine function ToString(value CompositionAttestationMode): value.value\r\ndefine function ToString(value CompositionStatus): value.value\r\ndefine function ToString(value ConceptMapEquivalence): value.value\r\ndefine function ToString(value ConceptMapGroupUnmappedMode): value.value\r\ndefine function ToString(value ConditionalDeleteStatus): value.value\r\ndefine function ToString(value ConditionalReadStatus): value.value\r\ndefine function ToString(value ConsentDataMeaning): value.value\r\ndefine function ToString(value ConsentProvisionType): value.value\r\ndefine function ToString(value ConsentState): value.value\r\ndefine function ToString(value ConstraintSeverity): value.value\r\ndefine function ToString(value ContactPointSystem): value.value\r\ndefine function ToString(value ContactPointUse): value.value\r\ndefine function ToString(value ContractPublicationStatus): value.value\r\ndefine function ToString(value ContractStatus): value.value\r\ndefine function ToString(value ContributorType): value.value\r\ndefine function ToString(value CoverageStatus): value.value\r\ndefine function ToString(value CurrencyCode): value.value\r\ndefine function ToString(value DayOfWeek): value.value\r\ndefine function ToString(value DaysOfWeek): value.value\r\ndefine function ToString(value DetectedIssueSeverity): value.value\r\ndefine function ToString(value DetectedIssueStatus): value.value\r\ndefine function ToString(value DeviceMetricCalibrationState): value.value\r\ndefine function ToString(value DeviceMetricCalibrationType): value.value\r\ndefine function ToString(value DeviceMetricCategory): value.value\r\ndefine function ToString(value DeviceMetricColor): value.value\r\ndefine function ToString(value DeviceMetricOperationalStatus): value.value\r\ndefine function ToString(value DeviceNameType): value.value\r\ndefine function ToString(value DeviceRequestStatus): value.value\r\ndefine function ToString(value DeviceUseStatementStatus): value.value\r\ndefine function ToString(value DiagnosticReportStatus): value.value\r\ndefine function ToString(value DiscriminatorType): value.value\r\ndefine function ToString(value DocumentConfidentiality): value.value\r\ndefine function ToString(value DocumentMode): value.value\r\ndefine function ToString(value DocumentReferenceStatus): value.value\r\ndefine function ToString(value DocumentRelationshipType): value.value\r\ndefine function ToString(value EligibilityRequestPurpose): value.value\r\ndefine function ToString(value EligibilityRequestStatus): value.value\r\ndefine function ToString(value EligibilityResponsePurpose): value.value\r\ndefine function ToString(value EligibilityResponseStatus): value.value\r\ndefine function ToString(value EnableWhenBehavior): value.value\r\ndefine function ToString(value EncounterLocationStatus): value.value\r\ndefine function ToString(value EncounterStatus): value.value\r\ndefine function ToString(value EndpointStatus): value.value\r\ndefine function ToString(value EnrollmentRequestStatus): value.value\r\ndefine function ToString(value EnrollmentResponseStatus): value.value\r\ndefine function ToString(value EpisodeOfCareStatus): value.value\r\ndefine function ToString(value EventCapabilityMode): value.value\r\ndefine function ToString(value EventTiming): value.value\r\ndefine function ToString(value EvidenceVariableType): value.value\r\ndefine function ToString(value ExampleScenarioActorType): value.value\r\ndefine function ToString(value ExplanationOfBenefitStatus): value.value\r\ndefine function ToString(value ExposureState): value.value\r\ndefine function ToString(value ExtensionContextType): value.value\r\ndefine function ToString(value FHIRAllTypes): value.value\r\ndefine function ToString(value FHIRDefinedType): value.value\r\ndefine function ToString(value FHIRDeviceStatus): value.value\r\ndefine function ToString(value FHIRResourceType): value.value\r\ndefine function ToString(value FHIRSubstanceStatus): value.value\r\ndefine function ToString(value FHIRVersion): value.value\r\ndefine function ToString(value FamilyHistoryStatus): value.value\r\ndefine function ToString(value FilterOperator): value.value\r\ndefine function ToString(value FlagStatus): value.value\r\ndefine function ToString(value GoalLifecycleStatus): value.value\r\ndefine function ToString(value GraphCompartmentRule): value.value\r\ndefine function ToString(value GraphCompartmentUse): value.value\r\ndefine function ToString(value GroupMeasure): value.value\r\ndefine function ToString(value GroupType): value.value\r\ndefine function ToString(value GuidanceResponseStatus): value.value\r\ndefine function ToString(value GuidePageGeneration): value.value\r\ndefine function ToString(value GuideParameterCode): value.value\r\ndefine function ToString(value HTTPVerb): value.value\r\ndefine function ToString(value IdentifierUse): value.value\r\ndefine function ToString(value IdentityAssuranceLevel): value.value\r\ndefine function ToString(value ImagingStudyStatus): value.value\r\ndefine function ToString(value ImmunizationEvaluationStatus): value.value\r\ndefine function ToString(value ImmunizationStatus): value.value\r\ndefine function ToString(value InvoicePriceComponentType): value.value\r\ndefine function ToString(value InvoiceStatus): value.value\r\ndefine function ToString(value IssueSeverity): value.value\r\ndefine function ToString(value IssueType): value.value\r\ndefine function ToString(value LinkType): value.value\r\ndefine function ToString(value LinkageType): value.value\r\ndefine function ToString(value ListMode): value.value\r\ndefine function ToString(value ListStatus): value.value\r\ndefine function ToString(value LocationMode): value.value\r\ndefine function ToString(value LocationStatus): value.value\r\ndefine function ToString(value MeasureReportStatus): value.value\r\ndefine function ToString(value MeasureReportType): value.value\r\ndefine function ToString(value MediaStatus): value.value\r\ndefine function ToString(value MedicationAdministrationStatus): value.value\r\ndefine function ToString(value MedicationDispenseStatus): value.value\r\ndefine function ToString(value MedicationKnowledgeStatus): value.value\r\ndefine function ToString(value MedicationRequestIntent): value.value\r\ndefine function ToString(value MedicationRequestPriority): value.value\r\ndefine function ToString(value MedicationRequestStatus): value.value\r\ndefine function ToString(value MedicationStatementStatus): value.value\r\ndefine function ToString(value MedicationStatus): value.value\r\ndefine function ToString(value MessageSignificanceCategory): value.value\r\ndefine function ToString(value Messageheader_Response_Request): value.value\r\ndefine function ToString(value MimeType): value.value\r\ndefine function ToString(value NameUse): value.value\r\ndefine function ToString(value NamingSystemIdentifierType): value.value\r\ndefine function ToString(value NamingSystemType): value.value\r\ndefine function ToString(value NarrativeStatus): value.value\r\ndefine function ToString(value NoteType): value.value\r\ndefine function ToString(value NutritiionOrderIntent): value.value\r\ndefine function ToString(value NutritionOrderStatus): value.value\r\ndefine function ToString(value ObservationDataType): value.value\r\ndefine function ToString(value ObservationRangeCategory): value.value\r\ndefine function ToString(value ObservationStatus): value.value\r\ndefine function ToString(value OperationKind): value.value\r\ndefine function ToString(value OperationParameterUse): value.value\r\ndefine function ToString(value OrientationType): value.value\r\ndefine function ToString(value ParameterUse): value.value\r\ndefine function ToString(value ParticipantRequired): value.value\r\ndefine function ToString(value ParticipantStatus): value.value\r\ndefine function ToString(value ParticipationStatus): value.value\r\ndefine function ToString(value PaymentNoticeStatus): value.value\r\ndefine function ToString(value PaymentReconciliationStatus): value.value\r\ndefine function ToString(value ProcedureStatus): value.value\r\ndefine function ToString(value PropertyRepresentation): value.value\r\ndefine function ToString(value PropertyType): value.value\r\ndefine function ToString(value ProvenanceEntityRole): value.value\r\ndefine function ToString(value PublicationStatus): value.value\r\ndefine function ToString(value QualityType): value.value\r\ndefine function ToString(value QuantityComparator): value.value\r\ndefine function ToString(value QuestionnaireItemOperator): value.value\r\ndefine function ToString(value QuestionnaireItemType): value.value\r\ndefine function ToString(value QuestionnaireResponseStatus): value.value\r\ndefine function ToString(value ReferenceHandlingPolicy): value.value\r\ndefine function ToString(value ReferenceVersionRules): value.value\r\ndefine function ToString(value ReferredDocumentStatus): value.value\r\ndefine function ToString(value RelatedArtifactType): value.value\r\ndefine function ToString(value RemittanceOutcome): value.value\r\ndefine function ToString(value RepositoryType): value.value\r\ndefine function ToString(value RequestIntent): value.value\r\ndefine function ToString(value RequestPriority): value.value\r\ndefine function ToString(value RequestStatus): value.value\r\ndefine function ToString(value ResearchElementType): value.value\r\ndefine function ToString(value ResearchStudyStatus): value.value\r\ndefine function ToString(value ResearchSubjectStatus): value.value\r\ndefine function ToString(value ResourceType): value.value\r\ndefine function ToString(value ResourceVersionPolicy): value.value\r\ndefine function ToString(value ResponseType): value.value\r\ndefine function ToString(value RestfulCapabilityMode): value.value\r\ndefine function ToString(value RiskAssessmentStatus): value.value\r\ndefine function ToString(value SPDXLicense): value.value\r\ndefine function ToString(value SearchComparator): value.value\r\ndefine function ToString(value SearchEntryMode): value.value\r\ndefine function ToString(value SearchModifierCode): value.value\r\ndefine function ToString(value SearchParamType): value.value\r\ndefine function ToString(value SectionMode): value.value\r\ndefine function ToString(value SequenceType): value.value\r\ndefine function ToString(value ServiceRequestIntent): value.value\r\ndefine function ToString(value ServiceRequestPriority): value.value\r\ndefine function ToString(value ServiceRequestStatus): value.value\r\ndefine function ToString(value SlicingRules): value.value\r\ndefine function ToString(value SlotStatus): value.value\r\ndefine function ToString(value SortDirection): value.value\r\ndefine function ToString(value SpecimenContainedPreference): value.value\r\ndefine function ToString(value SpecimenStatus): value.value\r\ndefine function ToString(value Status): value.value\r\ndefine function ToString(value StrandType): value.value\r\ndefine function ToString(value StructureDefinitionKind): value.value\r\ndefine function ToString(value StructureMapContextType): value.value\r\ndefine function ToString(value StructureMapGroupTypeMode): value.value\r\ndefine function ToString(value StructureMapInputMode): value.value\r\ndefine function ToString(value StructureMapModelMode): value.value\r\ndefine function ToString(value StructureMapSourceListMode): value.value\r\ndefine function ToString(value StructureMapTargetListMode): value.value\r\ndefine function ToString(value StructureMapTransform): value.value\r\ndefine function ToString(value SubscriptionChannelType): value.value\r\ndefine function ToString(value SubscriptionStatus): value.value\r\ndefine function ToString(value SupplyDeliveryStatus): value.value\r\ndefine function ToString(value SupplyRequestStatus): value.value\r\ndefine function ToString(value SystemRestfulInteraction): value.value\r\ndefine function ToString(value TaskIntent): value.value\r\ndefine function ToString(value TaskPriority): value.value\r\ndefine function ToString(value TaskStatus): value.value\r\ndefine function ToString(value TestReportActionResult): value.value\r\ndefine function ToString(value TestReportParticipantType): value.value\r\ndefine function ToString(value TestReportResult): value.value\r\ndefine function ToString(value TestReportStatus): value.value\r\ndefine function ToString(value TestScriptRequestMethodCode): value.value\r\ndefine function ToString(value TriggerType): value.value\r\ndefine function ToString(value TypeDerivationRule): value.value\r\ndefine function ToString(value TypeRestfulInteraction): value.value\r\ndefine function ToString(value UDIEntryType): value.value\r\ndefine function ToString(value UnitsOfTime): value.value\r\ndefine function ToString(value Use): value.value\r\ndefine function ToString(value VariableType): value.value\r\ndefine function ToString(value VisionBase): value.value\r\ndefine function ToString(value VisionEyes): value.value\r\ndefine function ToString(value VisionStatus): value.value\r\ndefine function ToString(value XPathUsageType): value.value\r\ndefine function ToString(value base64Binary): value.value\r\ndefine function ToBoolean(value boolean): value.value\r\ndefine function ToDate(value date): value.value\r\ndefine function ToDateTime(value dateTime): value.value\r\ndefine function ToDecimal(value decimal): value.value\r\ndefine function ToDateTime(value instant): value.value\r\ndefine function ToInteger(value integer): value.value\r\ndefine function ToString(value string): value.value\r\ndefine function ToTime(value time): value.value\r\ndefine function ToString(value uri): value.value\r\ndefine function ToString(value xhtml): value.value</code></pre>\n      </td>\n    </tr>\n    \n    \n    \n  \n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.4.8 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
      },
      "url": "https://madie.cms.gov/Library/FHIRHelpers",
      "identifier": [ {
        "use": "official",
        "system": "https://madie.cms.gov/login",
        "value": "660d90bc01598d085de46056"
      } ],
      "version": "4.4.000",
      "name": "FHIRHelpers",
      "title": "FHIRHelpers",
      "status": "active",
      "experimental": false,
      "type": {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/library-type",
          "code": "logic-library"
        } ]
      },
      "date": "2025-07-25T20:59:18+00:00",
      "publisher": "ICF",
      "description": "This library defines functions to convert between FHIR\n data types and CQL system-defined types, as well as functions to support\n FHIRPath implementation. For more information, the FHIRHelpers wiki page:\n https://github.com/cqframework/clinical_quality_language/wiki/FHIRHelpers",
      "relatedArtifact": [ {
        "type": "depends-on",
        "display": "FHIR model information",
        "resource": "http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1"
      } ],
      "content": [ {
        "contentType": "text/cql",
        "data": "[encoded data, 52440 characters]"
      }, {
        "contentType": "application/elm+xml",
        "data": "[encoded data, 1342916 characters]"
      }, {
        "contentType": "application/elm+json",
        "data": "[encoded data, 2177516 characters]"
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Library/FHIRHelpers"
    }
  } ]
}