Draft dQM CMS Content Implementation Guide
2025.1.0 - CI Build

Draft dQM CMS Content Implementation Guide, published by cqframework. This guide is not an authorized publication; it is the continuous build for version 2025.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/dqm-content-cms-2025/ and changes regularly. See the Directory of published versions

Measure: Documentation of Current Medications in the Medical RecordFHIR

Official URL: https://madie.cms.gov/Measure/CMS68FHIRDocumentationCurrentMeds Version: 1.0.000
Active as of 2026-01-16 Responsible: Centers for Medicare & Medicaid Services (CMS) Computable Name: CMS68FHIRDocumentationCurrentMeds
Other Identifiers: Short Name: CMS68FHIR (use: usual, ), UUID:8fbf4570-1db0-4d90-9900-39a7fa635c75 (use: official, ), UUID:15214cf9-f81e-4f3a-9746-a6a7c0daa51d (use: official, ), Publisher: 68FHIR (use: official, )

Copyright/Legal: 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.

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.

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.

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

Metadata
Title Documentation of Current Medications in the Medical RecordFHIR
Version 1.0.000
Short Name CMS68FHIR
GUID (Version Independent) urn:uuid:8fbf4570-1db0-4d90-9900-39a7fa635c75
GUID (Version Specific) urn:uuid:15214cf9-f81e-4f3a-9746-a6a7c0daa51d
CMS Identifier 68FHIR
Effective Period 2026-01-01 through 2026-12-31
Steward (Publisher) Centers for Medicare & Medicaid Services (CMS)
Developer American Institutes for Research (AIR)
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

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.

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.

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.

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.

THE MEASURE AND SPECIFICATIONS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.

Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].

Rationale

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.

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 "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.

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 "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).

Clinical Recommendation Statement

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."

The 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."

The 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."

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Definition Current Medications: 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
Definition Encounter to Document Medications: An encounter performed during the measurement period where medications should be reviewed
Definition Route: Documentation of the way the medication enters the body (some examples include but are not limited to: oral, sublingual, subcutaneous injections, and/or topical)
Guidance (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. Eligible clinicians reporting this measure may document medication information received from the patient, authorized representative(s), caregiver(s) or other available healthcare resources. 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. 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. This measure should also be reported if the eligible clinician documented the patient is not currently taking any medications. 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).
Measure Group (Rate) (ID: Group_1)
Summary 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
Basis Encounter
Scoring Proportion
Improvement Notation Increased score indicates improvement
Type Process
Initial Population ID: InitialPopulation_1
Description:

All visits occurring during the 12-month measurement period

Criteria: Initial Population
Denominator ID: Denominator_1
Description:

Equals Initial Population

Criteria: Denominator
Denominator Exception ID: DenominatorException_1
Description:

Documentation of acute health crisis where time is of the essence and delay of treatment would jeopardize the patient's health status

Criteria: Denominator Exceptions
Numerator ID: Numerator_1
Description:

Eligible clinician attests to documenting the patient's current medications using all immediate resources available on the date of the encounter

Criteria: Numerator
For every patient evaluated by this measure also identify payer, race, ethnicity and sex
Supplemental Data Elements
Supplemental Data Element ID: sde-ethnicity
Usage Code: Supplemental Data
Description: SDE Ethnicity
Logic Definition: SDE Ethnicity
Supplemental Data Element ID: sde-payer
Usage Code: Supplemental Data
Description: SDE Payer
Logic Definition: SDE Payer
Supplemental Data Element ID: sde-race
Usage Code: Supplemental Data
Description: SDE Race
Logic Definition: SDE Race
Supplemental Data Element ID: sde-sex
Usage Code: Supplemental Data
Description: SDE Sex
Logic Definition: SDE Sex
Measure Logic
Primary Library https://madie.cms.gov/Library/CMS68FHIRDocumentationCurrentMeds
Contents Population Criteria
Logic Definitions
Terminology
Dependencies
Data Requirements
Parameters
Population Criteria
Measure Group (Rate) (ID: Group_1)
Initial Population
define "Initial Population":
  "Qualifying Encounter During Day of Measurement Period" QualifyingEncounter
