{
  "resourceType": "Bundle",
  "type": "transaction",
  "entry": [ {
    "fullUrl": "https://madie.cms.gov/Measure/CMS68FHIRDocumentationCurrentMeds",
    "resource": {
      "resourceType": "Measure",
      "id": "CMS68FHIRDocumentationCurrentMeds",
      "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\">Documentation of Current Medications in the Medical RecordFHIR</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\">CMS68FHIR</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:8fbf4570-1db0-4d90-9900-39a7fa635c75</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:15214cf9-f81e-4f3a-9746-a6a7c0daa51d</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\">68FHIR</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\">Centers for Medicare &amp; Medicaid Services (CMS)</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\">American Institutes for Research (AIR)</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\"><p>Percentage of visits for which the eligible clinician attests to documenting a list of current medications using all immediate resources available on the date of the encounter</p></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\"><p>This electronic clinical quality measure (Measure) and related data specifications are owned and stewarded by the Centers for Medicare &amp; Medicaid Services (CMS). CMS contracted (Contract # 75FCMC18D0027/ Task Order #: 75FCMC24F0144) with the American Institutes for Research (AIR) to develop this electronic measure. AIR is not responsible for any use of the Measure. AIR makes no representations, warranties, or endorsement about the quality of any organization or physician that uses or reports performance measures and AIR has no liability to anyone who relies on such measures or specifications.</p>\n<p>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. AIR disclaims all liability for use or accuracy of any third-party codes contained in the specifications.</p>\n<p>CPT(R) contained in the Measure specifications is copyright 2004-2024 American Medical Association. LOINC(R) copyright 2004-2024 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation.</p></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\"><p>This performance Measure is not a clinical guideline, does not establish a standard of medical care, and has not been tested for all potential applications.</p>\n<p>THE MEASURE AND SPECIFICATIONS ARE PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND.</p>\n<p>Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].</p></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\"><p>According to the National Center for Health Statistics, during the years of 2013-2016, 48.4% of patients (both male and female) were prescribed at least one prescription medication with 12.6% taking 5 or more medications. Additionally, 89.8% of patients (both male and female) aged 65 years and older were prescribed at least one medication with 40.9% taking 5 or more medications (2018). In this context, maintaining an accurate and complete medication list has proven to be a challenging documentation endeavor for various health care provider settings. While most of outpatient encounters (two-thirds) result in providers prescribing at least one medication, hospitals have been the focus of medication safety efforts (Stock, Scott, &amp; Gurtel, 2009). Nassaralla, Naessens, Chaudhry, Hansen, and Scheitel (2007) caution that this is at odds with the current trend, where patients with chronic illnesses are increasingly being treated in the outpatient setting and require careful monitoring of multiple medications. Additionally, Nassaralla et al. (2007) reveal that it is in fact in outpatient settings where more fatal adverse drug events (ADE) occur when these are compared to those occurring in hospitals (1 of 131 outpatient deaths compared to 1 in 854 inpatient deaths). In the outpatient setting, ADEs occur 25% of the time and over one-third of these are considered preventable (Tache, Sonnichsen, &amp; Ashcroft, 2011). Particularly vulnerable are patients over 65 years, with evidence suggesting that the rate of ADEs per 10,000 person per year increases with age; 25-44 years old at 1.3; 45-64 at 2.2, and 65 + at 3.8 (Sarkar, López, Maselli, &amp; Gonzales, 2011). Other vulnerable groups include individuals who are chronically ill or disabled (Nabhanizadeh, Oppewal, Boot, &amp; Maes-Festen, 2019). These population groups are more likely to experience ADEs and subsequent hospitalization.</p>\n<p>A multiplicity of providers and inadequate care coordination among them has been identified as barriers to collecting complete and reliable medication records. A study conducted by Poornima et al. (2015) indicates that reconciliation and documentation continue to be poorly executed with discrepancies occurring in 92% of patients (74 of 80) admitted to the emergency room. Of 80 patients included in the study, the home medications were reordered for 65% of patients on their admission. Of the 65%, 29% had a change in their dosing interval, while 23% had a change in their route of administration, and 13% had a change in dose. A total of 361 medication discrepancies, or the difference between the medications patients were taking before admission and those listed in their admission orders, were identified in at least 74 patients. The study found that &quot;Through an appropriate reconciliation programme, around 80% of errors relating to medication and the potential harm caused by these errors could be reduced&quot; (Poornima et al., 2015). Presley et al. (2020) also recognized specific barriers to sufficient medication documentation and reconciliation in rural and resource-limited care settings.</p>\n<p>Documentation of current medications in the medical record facilitates the process of medication review and reconciliation by the provider, which is necessary for reducing ADEs and promoting medication safety. The need for provider to provider coordination regarding medication records, and the existing gap in implementation, is highlighted in the American Medical Association's Physician's Role in Medication Reconciliation, which states that &quot;critical patient information, including medical and medication histories, current medications the patient is receiving and taking, and sources of medications, is essential to the delivery of safe medical care. However, interruptions in the continuity of care and information gaps in patient health records are common and significantly affect patient outcomes&quot; (2007). This is because clinical decisions based on information that is incomplete and/or inaccurate are likely to lead to medication error and ADEs. Weeks, Corbette, and Stream (2010) noted similar barriers and identified the utilization of health information technology as an opportunity for facilitating the creation of universal medication lists. One 2015 meta-analysis showed an association between electronic health record (EHR) documentation with an overall risk ratio (RR) of 0.46 (95% CI = 0.38 to 0.55; P &lt; 0.001) and ADEs with an overall RR of 0.66 (95% CI = 0.44 to 0.99; P = 0.045). This meta-analysis provides evidence that the use of the EHR can improve the quality of healthcare delivered to patients by reducing medication errors and ADEs (Campanella et al., 2016).</p></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\"><p>The Joint Commission's 2023 Ambulatory Health Care National Patient Safety Goals guide clinicians to maintain and communicate accurate patient medication information (2023). Specifically, the section NPSG.03.06.01 &quot;Maintain and communicate accurate patient medication information&quot; states the following: &quot;Obtain and/or update information on the medications the patient is currently taking. This information is documented in a list or other format that is useful to those who manage medication. Compare the medication information the patient brought to the organization with the medications ordered for the patient by the organization in order to identify and resolve discrepancies.”</p>\n<p>The Joint Commission's 2023 Hospital National Patient Safety Goals also addressed documenting current medications (2023). Specifically, the section NPSG.03.06.01 &quot;Maintain and communicate accurate patient information&quot; states the following: &quot;Obtain information on the medications the patient is currently taking when they are admitted to the hospital or is seen in an outpatient setting. This information is documented in a list or other format that is useful to those who manage medications.&quot;</p>\n<p>The National Quality Forum's Safe Practices for Better Healthcare (2010), states the following: &quot;The healthcare organization must develop, reconcile, and communicate an accurate patient medication list throughout the continuum of care.&quot;</p></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 Medical Association. (2007). The physician’s role in medication reconciliation: Issues, strategies, and safety principles. https://www.doctutor.es/wp-content/uploads/2013/09/med-rec-monograph.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    Campanella, P., Lovato, E., Marone, C., Fallacara, L., Mancuso, A., Ricciardi, W., &amp; Specchia, M. L. (2016). The impact of electronic health records on health care quality: A systematic review and meta-analysis. European Journal of Public Health, 26(1), 60-64. https://doi.org/10.1093/eurpub/ckv122\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    Nabhanizadeh, A., Oppewal, A., Boot, F. H., &amp; Maes-Festen, D. (2019). Effectiveness of medication reviews in identifying and reducing medication-related problems among people with intellectual disabilities: A systematic review. Journal of Applied Research in Intellectual Disabilities, 32(4), 750–761. https://doi.org/10.1111/jar.12580\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    Nassaralla, C. L., Naessens, J. M., Chaudhry, R., Hansen, M. A., &amp; Scheitel, S. M. (2007). Implementation of a medication reconciliation process in an ambulatory internal medicine clinic. Quality and Safety in Health Care, 16(2), 90-94. http://doi.org/10.1136/qshc.2006.021113\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    National Center for Health Statistics. (2018). Health, United States, 2018: Supplementary Table 38. Prescription drug use in the past 30 days, by sex, race and Hispanic origin, and age: United States, selected years 1988–1994 through 2013–2016 Retrieved from https://www.cdc.gov/nchs/data/hus/2018/038.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    National Quality Forum. (2010). Safe Practices for Better Healthcare - 2010 Update. Retrieved from https://www.leapfroggroup.org/sites/default/files/Files/NQF%20Safe%20Practices%20for%20Better%20Healthcare%202010_0.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    Poornima, P., Reshma, P., Ramakrishnan, T. V., Rani, N. V., Devi, G. S., Seshadri, P. (2015). Medication reconciliation and medication error prevention in an emergency department of a tertiary care hospital. Journal of Young Pharmacists, 7(3), 241-249. https://www.jyoungpharm.org/sites/default/files/JYP_7_3_15.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    Presley, C. A., Wooldridge, K. T., Byerly, S. H., Aylor, A. R., Kaboli, P. J., Roumie, C. L., Schnipper, J. L., Dittus, R. S., Mixon, A. S. (2020). The Rural VA Multi-Center Medication Reconciliation Quality Improvement Study (R-VA-MARQUIS). American Journal of Health-System Pharmacy, 77, 128-137. https://doi.org/10.1093/ajhp/zxz275\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    Sarkar, U., López, A., Maselli, J. H., Gonzales, R. (2011). Adverse drug events in U.S. adult ambulatory medical care. Health Services Research, 46(5), 1517-1533. http://doi.org/10.1111/j.1475-6773.2011.01269.x\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    Stock, R., Scott, J., &amp; Gurtel, S. (2009). Using an electronic prescribing system to ensure accurate medication lists in a large multidisciplinary medical group. The Joint Commission Journal on Quality and Patient Safety, 35(5), 271-277\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    Tache, S. V., Sonnichsen, A., &amp; Ashcroft, D. M. (2011). Prevalence of adverse drug events in ambulatory care: A systematic review. The Annals of Pharmacotherapy, 45(7-8), 977-989. http://doi.org/10.1345/aph.1P627\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    The Joint Commission. (2023). Ambulatory Health Care: 2023 National Patient Safety Goals. https://www.jointcommission.org/-/media/tjc/documents/standards/national-patient-safety-goals/2023/npsg_chapter_ahc_jul2023.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    The Joint Commission. (2023). Hospital: 2023 National Patient Safety Goals. https://www.jointcommission.org/-/media/tjc/documents/standards/national-patient-safety-goals/2023/npsg_chapter_hap_jul2023.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    Weeks, D. L., Corbette, C. F., &amp; Stream, G. (2010). Beliefs of ambulatory care physicians about accuracy of patient medication records and technology-enhanced solutions to improve accuracy. Journal for Healthcare Quality, 32(5), 12-21. http://doi.org/10.1111/j.1945-1474.2010.00097.x\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\">Current Medications: <p>Medications the patient is presently taking including all prescriptions, over-the-counter products, herbals, vitamins, minerals, dietary (nutritional) supplements, and cannabis/cannabidiol (CBD) products with each medication's name, dosage, frequency and administered route</p></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\">Encounter to Document Medications: <p>An encounter performed during the measurement period where medications should be reviewed</p></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\">Route: <p>Documentation of the way the medication enters the body (some examples include but are not limited to: oral, sublingual, subcutaneous injections, and/or topical)</p></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\"><p>This eCQM is an episode-based measure. An episode is defined as each eligible encounter during the measurement period. This measure is to be reported for every eligible encounter during the measurement period.</p>\n<p>Eligible clinicians reporting this measure may document medication information received from the patient, authorized representative(s), caregiver(s) or other available healthcare resources.</p>\n<p>By reporting the action described in this measure, the provider attests to having documented a list of current medications utilizing all immediate resources available on the day of the encounter.</p>\n<p>This list must include all known prescriptions, over-the-counter products, herbals, vitamins, minerals, dietary (nutritional) supplements, cannabis/cannabidiol (CBD) products AND must contain the medications' name, dosage, frequency, and route of administration.</p>\n<p>This measure should also be reported if the eligible clinician documented the patient is not currently taking any medications.</p>\n<p>This FHIR-based measure has been derived from the QDM-based measure CMS 68v15. 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).</p></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<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Summary</th>\n\n\n<td class=\"content-container\"><p>Percentage of visits for which the eligible clinician attests to documenting a list of current medications using all immediate resources available on the date of the encounter</p></td>\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\">Encounter</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  \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\"><p>All visits occurring during the 12-month measurement period</p></p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms68fhirdocumentationcurrentmeds-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\"><p>Equals Initial Population</p></p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms68fhirdocumentationcurrentmeds-denominator\">Denominator</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\"><p>Eligible clinician attests to documenting the patient's current medications using all immediate resources available on the date of the encounter</p></p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms68fhirdocumentationcurrentmeds-numerator\">Numerator</a> \n          \n        \n      </td>\n    </tr>\n  \n\n  \n    <tr>\n      \n        \n\n<th scope=\"row\" class=\"row-header\">Denominator Exception</th>\n\n\n      \n      <td class=\"content-container\">\n        \n        <em>ID</em>: DenominatorException_1\n        <br/>\n        \n        \n          <em>Description</em>:\n          <p style=\"white-space: pre-line\" class=\"tab-one\"><p>Documentation of acute health crisis where time is of the essence and delay of treatment would jeopardize the patient's health status</p></p>\n        \n        \n          \n            \n            <em>Logic Definition</em>: <a href=\"#primary-cms68fhirdocumentationcurrentmeds-denominator-exceptions\">Denominator Exceptions</a> \n          \n        \n      </td>\n    </tr>\n  \n\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=\"#cms68fhirdocumentationcurrentmeds-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=\"#cms68fhirdocumentationcurrentmeds-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=\"#cms68fhirdocumentationcurrentmeds-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=\"#cms68fhirdocumentationcurrentmeds-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/CMS68FHIRDocumentationCurrentMeds</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            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms68fhirdocumentationcurrentmeds-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  &quot;Qualifying Encounter During Day of Measurement Period&quot; QualifyingEncounter</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            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms68fhirdocumentationcurrentmeds-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            <tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"primary-cms68fhirdocumentationcurrentmeds-numerator\"> </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&quot;:\n  &quot;Qualifying Encounter During Day of Measurement Period&quot; QualifyingEncounter\n    with [Procedure: &quot;Documentation of current medications (procedure)&quot;] MedicationsDocumented\n      such that MedicationsDocumented.performed.toInterval ( ) starts during day of QualifyingEncounter.period\n        and MedicationsDocumented.performed.toInterval ( ).hasEnd ( )\n        and MedicationsDocumented.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        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n          \n        \n      \n    \n  \n\n  \n    \n      \n        \n          \n        \n          \n        \n          \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-cms68fhirdocumentationcurrentmeds-denominator-exceptions\"> </a>\n    \n    \n    Denominator Exception\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 Exceptions&quot;:\n  &quot;Qualifying Encounter During Day of Measurement Period&quot; QualifyingEncounter\n    with [ProcedureNotDone: code ~ &quot;Documentation of current medications (procedure)&quot;] MedicationsNotDocumented\n      such that MedicationsNotDocumented.recorded during day of QualifyingEncounter.period\n        and MedicationsNotDocumented.status = 'not-done'\n        and exists ( MedicationsNotDocumented.reasonCode reasonItem\n            where reasonItem ~ &quot;Acute health crisis (finding)&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  <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<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<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<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<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<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms68fhirdocumentationcurrentmeds-sde-sex\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS68FHIRDocumentationCurrentMeds</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=\"cms68fhirdocumentationcurrentmeds-qualifying-encounter-during-day-of-measurement-period\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS68FHIRDocumentationCurrentMeds</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 Encounter During Day of Measurement Period&quot;:\n  [&quot;Encounter&quot;: &quot;Encounter to Document Medications&quot;] ValidEncounter\n    where ValidEncounter.status = 'finished'\n      and ValidEncounter.period during day of &quot;Measurement Period&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=\"cms68fhirdocumentationcurrentmeds-numerator\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS68FHIRDocumentationCurrentMeds</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&quot;:\n  &quot;Qualifying Encounter During Day of Measurement Period&quot; QualifyingEncounter\n    with [Procedure: &quot;Documentation of current medications (procedure)&quot;] MedicationsDocumented\n      such that MedicationsDocumented.performed.toInterval ( ) starts during day of QualifyingEncounter.period\n        and MedicationsDocumented.performed.toInterval ( ).hasEnd ( )\n        and MedicationsDocumented.status = 'completed'</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=\"cms68fhirdocumentationcurrentmeds-initial-population\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS68FHIRDocumentationCurrentMeds</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  &quot;Qualifying Encounter During Day of Measurement Period&quot; QualifyingEncounter</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=\"cms68fhirdocumentationcurrentmeds-denominator\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS68FHIRDocumentationCurrentMeds</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\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms68fhirdocumentationcurrentmeds-sde-payer\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS68FHIRDocumentationCurrentMeds</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\n        \n\n\n<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms68fhirdocumentationcurrentmeds-sde-ethnicity\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS68FHIRDocumentationCurrentMeds</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=\"cms68fhirdocumentationcurrentmeds-sde-race\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS68FHIRDocumentationCurrentMeds</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<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"cms68fhirdocumentationcurrentmeds-denominator-exceptions\"> </a>\n    \n    Logic Definition\n  </th>\n\n  <td class=\"content-container\"><em>Library Name:</em> CMS68FHIRDocumentationCurrentMeds</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 Exceptions&quot;:\n  &quot;Qualifying Encounter During Day of Measurement Period&quot; QualifyingEncounter\n    with [ProcedureNotDone: code ~ &quot;Documentation of current medications (procedure)&quot;] MedicationsNotDocumented\n      such that MedicationsNotDocumented.recorded during day of QualifyingEncounter.period\n        and MedicationsNotDocumented.status = 'not-done'\n        and exists ( MedicationsNotDocumented.reasonCode reasonItem\n            where reasonItem ~ &quot;Acute health crisis (finding)&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\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<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"qicorecommon-hasend\"> </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: 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  )</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=\"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<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<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<tr>\n  <th scope=\"row\" rowspan=\"2\" class=\"row-header\">\n    \n      \n      <a name=\"fhirhelpers-toconcept\"> </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 [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.\n*/\ndefine function ToConcept(concept FHIR.CodeableConcept):\n    if concept is null then\n        null\n    else\n        System.Concept {\n            codes: concept.coding C return ToCode(C),\n            display: concept.text.value\n        }</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<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<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 to Document Medications\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.600.1.1834\n    <br/>\n    <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1834</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  \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>: Documentation of current medications (procedure)\n        <br/>\n      \n      <em>Code</em>: 428191000124101\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>: Acute health crisis (finding)\n        <br/>\n      \n      <em>Code</em>: 705016005\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 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\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.600.1.1834\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  \n    <span class=\"tab-one\"><em>Code(s)</em>: \n    \n      \n      http://snomed.info/sct#428191000124101: 'Documentation of current medications (procedure)'\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>: 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>: Procedure\n    <br/>\n  \n    <em>Profile(s)</em>: \n  \n    http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, extension, status, status.value, reasonCode\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://snomed.info/sct#428191000124101: 'Documentation of current medications (procedure)'\n      \n    \n    </span>\n    <br/>\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://snomed.info/sct",
            "code": "428191000124101",
            "display": "Documentation of current medications (procedure)"
          }
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
          "valueCoding": {
            "system": "http://snomed.info/sct",
            "code": "705016005",
            "display": "Acute health crisis (finding)"
          }
        }, {
          "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": "CMS68FHIRDocumentationCurrentMeds"
          }, {
            "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": "CMS68FHIRDocumentationCurrentMeds"
          }, {
            "url": "name",
            "valueString": "Qualifying Encounter During Day of Measurement Period"
          }, {
            "url": "statement",
            "valueString": "define \"Qualifying Encounter During Day of Measurement Period\":\n  [\"Encounter\": \"Encounter to Document Medications\"] ValidEncounter\n    where ValidEncounter.status = 'finished'\n      and ValidEncounter.period during day of \"Measurement Period\""
          }, {
            "url": "displaySequence",
            "valueInteger": 2
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS68FHIRDocumentationCurrentMeds"
          }, {
            "url": "name",
            "valueString": "Numerator"
          }, {
            "url": "statement",
            "valueString": "define \"Numerator\":\n  \"Qualifying Encounter During Day of Measurement Period\" QualifyingEncounter\n    with [Procedure: \"Documentation of current medications (procedure)\"] MedicationsDocumented\n      such that MedicationsDocumented.performed.toInterval ( ) starts during day of QualifyingEncounter.period\n        and MedicationsDocumented.performed.toInterval ( ).hasEnd ( )\n        and MedicationsDocumented.status = 'completed'"
          }, {
            "url": "displaySequence",
            "valueInteger": 3
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS68FHIRDocumentationCurrentMeds"
          }, {
            "url": "name",
            "valueString": "Initial Population"
          }, {
            "url": "statement",
            "valueString": "define \"Initial Population\":\n  \"Qualifying Encounter During Day of Measurement Period\" QualifyingEncounter"
          }, {
            "url": "displaySequence",
            "valueInteger": 4
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS68FHIRDocumentationCurrentMeds"
          }, {
            "url": "name",
            "valueString": "Denominator"
          }, {
            "url": "statement",
            "valueString": "define \"Denominator\":\n  \"Initial Population\""
          }, {
            "url": "displaySequence",
            "valueInteger": 5
          } ]
        }, {
          "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": 6
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS68FHIRDocumentationCurrentMeds"
          }, {
            "url": "name",
            "valueString": "SDE Payer"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Payer\":\n  SDE.\"SDE Payer\""
          }, {
            "url": "displaySequence",
            "valueInteger": 7
          } ]
        }, {
          "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": 8
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS68FHIRDocumentationCurrentMeds"
          }, {
            "url": "name",
            "valueString": "SDE Ethnicity"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Ethnicity\":\n  SDE.\"SDE Ethnicity\""
          }, {
            "url": "displaySequence",
            "valueInteger": 9
          } ]
        }, {
          "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": 10
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS68FHIRDocumentationCurrentMeds"
          }, {
            "url": "name",
            "valueString": "SDE Race"
          }, {
            "url": "statement",
            "valueString": "define \"SDE Race\":\n  SDE.\"SDE Race\""
          }, {
            "url": "displaySequence",
            "valueInteger": 11
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "CMS68FHIRDocumentationCurrentMeds"
          }, {
            "url": "name",
            "valueString": "Denominator Exceptions"
          }, {
            "url": "statement",
            "valueString": "define \"Denominator Exceptions\":\n  \"Qualifying Encounter During Day of Measurement Period\" QualifyingEncounter\n    with [ProcedureNotDone: code ~ \"Documentation of current medications (procedure)\"] MedicationsNotDocumented\n      such that MedicationsNotDocumented.recorded during day of QualifyingEncounter.period\n        and MedicationsNotDocumented.status = 'not-done'\n        and exists ( MedicationsNotDocumented.reasonCode reasonItem\n            where reasonItem ~ \"Acute health crisis (finding)\"\n        )"
          }, {
            "url": "displaySequence",
            "valueInteger": 12
          } ]
        }, {
          "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": 13
          } ]
        }, {
          "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": 14
          } ]
        }, {
          "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": 15
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "QICoreCommon"
          }, {
            "url": "name",
            "valueString": "hasEnd"
          }, {
            "url": "statement",
            "valueString": "/*\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<DateTime> ):\n  not (\n    end of period is null\n      or end of period = maximum DateTime\n  )"
          }, {
            "url": "displaySequence",
            "valueInteger": 16
          } ]
        }, {
          "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": 17
          } ]
        }, {
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition",
          "extension": [ {
            "url": "libraryName",
            "valueString": "FHIRHelpers"
          }, {
            "url": "name",
            "valueString": "ToConcept"
          }, {
            "url": "statement",
            "valueString": "/*\n@description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.\n*/\ndefine function ToConcept(concept FHIR.CodeableConcept):\n    if concept is null then\n        null\n    else\n        System.Concept {\n            codes: concept.coding C return ToCode(C),\n            display: concept.text.value\n        }"
          }, {
            "url": "displaySequence",
            "valueInteger": 18
          } ]
        } ],
        "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 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": "Value set Encounter to Document Medications",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1834"
        }, {
          "type": "depends-on",
          "display": "Value set Payer Type",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
        } ],
        "parameter": [ {
          "name": "Measurement Period",
          "use": "in",
          "min": 0,
          "max": "1",
          "type": "Period"
        }, {
          "name": "Numerator",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        }, {
          "name": "Denominator",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        }, {
          "name": "Initial Population",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        }, {
          "name": "Denominator Exceptions",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        }, {
          "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"
        } ],
        "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.600.1.1834"
          } ]
        }, {
          "type": "Procedure",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
          "mustSupport": [ "code", "performed", "status", "status.value" ],
          "codeFilter": [ {
            "path": "code",
            "code": [ {
              "system": "http://snomed.info/sct",
              "code": "428191000124101",
              "display": "Documentation of current medications (procedure)"
            } ]
          } ]
        }, {
          "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": "Procedure",
          "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone" ],
          "mustSupport": [ "code", "extension", "status", "status.value", "reasonCode" ],
          "codeFilter": [ {
            "path": "code",
            "code": [ {
              "system": "http://snomed.info/sct",
              "code": "428191000124101",
              "display": "Documentation of current medications (procedure)"
            } ]
          } ]
        } ]
      } ],
      "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": "Current Medications"
        }, {
          "url": "definition",
          "valueMarkdown": "Medications the patient is presently taking including all prescriptions, over-the-counter products, herbals, vitamins, minerals, dietary (nutritional) supplements, and cannabis/cannabidiol (CBD) products with each medication's name, dosage, frequency and administered route\n"
        } ]
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-definitionTerm",
        "extension": [ {
          "url": "term",
          "valueString": "Encounter to Document Medications"
        }, {
          "url": "definition",
          "valueMarkdown": "An encounter performed during the measurement period where medications should be reviewed\n"
        } ]
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-definitionTerm",
        "extension": [ {
          "url": "term",
          "valueString": "Route"
        }, {
          "url": "definition",
          "valueMarkdown": "Documentation of the way the medication enters the body (some examples include but are not limited to: oral, sublingual, subcutaneous injections, and/or topical)\n"
        } ]
      }, {
        "url": "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements",
        "valueReference": {
          "reference": "#effective-data-requirements"
        }
      } ],
      "url": "https://madie.cms.gov/Measure/CMS68FHIRDocumentationCurrentMeds",
      "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": "CMS68FHIR"
      }, {
        "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:8fbf4570-1db0-4d90-9900-39a7fa635c75"
      }, {
        "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:15214cf9-f81e-4f3a-9746-a6a7c0daa51d"
      }, {
        "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": "68FHIR",
        "assigner": {
          "display": "CMS"
        }
      } ],
      "version": "1.0.000",
      "name": "CMS68FHIRDocumentationCurrentMeds",
      "title": "Documentation of Current Medications in the Medical RecordFHIR\n",
      "status": "active",
      "experimental": false,
      "date": "2025-08-21T13:34:21+00:00",
      "publisher": "Centers for Medicare &amp; Medicaid Services (CMS)",
      "contact": [ {
        "telecom": [ {
          "system": "url",
          "value": "https://www.cms.gov/"
        } ]
      } ],
      "description": "Percentage of visits for which the eligible clinician attests to documenting a list of current medications using all immediate resources available on the date of the encounter\n",
      "usage": "This eCQM is an episode-based measure. An episode is defined as each eligible encounter during the measurement period. This measure is to be reported for every eligible encounter during the measurement period.\n\nEligible clinicians reporting this measure may document medication information received from the patient, authorized representative(s), caregiver(s) or other available healthcare resources.\n\nBy reporting the action described in this measure, the provider attests to having documented a list of current medications utilizing all immediate resources available on the day of the encounter.\n\nThis list must include all known prescriptions, over-the-counter products, herbals, vitamins, minerals, dietary (nutritional) supplements, cannabis/cannabidiol (CBD) products AND must contain the medications' name, dosage, frequency, and route of administration.\n\nThis measure should also be reported if the eligible clinician documented the patient is not currently taking any medications.\n\nThis FHIR-based measure has been derived from the QDM-based measure CMS 68v15. 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).\n",
      "copyright": "This electronic clinical quality measure (Measure) and related data specifications are owned and stewarded by the Centers for Medicare \\& Medicaid Services (CMS). CMS contracted (Contract # 75FCMC18D0027/ Task Order #: 75FCMC24F0144) with the American Institutes for Research (AIR) to develop this electronic measure. AIR is not responsible for any use of the Measure. AIR makes no representations, warranties, or endorsement about the quality of any organization or physician that uses or reports performance measures and AIR has no liability to anyone who relies on such measures or specifications.\n\nLimited 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. AIR disclaims all liability for use or accuracy of any third-party codes contained in the specifications.\n\nCPT(R) contained in the Measure specifications is copyright 2004-2024 American Medical Association. LOINC(R) copyright 2004-2024 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT\\[R\\]) copyright 2004-2024 International Health Terminology Standards Development Organisation.\n",
      "effectivePeriod": {
        "start": "2026-01-01",
        "end": "2026-12-31"
      },
      "author": [ {
        "name": "American Institutes for Research (AIR)",
        "telecom": [ {
          "system": "url",
          "value": "https://www.air.org"
        } ]
      } ],
      "relatedArtifact": [ {
        "type": "citation",
        "citation": "American Medical Association. (2007). The physician's role in medication reconciliation: Issues, strategies, and safety principles. https://www.doctutor.es/wp-content/uploads/2013/09/med-rec-monograph.pdf\n"
      }, {
        "type": "citation",
        "citation": "Campanella, P., Lovato, E., Marone, C., Fallacara, L., Mancuso, A., Ricciardi, W., \\& Specchia, M. L. (2016). The impact of electronic health records on health care quality: A systematic review and meta-analysis. European Journal of Public Health, 26(1), 60-64. https://doi.org/10.1093/eurpub/ckv122\n"
      }, {
        "type": "citation",
        "citation": "Nabhanizadeh, A., Oppewal, A., Boot, F. H., \\& Maes-Festen, D. (2019). Effectiveness of medication reviews in identifying and reducing medication-related problems among people with intellectual disabilities: A systematic review. Journal of Applied Research in Intellectual Disabilities, 32(4), 750--761. https://doi.org/10.1111/jar.12580\n"
      }, {
        "type": "citation",
        "citation": "Nassaralla, C. L., Naessens, J. M., Chaudhry, R., Hansen, M. A., \\& Scheitel, S. M. (2007). Implementation of a medication reconciliation process in an ambulatory internal medicine clinic. Quality and Safety in Health Care, 16(2), 90-94. http://doi.org/10.1136/qshc.2006.021113\n"
      }, {
        "type": "citation",
        "citation": "National Center for Health Statistics. (2018). Health, United States, 2018: Supplementary Table 38. Prescription drug use in the past 30 days, by sex, race and Hispanic origin, and age: United States, selected years 1988--1994 through 2013--2016 Retrieved from https://www.cdc.gov/nchs/data/hus/2018/038.pdf\n"
      }, {
        "type": "citation",
        "citation": "National Quality Forum. (2010). Safe Practices for Better Healthcare - 2010 Update. Retrieved from https://www.leapfroggroup.org/sites/default/files/Files/NQF%20Safe%20Practices%20for%20Better%20Healthcare%202010_0.pdf\n"
      }, {
        "type": "citation",
        "citation": "Poornima, P., Reshma, P., Ramakrishnan, T. V., Rani, N. V., Devi, G. S., Seshadri, P. (2015). Medication reconciliation and medication error prevention in an emergency department of a tertiary care hospital. Journal of Young Pharmacists, 7(3), 241-249. https://www.jyoungpharm.org/sites/default/files/JYP_7_3_15.pdf\n"
      }, {
        "type": "citation",
        "citation": "Presley, C. A., Wooldridge, K. T., Byerly, S. H., Aylor, A. R., Kaboli, P. J., Roumie, C. L., Schnipper, J. L., Dittus, R. S., Mixon, A. S. (2020). The Rural VA Multi-Center Medication Reconciliation Quality Improvement Study (R-VA-MARQUIS). American Journal of Health-System Pharmacy, 77, 128-137. https://doi.org/10.1093/ajhp/zxz275\n"
      }, {
        "type": "citation",
        "citation": "Sarkar, U., López, A., Maselli, J. H., Gonzales, R. (2011). Adverse drug events in U.S. adult ambulatory medical care. Health Services Research, 46(5), 1517-1533. http://doi.org/10.1111/j.1475-6773.2011.01269.x\n"
      }, {
        "type": "citation",
        "citation": "Stock, R., Scott, J., \\& Gurtel, S. (2009). Using an electronic prescribing system to ensure accurate medication lists in a large multidisciplinary medical group. The Joint Commission Journal on Quality and Patient Safety, 35(5), 271-277\n"
      }, {
        "type": "citation",
        "citation": "Tache, S. V., Sonnichsen, A., \\& Ashcroft, D. M. (2011). Prevalence of adverse drug events in ambulatory care: A systematic review. The Annals of Pharmacotherapy, 45(7-8), 977-989. http://doi.org/10.1345/aph.1P627\n"
      }, {
        "type": "citation",
        "citation": "The Joint Commission. (2023). Ambulatory Health Care: 2023 National Patient Safety Goals. https://www.jointcommission.org/-/media/tjc/documents/standards/national-patient-safety-goals/2023/npsg_chapter_ahc_jul2023.pdf\n"
      }, {
        "type": "citation",
        "citation": "The Joint Commission. (2023). Hospital: 2023 National Patient Safety Goals. https://www.jointcommission.org/-/media/tjc/documents/standards/national-patient-safety-goals/2023/npsg_chapter_hap_jul2023.pdf\n"
      }, {
        "type": "citation",
        "citation": "Weeks, D. L., Corbette, C. F., \\& Stream, G. (2010). Beliefs of ambulatory care physicians about accuracy of patient medication records and technology-enhanced solutions to improve accuracy. Journal for Healthcare Quality, 32(5), 12-21. http://doi.org/10.1111/j.1945-1474.2010.00097.x\n"
      } ],
      "library": [ "https://madie.cms.gov/Library/CMS68FHIRDocumentationCurrentMeds" ],
      "disclaimer": "This performance Measure is not a clinical guideline, does not establish a standard of medical care, and has not been tested for all potential applications.\n\nTHE MEASURE AND SPECIFICATIONS ARE PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND.\n\nDue to technical limitations, registered trademarks are indicated by (R) or \\[R\\] and unregistered trademarks are indicated by (TM) or \\[TM\\].\n",
      "rationale": "According to the National Center for Health Statistics, during the years of 2013-2016, 48.4% of patients (both male and female) were prescribed at least one prescription medication with 12.6% taking 5 or more medications. Additionally, 89.8% of patients (both male and female) aged 65 years and older were prescribed at least one medication with 40.9% taking 5 or more medications (2018). In this context, maintaining an accurate and complete medication list has proven to be a challenging documentation endeavor for various health care provider settings. While most of outpatient encounters (two-thirds) result in providers prescribing at least one medication, hospitals have been the focus of medication safety efforts (Stock, Scott, \\& Gurtel, 2009). Nassaralla, Naessens, Chaudhry, Hansen, and Scheitel (2007) caution that this is at odds with the current trend, where patients with chronic illnesses are increasingly being treated in the outpatient setting and require careful monitoring of multiple medications. Additionally, Nassaralla et al. (2007) reveal that it is in fact in outpatient settings where more fatal adverse drug events (ADE) occur when these are compared to those occurring in hospitals (1 of 131 outpatient deaths compared to 1 in 854 inpatient deaths). In the outpatient setting, ADEs occur 25% of the time and over one-third of these are considered preventable (Tache, Sonnichsen, \\& Ashcroft, 2011). Particularly vulnerable are patients over 65 years, with evidence suggesting that the rate of ADEs per 10,000 person per year increases with age; 25-44 years old at 1.3; 45-64 at 2.2, and 65 + at 3.8 (Sarkar, López, Maselli, \\& Gonzales, 2011). Other vulnerable groups include individuals who are chronically ill or disabled (Nabhanizadeh, Oppewal, Boot, \\& Maes-Festen, 2019). These population groups are more likely to experience ADEs and subsequent hospitalization.\n\nA multiplicity of providers and inadequate care coordination among them has been identified as barriers to collecting complete and reliable medication records. A study conducted by Poornima et al. (2015) indicates that reconciliation and documentation continue to be poorly executed with discrepancies occurring in 92% of patients (74 of 80) admitted to the emergency room. Of 80 patients included in the study, the home medications were reordered for 65% of patients on their admission. Of the 65%, 29% had a change in their dosing interval, while 23% had a change in their route of administration, and 13% had a change in dose. A total of 361 medication discrepancies, or the difference between the medications patients were taking before admission and those listed in their admission orders, were identified in at least 74 patients. The study found that \"Through an appropriate reconciliation programme, around 80% of errors relating to medication and the potential harm caused by these errors could be reduced\" (Poornima et al., 2015). Presley et al. (2020) also recognized specific barriers to sufficient medication documentation and reconciliation in rural and resource-limited care settings.\n\nDocumentation of current medications in the medical record facilitates the process of medication review and reconciliation by the provider, which is necessary for reducing ADEs and promoting medication safety. The need for provider to provider coordination regarding medication records, and the existing gap in implementation, is highlighted in the American Medical Association's Physician's Role in Medication Reconciliation, which states that \"critical patient information, including medical and medication histories, current medications the patient is receiving and taking, and sources of medications, is essential to the delivery of safe medical care. However, interruptions in the continuity of care and information gaps in patient health records are common and significantly affect patient outcomes\" (2007). This is because clinical decisions based on information that is incomplete and/or inaccurate are likely to lead to medication error and ADEs. Weeks, Corbette, and Stream (2010) noted similar barriers and identified the utilization of health information technology as an opportunity for facilitating the creation of universal medication lists. One 2015 meta-analysis showed an association between electronic health record (EHR) documentation with an overall risk ratio (RR) of 0.46 (95% CI = 0.38 to 0.55; P \\< 0.001) and ADEs with an overall RR of 0.66 (95% CI = 0.44 to 0.99; P = 0.045). This meta-analysis provides evidence that the use of the EHR can improve the quality of healthcare delivered to patients by reducing medication errors and ADEs (Campanella et al., 2016).\n",
      "clinicalRecommendationStatement": "The Joint Commission's 2023 Ambulatory Health Care National Patient Safety Goals guide clinicians to maintain and communicate accurate patient medication information (2023). Specifically, the section NPSG.03.06.01 \"Maintain and communicate accurate patient medication information\" states the following: \"Obtain and/or update information on the medications the patient is currently taking. This information is documented in a list or other format that is useful to those who manage medication. Compare the medication information the patient brought to the organization with the medications ordered for the patient by the organization in order to identify and resolve discrepancies.\"\n\nThe Joint Commission's 2023 Hospital National Patient Safety Goals also addressed documenting current medications (2023). Specifically, the section NPSG.03.06.01 \"Maintain and communicate accurate patient information\" states the following: \"Obtain information on the medications the patient is currently taking when they are admitted to the hospital or is seen in an outpatient setting. This information is documented in a list or other format that is useful to those who manage medications.\"\n\nThe National Quality Forum's Safe Practices for Better Healthcare (2010), states the following: \"The healthcare organization must develop, reconcile, and communicate an accurate patient medication list throughout the continuum of care.\"\n",
      "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": "Encounter"
        }, {
          "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-improvementNotation",
          "valueCodeableConcept": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation",
              "code": "increase",
              "display": "Increased score indicates improvement"
            } ]
          }
        } ],
        "description": "Percentage of visits for which the eligible clinician attests to documenting a list of current medications using all immediate resources available on the date of the encounter\n",
        "population": [ {
          "id": "InitialPopulation_1",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "initial-population",
              "display": "Initial Population"
            } ]
          },
          "description": "All visits occurring during the 12-month measurement period\n",
          "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\n",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Denominator"
          }
        }, {
          "id": "Numerator_1",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "numerator",
              "display": "Numerator"
            } ]
          },
          "description": "Eligible clinician attests to documenting the patient's current medications using all immediate resources available on the date of the encounter\n",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Numerator"
          }
        }, {
          "id": "DenominatorException_1",
          "code": {
            "coding": [ {
              "system": "http://terminology.hl7.org/CodeSystem/measure-population",
              "code": "denominator-exception",
              "display": "Denominator Exception"
            } ]
          },
          "description": "Documentation of acute health crisis where time is of the essence and delay of treatment would jeopardize the patient's health status\n",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Denominator Exceptions"
          }
        } ]
      } ],
      "supplementalData": [ {
        "id": "sde-ethnicity",
        "usage": [ {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
            "code": "supplemental-data"
          } ]
        } ],
        "description": "SDE Ethnicity\n",
        "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\n",
        "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\n",
        "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\n",
        "criteria": {
          "language": "text/cql-identifier",
          "expression": "SDE Sex"
        }
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Measure/CMS68FHIRDocumentationCurrentMeds"
    }
  }, {
    "fullUrl": "https://madie.cms.gov/Library/CMS68FHIRDocumentationCurrentMeds",
    "resource": {
      "resourceType": "Library",
      "id": "CMS68FHIRDocumentationCurrentMeds",
      "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\">CMS68FHIRDocumentationCurrentMeds</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\">CMS68FHIRDocumentationCurrentMeds</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\">Centers for Medicare &amp; Medicaid Services (CMS)</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\">CMS68FHIRDocumentationCurrentMeds</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>: 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  \n    <span class=\"tab-one\"><em>Code(s)</em>: \n    \n      \n      http://snomed.info/sct#428191000124101: 'Documentation of current medications (procedure)'\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>: 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.600.1.1834\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-procedurenotdone\n    <br/>        \n  \n   \n   \n    <em>Must Support Elements</em>: code, extension, status, status.value, reasonCode\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://snomed.info/sct#428191000124101: 'Documentation of current medications (procedure)'\n      \n    \n    </span>\n    <br/>\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 CMS68FHIRDocumentationCurrentMeds 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\n\r\ncodesystem &quot;SNOMEDCT&quot;: 'http://snomed.info/sct'\r\n\r\nvalueset &quot;Encounter to Document Medications&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1834'\r\n\r\ncode &quot;Acute health crisis (finding)&quot;: '705016005' from &quot;SNOMEDCT&quot; display 'Acute health crisis (finding)'\r\ncode &quot;Documentation of current medications (procedure)&quot;: '428191000124101' from &quot;SNOMEDCT&quot; display 'Documentation of current medications (procedure)'\r\n\r\nparameter &quot;Measurement Period&quot; Interval&lt;DateTime&gt;\r\n\r\ncontext Patient\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;Denominator&quot;:\r\n  &quot;Initial Population&quot;\r\n\r\ndefine &quot;Qualifying Encounter During Day of Measurement Period&quot;:\r\n  [&quot;Encounter&quot;: &quot;Encounter to Document Medications&quot;] ValidEncounter\r\n    where ValidEncounter.status = 'finished'\r\n      and ValidEncounter.period during day of &quot;Measurement Period&quot;\r\n\r\ndefine &quot;Initial Population&quot;:\r\n  &quot;Qualifying Encounter During Day of Measurement Period&quot; QualifyingEncounter\r\n\r\ndefine &quot;Numerator&quot;:\r\n  &quot;Qualifying Encounter During Day of Measurement Period&quot; QualifyingEncounter\r\n    with [Procedure: &quot;Documentation of current medications (procedure)&quot;] MedicationsDocumented\r\n      such that MedicationsDocumented.performed.toInterval ( ) starts during day of QualifyingEncounter.period\r\n        and MedicationsDocumented.performed.toInterval ( ).hasEnd ( )\r\n        and MedicationsDocumented.status = 'completed'\r\n\r\ndefine &quot;Denominator Exceptions&quot;:\r\n  &quot;Qualifying Encounter During Day of Measurement Period&quot; QualifyingEncounter\r\n    with [ProcedureNotDone: code ~ &quot;Documentation of current medications (procedure)&quot;] MedicationsNotDocumented\r\n      such that MedicationsNotDocumented.recorded during day of QualifyingEncounter.period\r\n        and MedicationsNotDocumented.status = 'not-done'\r\n        and exists ( MedicationsNotDocumented.reasonCode reasonItem\r\n            where reasonItem ~ &quot;Acute health crisis (finding)&quot;\r\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": "705016005",
          "display": "Acute health crisis (finding)"
        }
      }, {
        "url": "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
        "valueCoding": {
          "system": "http://snomed.info/sct",
          "code": "428191000124101",
          "display": "Documentation of current medications (procedure)"
        }
      } ],
      "url": "https://madie.cms.gov/Library/CMS68FHIRDocumentationCurrentMeds",
      "identifier": [ {
        "use": "official",
        "system": "https://madie.cms.gov/login",
        "value": "CMS68FHIRDocumentationCurrentMeds"
      } ],
      "version": "1.0.000",
      "name": "CMS68FHIRDocumentationCurrentMeds",
      "title": "CMS68FHIRDocumentationCurrentMeds",
      "status": "active",
      "experimental": false,
      "type": {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/library-type",
          "code": "logic-library"
        } ]
      },
      "date": "2025-08-21T13:34:24+00:00",
      "publisher": "Centers for Medicare & Medicaid Services (CMS)",
      "description": "CMS68FHIRDocumentationCurrentMeds",
      "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 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": "Value set Encounter to Document Medications",
        "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1834"
      } ],
      "dataRequirement": [ {
        "type": "Procedure",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure" ],
        "mustSupport": [ "code", "performed", "status", "status.value" ],
        "codeFilter": [ {
          "path": "code",
          "code": [ {
            "system": "http://snomed.info/sct",
            "code": "428191000124101",
            "display": "Documentation of current medications (procedure)"
          } ]
        } ]
      }, {
        "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.600.1.1834"
        } ]
      }, {
        "type": "Procedure",
        "profile": [ "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone" ],
        "mustSupport": [ "code", "extension", "status", "status.value", "reasonCode" ],
        "codeFilter": [ {
          "path": "code",
          "code": [ {
            "system": "http://snomed.info/sct",
            "code": "428191000124101",
            "display": "Documentation of current medications (procedure)"
          } ]
        } ]
      } ],
      "content": [ {
        "contentType": "text/cql",
        "data": "bGlicmFyeSBDTVM2OEZISVJEb2N1bWVudGF0aW9uQ3VycmVudE1lZHMgdmVyc2lvbiAnMS4wLjAwMCcNCg0KdXNpbmcgUUlDb3JlIHZlcnNpb24gJzYuMC4wJw0KDQppbmNsdWRlIEZISVJIZWxwZXJzIHZlcnNpb24gJzQuNC4wMDAnIGNhbGxlZCBGSElSSGVscGVycw0KaW5jbHVkZSBRSUNvcmVDb21tb24gdmVyc2lvbiAnNC4wLjAwMCcgY2FsbGVkIFFJQ29yZUNvbW1vbg0KaW5jbHVkZSBTdXBwbGVtZW50YWxEYXRhRWxlbWVudHMgdmVyc2lvbiAnNS4xLjAwMCcgY2FsbGVkIFNERQ0KDQpjb2Rlc3lzdGVtICJTTk9NRURDVCI6ICdodHRwOi8vc25vbWVkLmluZm8vc2N0Jw0KDQp2YWx1ZXNldCAiRW5jb3VudGVyIHRvIERvY3VtZW50IE1lZGljYXRpb25zIjogJ2h0dHA6Ly9jdHMubmxtLm5paC5nb3YvZmhpci9WYWx1ZVNldC8yLjE2Ljg0MC4xLjExMzg4My4zLjYwMC4xLjE4MzQnDQoNCmNvZGUgIkFjdXRlIGhlYWx0aCBjcmlzaXMgKGZpbmRpbmcpIjogJzcwNTAxNjAwNScgZnJvbSAiU05PTUVEQ1QiIGRpc3BsYXkgJ0FjdXRlIGhlYWx0aCBjcmlzaXMgKGZpbmRpbmcpJw0KY29kZSAiRG9jdW1lbnRhdGlvbiBvZiBjdXJyZW50IG1lZGljYXRpb25zIChwcm9jZWR1cmUpIjogJzQyODE5MTAwMDEyNDEwMScgZnJvbSAiU05PTUVEQ1QiIGRpc3BsYXkgJ0RvY3VtZW50YXRpb24gb2YgY3VycmVudCBtZWRpY2F0aW9ucyAocHJvY2VkdXJlKScNCg0KcGFyYW1ldGVyICJNZWFzdXJlbWVudCBQZXJpb2QiIEludGVydmFsPERhdGVUaW1lPg0KDQpjb250ZXh0IFBhdGllbnQNCg0KZGVmaW5lICJTREUgRXRobmljaXR5IjoNCiAgU0RFLiJTREUgRXRobmljaXR5Ig0KDQpkZWZpbmUgIlNERSBQYXllciI6DQogIFNERS4iU0RFIFBheWVyIg0KDQpkZWZpbmUgIlNERSBSYWNlIjoNCiAgU0RFLiJTREUgUmFjZSINCg0KZGVmaW5lICJTREUgU2V4IjoNCiAgU0RFLiJTREUgU2V4Ig0KDQpkZWZpbmUgIkRlbm9taW5hdG9yIjoNCiAgIkluaXRpYWwgUG9wdWxhdGlvbiINCg0KZGVmaW5lICJRdWFsaWZ5aW5nIEVuY291bnRlciBEdXJpbmcgRGF5IG9mIE1lYXN1cmVtZW50IFBlcmlvZCI6DQogIFsiRW5jb3VudGVyIjogIkVuY291bnRlciB0byBEb2N1bWVudCBNZWRpY2F0aW9ucyJdIFZhbGlkRW5jb3VudGVyDQogICAgd2hlcmUgVmFsaWRFbmNvdW50ZXIuc3RhdHVzID0gJ2ZpbmlzaGVkJw0KICAgICAgYW5kIFZhbGlkRW5jb3VudGVyLnBlcmlvZCBkdXJpbmcgZGF5IG9mICJNZWFzdXJlbWVudCBQZXJpb2QiDQoNCmRlZmluZSAiSW5pdGlhbCBQb3B1bGF0aW9uIjoNCiAgIlF1YWxpZnlpbmcgRW5jb3VudGVyIER1cmluZyBEYXkgb2YgTWVhc3VyZW1lbnQgUGVyaW9kIiBRdWFsaWZ5aW5nRW5jb3VudGVyDQoNCmRlZmluZSAiTnVtZXJhdG9yIjoNCiAgIlF1YWxpZnlpbmcgRW5jb3VudGVyIER1cmluZyBEYXkgb2YgTWVhc3VyZW1lbnQgUGVyaW9kIiBRdWFsaWZ5aW5nRW5jb3VudGVyDQogICAgd2l0aCBbUHJvY2VkdXJlOiAiRG9jdW1lbnRhdGlvbiBvZiBjdXJyZW50IG1lZGljYXRpb25zIChwcm9jZWR1cmUpIl0gTWVkaWNhdGlvbnNEb2N1bWVudGVkDQogICAgICBzdWNoIHRoYXQgTWVkaWNhdGlvbnNEb2N1bWVudGVkLnBlcmZvcm1lZC50b0ludGVydmFsICggKSBzdGFydHMgZHVyaW5nIGRheSBvZiBRdWFsaWZ5aW5nRW5jb3VudGVyLnBlcmlvZA0KICAgICAgICBhbmQgTWVkaWNhdGlvbnNEb2N1bWVudGVkLnBlcmZvcm1lZC50b0ludGVydmFsICggKS5oYXNFbmQgKCApDQogICAgICAgIGFuZCBNZWRpY2F0aW9uc0RvY3VtZW50ZWQuc3RhdHVzID0gJ2NvbXBsZXRlZCcNCg0KZGVmaW5lICJEZW5vbWluYXRvciBFeGNlcHRpb25zIjoNCiAgIlF1YWxpZnlpbmcgRW5jb3VudGVyIER1cmluZyBEYXkgb2YgTWVhc3VyZW1lbnQgUGVyaW9kIiBRdWFsaWZ5aW5nRW5jb3VudGVyDQogICAgd2l0aCBbUHJvY2VkdXJlTm90RG9uZTogY29kZSB+ICJEb2N1bWVudGF0aW9uIG9mIGN1cnJlbnQgbWVkaWNhdGlvbnMgKHByb2NlZHVyZSkiXSBNZWRpY2F0aW9uc05vdERvY3VtZW50ZWQNCiAgICAgIHN1Y2ggdGhhdCBNZWRpY2F0aW9uc05vdERvY3VtZW50ZWQucmVjb3JkZWQgZHVyaW5nIGRheSBvZiBRdWFsaWZ5aW5nRW5jb3VudGVyLnBlcmlvZA0KICAgICAgICBhbmQgTWVkaWNhdGlvbnNOb3REb2N1bWVudGVkLnN0YXR1cyA9ICdub3QtZG9uZScNCiAgICAgICAgYW5kIGV4aXN0cyAoIE1lZGljYXRpb25zTm90RG9jdW1lbnRlZC5yZWFzb25Db2RlIHJlYXNvbkl0ZW0NCiAgICAgICAgICAgIHdoZXJlIHJlYXNvbkl0ZW0gfiAiQWN1dGUgaGVhbHRoIGNyaXNpcyAoZmluZGluZykiDQogICAgICAgICk="
      }, {
        "contentType": "application/elm+json",
        "data": "[encoded data, 230464 characters]"
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Library/CMS68FHIRDocumentationCurrentMeds"
    }
  }, {
    "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-08-21T13:34:25+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/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-08-21T13:34:25+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-08-21T13:34:24+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"
    }
  } ]
}