Definition
Denominator
define "Denominator":
  "Initial Population"
Definition
Denominator Exception
define "Denominator Exceptions":
  "Qualifying Encounter During Day of Measurement Period" QualifyingEncounter
    with [ProcedureNotDone: code ~ "Documentation of current medications (procedure)"] MedicationsNotDocumented
      such that MedicationsNotDocumented.recorded ( ) during day of QualifyingEncounter.period
        and MedicationsNotDocumented.status = 'not-done'
        and exists ( MedicationsNotDocumented.reasonCode reasonItem
            where reasonItem ~ "Acute health crisis (finding)"
        )
Definition
Numerator
define "Numerator":
  "Qualifying Encounter During Day of Measurement Period" QualifyingEncounter
    with [Procedure: "Documentation of current medications (procedure)"] MedicationsDocumented
      such that MedicationsDocumented.performed.toInterval ( ) starts during day of QualifyingEncounter.period
        and MedicationsDocumented.performed.toInterval ( ).hasEnd ( )
        and MedicationsDocumented.status = 'completed'
Definition
Logic Definitions
Logic Definition Library Name: SupplementalDataElements
define "SDE Sex":
  case
    when Patient.sex() = '248153007' then "Male (finding)"
    when Patient.sex() = '248152002' then "Female (finding)"
    else null
  end
Logic Definition Library Name: SupplementalDataElements
define "SDE Payer":
  [USQualityCore.Coverage: type in "Payer Type"] Payer
    return {
      code: Payer.type,
      period: Payer.period
    }
Logic Definition Library Name: SupplementalDataElements
define "SDE Ethnicity":
  (Patient.ethnicity()) E
    return Tuple {
      codes: { E.ombCategory } union E.detailed,
      display: E.text
    }
Logic Definition Library Name: SupplementalDataElements
define "SDE Race":
  (Patient.race()) R
    return Tuple {
      codes: R.ombCategory union R.detailed,
      display: R.text
    }
Logic Definition Library Name: CMS68FHIRDocumentationCurrentMeds
define "SDE Sex":
  SDE."SDE Sex"
Logic Definition Library Name: CMS68FHIRDocumentationCurrentMeds
define "Qualifying Encounter During Day of Measurement Period":
  ["Encounter": "Encounter to Document Medications"] ValidEncounter
    where ValidEncounter.status = 'finished'
      and ValidEncounter.period during day of "Measurement Period"
Logic Definition Library Name: CMS68FHIRDocumentationCurrentMeds
define "Numerator":
  "Qualifying Encounter During Day of Measurement Period" QualifyingEncounter
    with [Procedure: "Documentation of current medications (procedure)"] MedicationsDocumented
      such that MedicationsDocumented.performed.toInterval ( ) starts during day of QualifyingEncounter.period
        and MedicationsDocumented.performed.toInterval ( ).hasEnd ( )
        and MedicationsDocumented.status = 'completed'
Logic Definition Library Name: CMS68FHIRDocumentationCurrentMeds
define "Initial Population":
  "Qualifying Encounter During Day of Measurement Period" QualifyingEncounter
Logic Definition Library Name: CMS68FHIRDocumentationCurrentMeds
define "Denominator":
  "Initial Population"
Logic Definition Library Name: CMS68FHIRDocumentationCurrentMeds
define "SDE Payer":
  SDE."SDE Payer"
Logic Definition Library Name: CMS68FHIRDocumentationCurrentMeds
define "SDE Ethnicity":
  SDE."SDE Ethnicity"
Logic Definition Library Name: CMS68FHIRDocumentationCurrentMeds
define "SDE Race":
  SDE."SDE Race"
Logic Definition Library Name: CMS68FHIRDocumentationCurrentMeds
define "Denominator Exceptions":
  "Qualifying Encounter During Day of Measurement Period" QualifyingEncounter
    with [ProcedureNotDone: code ~ "Documentation of current medications (procedure)"] MedicationsNotDocumented
      such that MedicationsNotDocumented.recorded ( ) during day of QualifyingEncounter.period
        and MedicationsNotDocumented.status = 'not-done'
        and exists ( MedicationsNotDocumented.reasonCode reasonItem
            where reasonItem ~ "Acute health crisis (finding)"
        )
Logic Definition Library Name: FHIRCommon
/*
@description: Returns the single extension (if present) on the given resource with the specified url.
@comment: This function uses singleton from to ensure that a run-time exception is thrown if there
is more than one extension on the given resource with the specified url.
*/
define fluent function ext(domainResource DomainResource, url String):
  singleton from domainResource.exts(url)
Logic Definition Library Name: FHIRCommon
/*
@description: Returns any extensions defined on the given resource with the specified url
*/
define fluent function exts(domainResource DomainResource, url String):
  domainResource.extension E
    where E.url = url
    return E
Logic Definition Library Name: FHIRCommon
/*
@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
@comment: Normalizes a choice type of FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instance, FHIR.string, FHIR.Age, or FHIR.Range types
to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible
representations for timing-valued elements in FHIR, allowing this function to be used across any resource.

The input can be provided as a dateTime, Period, Timing, instant, string, Age, or Range.
The intent of this function is to provide a clear and concise mechanism to treat single
elements that have multiple possible representations as intervals so that logic doesn't have to account
for the variability. More complex calculations (such as medication request period or dispense period
calculation) need specific guidance and consideration. That guidance may make use of this function, but
the focus of this function is on single element calculations where the semantics are unambiguous.
If the input is a dateTime, the result a DateTime Interval beginning and ending on that dateTime.
If the input is a Period, the result is a DateTime Interval.
If the input is a Timing, an error is raised indicating a single interval cannot be computed from a Timing.
If the input is an instant, the result is a DateTime Interval beginning and ending on that instant.
If the input is a string, an error is raised indicating a single interval cannot be computed from a string.
If the input is an Age, the result is a DateTime Interval beginning when the patient was the given Age,
and ending immediately prior to when the patient was the given Age plus one year.
If the input is a Range, the result is a DateTime Interval beginning when the patient was the Age given
by the low end of the Range, and ending immediately prior to when the patient was the Age given by the
high end of the Range plus one year.

NOTE: Due to the
complexity of determining a single interval from a Timing or String type, this function will throw a run-time exception if it is used
with a Timing or String.
*/
define fluent function toInterval(choice Choice<FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range>):
  case
    when choice is FHIR.dateTime then
      Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]
    when choice is FHIR.Period then
      FHIRHelpers.ToInterval(choice as FHIR.Period)
    when choice is FHIR.instant then
      Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)]
    when choice is FHIR.Age then
      Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age),
        FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year)
    when choice is FHIR.Range then
      Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low),
        FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year)
    when choice is FHIR.Timing then
      Message(null as Interval<DateTime>, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported')
    when choice is FHIR.string then
      Message(null as Interval<DateTime>, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a String value is not supported')
    else
      null as Interval<DateTime>
  end
Logic Definition Library Name: FHIRCommon
/*
@description: Given an interval, returns true if the interval has an ending boundary specified
(i.e. the end of the interval is not null and not the maximum DateTime value)
*/
define fluent function hasEnd(period Interval<DateTime>):
  not (
    end of period is null
      or end of period = maximum DateTime
  )
Logic Definition Library Name: FHIRCommon
/*
@description: Returns the single extension (if present) on the given element with the specified url.
@comment: This function uses singleton from to ensure that a run-time exception is thrown if there
is more than one extension on the given element with the specified url.
*/
define fluent function ext(element Element, url String):
  singleton from element.exts(url)
Logic Definition Library Name: FHIRCommon
/*
@description: Returns any extensions defined on the given element with the specified url.
*/
define fluent function exts(element Element, url String):
  element.extension E
    where E.url = url
    return E
Logic Definition Library Name: USCoreCommon
/*
@description: Returns the sex element as defined for the USCore patient profile
*/
define fluent function sex(patient Patient):
  patient.ext('http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex').value as FHIR.code
Logic Definition Library Name: USCoreCommon
define fluent function ethnicity(patient Patient):
  (patient.ext('http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity')) E
    return {
      ombCategory: E.ext('ombCategory').value as FHIR.Coding,
      detailed: (E.exts('detailed')) d return d.value as FHIR.Coding,
      text: E.ext('text').value as FHIR.string
    }
Logic Definition Library Name: USCoreCommon
define fluent function race(patient Patient):
  (patient.ext('http://hl7.org/fhir/us/core/StructureDefinition/us-core-race')) E
    return {
      ombCategory: (E.exts('ombCategory')) o return o.value as FHIR.Coding,
      detailed: (E.exts('detailed')) d return d.value as FHIR.Coding,
      text: E.ext('text').value as FHIR.string
    }
Logic Definition Library Name: USQualityCoreCommon
/*
@description: Returns the value of the recorded extension for a Medication Administration Not Done
*/
define fluent function recorded(procedureNotDone ProcedureNotDone):
  procedureNotDone.ext('http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-recorded').value as FHIR.dateTime
Logic Definition Library Name: FHIRHelpers
define function ToString(value string): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value uri): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value EncounterStatus): value.value
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)
value to a CQL DateTime Interval
@comment: If the start value of the given period is unspecified, the starting
boundary of the resulting interval will be open (meaning the start of the interval
is unknown, as opposed to interpreted as the beginning of time).
*/
define function ToInterval(period FHIR.Period):
    if period is null then
        null
    else
        if period."start" is null then
            Interval(period."start".value, period."end".value]
        else
            Interval[period."start".value, period."end".value]
Logic Definition Library Name: FHIRHelpers
define function ToDateTime(value dateTime): value.value
Logic Definition Library Name: FHIRHelpers
define function ToDateTime(value instant): value.value
Logic Definition Library Name: FHIRHelpers
define function ToDate(value date): value.value
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given FHIR [Quantity](https://hl7.org/fhir/datatypes.html#Quantity) 
value to a CQL Quantity
@comment: If the given quantity has a comparator specified, a runtime error is raised. If the given quantity
has a system other than UCUM (i.e. `http://unitsofmeasure.org`) or CQL calendar units (i.e. `http://hl7.org/fhirpath/CodeSystem/calendar-units`)
an error is raised. For UCUM to calendar units, the `ToCalendarUnit` function is used.
@seealso: ToCalendarUnit
*/
define function ToQuantity(quantity FHIR.Quantity):
    case
        when quantity is null then null
        when quantity.value is null then null
        when quantity.comparator is not null then
            Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.')
        when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'
              or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then
            System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }
        else
            Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' & quantity.unit.value & ' (' & quantity.system.value & '|' & quantity.code.value & ')')
    end
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts a UCUM definite duration unit to a CQL calendar duration
unit using conversions specified in the [quantities](https://cql.hl7.org/02-authorsguide.html#quantities) 
topic of the CQL specification.
@comment: Note that for durations above days (or weeks), the conversion is understood to be approximate
*/
define function ToCalendarUnit(unit System.String):
    case unit
        when 'ms' then 'millisecond'
        when 's' then 'second'
        when 'min' then 'minute'
        when 'h' then 'hour'
        when 'd' then 'day'
        when 'wk' then 'week'
        when 'mo' then 'month'
        when 'a' then 'year'
        else unit
    end
Logic Definition Library Name: FHIRHelpers
define function ToString(value ProcedureStatus): value.value
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
*/
define function ToConcept(concept FHIR.CodeableConcept):
    if concept is null then
        null
    else
        System.Concept {
            codes: concept.coding C return ToCode(C),
            display: concept.text.value
        }
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
*/
define function ToCode(coding FHIR.Coding):
    if coding is null then
        null
    else
        System.Code {
          code: coding.code.value,
          system: coding.system.value,
          version: coding.version.value,
          display: coding.display.value
        }
Terminology
Code System Description: Code system SNOMEDCT
Resource: SNOMED CT (all versions)
Canonical URL: http://snomed.info/sct
Value Set Description: Value set Encounter to Document Medications
Resource: Encounter to Document Medications
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1834
Value Set Description: Value set Payer Type
Resource: Payer Type
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Direct Reference Code Display: Male (finding)
Code: 248153007
System: http://snomed.info/sct
Direct Reference Code Display: Female (finding)
Code: 248152002
System: http://snomed.info/sct
Direct Reference Code Display: Documentation of current medications (procedure)
Code: 428191000124101
System: http://snomed.info/sct
Direct Reference Code Display: Acute health crisis (finding)
Code: 705016005
System: http://snomed.info/sct
Dependencies
Dependency Description: USQualityCore model information
Resource: https://madie.cms.gov/Library/USQualityCore-ModelInfo|0.1.0-cibuild
Canonical URL: https://madie.cms.gov/Library/USQualityCore-ModelInfo|0.1.0-cibuild
Dependency Description: USCore model information
Resource: http://hl7.org/fhir/us/cql/Library/USCore-ModelInfo|6.1.0-derived
Canonical URL: http://hl7.org/fhir/us/cql/Library/USCore-ModelInfo|6.1.0-derived
Dependency Description: FHIR model information
Resource: http://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1
Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1
Dependency Description: Library SDE
Resource: SupplementalDataElements version: 6.1.000
Canonical URL: https://madie.cms.gov/Library/SupplementalDataElements|6.1.000
Dependency Description: Library FHIRHelpers
Resource: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1
Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1
Dependency Description: Library USCommon
Resource: http://hl7.org/fhir/us/cql/Library/USCoreCommon|2.0.0-ballot
Canonical URL: http://hl7.org/fhir/us/cql/Library/USCoreCommon|2.0.0-ballot
Dependency Description: Library FHIRCommon
Resource: http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0
Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0
Dependency Description: Library USQualityCoreCommon
Resource: US Quality Core Common version: 0.1.0-cibuild
Canonical URL: https://madie.cms.gov/Library/USQualityCoreCommon|0.1.0-cibuild
Data Requirements
Data Requirement Type: Patient
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-patient
Must Support Elements: ombCategory, detailed, text
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, status, period
Code Filter(s):
Path: type
ValueSet: Encounter to Document Medications
Path: status
Code(s): [not stated]: finished (finished)
Data Requirement Type: Patient
Profile(s): Patient
Must Support Elements: birthDate
Data Requirement Type: Procedure
Profile(s): Procedure
Must Support Elements: code, performed, status
Code Filter(s):
Path: code
Code(s): SNOMED CT: 428191000124101 (Documentation of current medications (procedure))
Path: status
Code(s): [not stated]: completed (completed)
Data Requirement Type: Coverage
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-coverage
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Payer Type
Data Requirement Type: Procedure
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-procedurenotdone
Must Support Elements: code, status, reasonCode
Code Filter(s):
Path: code
Code(s): SNOMED CT: 428191000124101 (Documentation of current medications (procedure))
Path: status
Code(s): [not stated]: not-done (not-done)
Parameters
Name Use Card. Type Documentation
Measurement Period In 0..1 Period
SDE Sex Out 0..1 Coding
Numerator Out 0..* Encounter
Denominator Out 0..* Encounter
SDE Payer Out 0..* Resource
Initial Population Out 0..* Encounter
SDE Ethnicity Out 0..1 Resource
SDE Race Out 0..1 Resource
Denominator Exceptions Out 0..* Encounter
Generated using version 0.5.4 of the sample-content-ig Liquid templates