Skip to content

Cooking with CQL Examples Sessions 1 50

Bryn Rhodes edited this page Aug 11, 2026 · 1 revision

Cooking with CQL Examples - Sessions 1-50

This page contains the examples from Cooking with CQL sessions 21 through 50, in reverse chronological order. Sessions 1 through 20 (2016 and 2017) are on the Archived Cooking with CQL Sessions page. See Cooking with CQL Examples for the complete session index and the most recent sessions, and Cooking with CQL Examples - Sessions 51-100 for later sessions.

Session Index

Session Date Topics
50 2021-01-21 Collapse with null ending boundary; medication coverage; falls per 1000 patient days; QDM 5.6 entities
49 2020-12-03 Cumulative medication duration; Connectathon 26 review
48 2020-10-29 Lab tests every six weeks redux; QDM timings; interval boundary access
47 2020-10-01 Lab tests every six weeks; inpatient stay 48 hours or more; composite measure calculation
46 2020-07-30 QDM organization attributes; with vs. from; CQL timing phrases
45 2020-06-25 Coalesce review; high risk medications; advanced illness; troponin measure followup
44 2020-05-28 CQL basics and resources; query return types; collapse and expand; troponin continuous variable measure
43 2020-04-23 Encounters per day; FHIR, CQL, and QI-Core
42 2020-02-27 QI-Core usage patterns
41 2020-01-16 Medications not documented; choice-element timing; condition prevalence period; blood pressure components
40 2019-12-06 CMS826 pressure injury redux; bladder cancer measure; measure observation calculation; is vs. as
39 2019-10-24 CMS130 colorectal cancer screening (QDM and FHIR); EXM9 exclusive breast milk feeding
38 2019-09-26 Using FHIR to specify eCQMs
37 2019-07-25 Medications present on admission; representing SQL joins in CQL; QDM-to-FHIR side-by-side
36 2019-06-27 Nested definitions; hospitalization with observation; QDM vs. CQL timing phrases; pressure injury measure
35 2019-05-23 Multi-source query examples; QDM 5.5 timing attributes
34 2019-04-25 Issue tracker examples: multi-source queries, equal vs. equivalent, durations, multiple encounters
33 2019-03-28 QDM 5.5 change review; CQL 1.4 ballot review; negation rationale; related context retrieves
32 2019-02-28 Common patterns: age calculation, most recent lab result, comparing and sequential events, determining coverage
31 2019-01-31 Singleton results; lowest most recent blood pressure; same or after semantics; default temporal precision; coalesce; glucocorticoid dosage
30 2018-12-06 Hypoglycemia risk; anti-MRSA antibiotics; positive depression screening; ACO38 risk standardized readmission rates
29 2018-10-25 Terminology usage and VSAC; hospitalization admission source; age calculation; Boolean naming conventions
28 2018-09-27 Continuous variable ratio measure; blood transfusion; averaged blood pressures; conception date; user-defined functions
27 2018-07-26 Observation status and its impact on hospitalization functions
26 2018-06-28 Stratification; supplemental data; risk adjustment variables; common error messages
25 2018-05-31 Calculation differences between QDM logic and CQL; negation redux; QDM 5.4 changes
24 2018-04-26 Overlaps operator; claim query in FHIR; regional anesthesia; contraceptive provision; radiology report
23 2018-03-29 QDM specific occurrences in CQL; CMS105 walkthrough
22 2018-02-22 Encounter diagnoses; ED encounters; consecutive heart rates; allergy to eggs; smoking cessation
21 2018-01-18 2nd Tylenol administration during an encounter; NCQA vaccination example; opioid MME calculation

Cooking with CQL - Session 50 - 2021-01-21

Topics:

  1. Collapse with null ending boundary
  2. Medication Coverage (rolling out intervals)
  3. Falls per 1000 patient days (QDM and FHIR Ratio Measure)
  4. QDM 5.6 Entities
  • Examples
  • Cooking with CQL Q&A
    • Date and Time Calculation - Third test as successor maximum for test expressions for collapse with null ending boundary
    • Using Quality Data Model - Number of inpatient falls with major injury per 1,000 patient days
    • Using Quality Data Model - Specifying an Individual Actor is a Member of an Organization expression

Cooking with CQL - Session 49 - 2020-12-03

Topics:

  1. Connectathon 26 Review
  2. Cumulative Medication Duration
  • Examples
  • There were no Q&As for this session

Cooking with CQL - Session 48 - 2020-10-29

Topics:

  1. Lab Tests Every Six Weeks Redux
  2. QDM Timings
  3. Interval Boundary Access
  • Examples
  • Cooking with CQL Q&A
    • Date and Time Calculation - Lab Tests Every Six Weeks Revisited
    • Date and Time Calculation - normalizeInterval function

Cooking with CQL - Session 47 - 2020-10-01

Topics:

  1. Lab Tests Every Six Weeks
  2. Inpatient Stay 48 Hours Or More
  3. Composite Measure Calculation

Cooking with CQL - Session 46 - 2020-07-30

  1. QDM Organization Attributes
    1. What value to use for namingSystem for NPI or other formal identifiers for organizations
    2. Check that the organization associated with a blood pressure is the same as the encounter
  2. Using with vs from
  3. CQL Timing Phrases
  • Examples
  • Cooking with CQL Q&A
    • Quality Data Model (QDM) v.5.5 attributes for organizations
    • Date & Time Calculations - subtraction of one hour when there is a leap second
    • Interpreting Time Phrases in CQL

Cooking with CQL - Session 45 - 2020-06-25

Topics:

  1. Connectathon Announcement
  2. Feedback Request on CDS Connect Authoring Tool
  3. Coalesce Review
  4. High Risk Medications
  5. Advanced Illness
  6. Troponin Measure Followup
  • Examples
  • Cooking with CQL Q&A
    • Troponin Continuous Variable measure - CQL calculated sort order
    • Troponin Continuous Variable measure - Minutes between results and communication by id THEN timing

Cooking with CQL - Session 44 - 2020-05-28

Topics covered:

  1. CQL Basics and Resources Review
  2. Query Return Types
  3. Using Collapse and Expand
  4. Troponin Continuous Variable Measure
  • Examples
  • Cooking with CQL Q&A
    • Troponin Continuous Variable Measure - multiple Toponin tests and communication
    • Troponin Continuous Variable Measure - minutes between results and communication by id or timing

Cooking with CQL - Session 43 - 2020-04-23

In this session we reviewed:

  1. EncountersPerDay - Returning a single encounter per day during a given time period
  2. FHIR, CQL, and QICore
  • Examples
  • Cooking with CQL Q&A
    • Ambulatory Numerator
    • Beginning of Encounter
    • CQL Version for ELM
    • Expand Operator
    • Extensions
    • Extensions vs Slices
    • FHIR Helpers

Cooking with CQL - Session 42 - 2020-02-27

In this session we reviewed:

  1. QI Core Usage Patterns

Cooking with CQL - Session 41 - 2020-01-16

In this session we reviewed:

  1. Before and after assessments
  2. Continued discussion of EXM105
  3. A pattern for Medications Not Documented in FHIR3/4
  4. A pattern for Timing with Choice Elements (dateTime|Period)
  5. Expanding the pattern for Observation timing (dateTime|Period|Timing|instant)
  6. Expanding the pattern for Procedure performance timing (dateTime|Period|string|Age|Range)
  7. A pattern for Condition onset/abatement/prevalence period
  8. Blood pressure components
  • Examples
  • Cooking with CQL Q&A
    • Normalize Interval function in EXM 130
    • Timing, instance, and string in EXM 130
    • Condition Onset Abatement Prevalence Period in EXM 135

Cooking with CQL - Session 40 - 2019-12-06

In this session we covered:

  1. CMS826 - Pressure Injury Redux
  2. CQLIT-206 - Bladder Cancer Measure
  3. CQLIT-207 - Measure Observation Calculation Issue
  4. Is vs As for Entity Examples
  • Examples
  • Cooking with CQL Q&A
    • CMS 826v0 Pressure Injury Redux
    • CQLIT-206 Bladder Cancer Measure (CMS646)
    • CQLIT-207 Measure Observation Calculation Issue - Median Admit Decision Time to ED Departure Time for Admitted Patients in CMS 111
    • Is vs As for Entity Examples

Cooking with CQL - Session 39 - 2019-10-24

In this session we covered:

  1. CMS130 - Colorectal Cancer Screening, QDM and FHIR Walkthrough
  2. EXM9 - FHIR Draft of Exclusive Breast Milk Feeding

Cooking with CQL - Session 38 - 2019-09-26

In this session, we reviewed the use of FHIR to specify eCQMs.

Cooking with CQL - Session 37 - 2019-07-25

In this session we reviewed:

  1. Medications present on admission
  2. Representing SQL joins in CQL
  3. JIRA Issue Tracker Questions
  4. QDM-to-FHIR Side-by-Side
  • Examples
  • Cooking with CQL Q&A
    • Medications Present on Admission
    • SQL Joins in CQL
    • CQLIT-171 Randomly pick an element from a list
    • QDM to FHIR side by side:
      • Diagnosis in CMS72v8
      • Encounter, Performed using the example from MATGlobalCommonFunctions
      • Medication, Order using the example from VTE-1
      • Procedure, Performed using the example from VTE-1

Cooking with CQL - Session 36 - 2019-06-27

In this session we reviewed:

  1. Criteria with nested definitions
  2. Hospitalization with observation function
  3. QDM versus CQL timing phrases and interpretation
  4. Pressure Injury Measure

Cooking with CQL - Session 35 - 2019-05-23

In this session we reviewed:

  1. Multi-source Query Examples
  2. Timing Considerations given new QDM 5.5 timing attributes

Cooking with CQL - Session 34 - 2019-04-25

In this session we reviewed examples from questions and issues that have been submitted through the CQL Issues tracker:

  • Examples
  • Cooking with CQL Q&A
    • Multi-source Queries (CQLIT-158)
    • Equal vs Equivalent (CQLIT-157)
    • Duration in Days (CQM-3552)
    • Duration with Partials (QDM-229)
    • Multiple Encounters (CQLIT-165)

Cooking with CQL - Session 33 - 2019-03-28

In this session we reviewed the following:

  • QDM 5.5 Change Review

  • CQL 1.4 Ballot Review

  • Negation Rationale Examples

  • Related Context Retrieves

  • Examples

  • Cooking with CQL Q&A

    • Related Persons QDM datatype
    • Mother-Baby related context queries
    • Pregnancy due date definition

Cooking with CQL - Session 32 - 2019-02-28

In this session we will review common patterns from across all the measures:

  1. Age Calculation
  2. Most Recent Lab Result
  3. Comparing Pairs of Events
  4. Sequential Events
  5. Age Based Risk Factors
  6. Followup Timeframe
  7. Intermediate Results
  8. Maximum Value
  9. Determining Coverage
  • Examples
  • Cooking with CQL Q&A
    • Multi-source Query vs Single-source Query – use of from vs with
    • Hospital Arrival Time definition
    • Dosages and number of dosages per day
    • Use of not equivalent comparison
    • Age Based Risk Factors
    • Determining Coverage

Cooking with CQL - Session 31 - 2019-01-31

In this session, we reviewed and discussed:

  1. Singleton Results
  2. Lowest Most Recent Blood Pressure
  3. Same Or After Semantics
  4. Default Temporal Precision
  5. Blood Pressure Exam Without Inpatient Stay
  6. Coalesce Semantics
  7. Glucocorticoid Dosage

Cooking with CQL - Session 30 - 2018-12-06

In this session, we reviewed and discussed:

  1. Characterization of Hypoglycemia Risk
  2. Appropriate use of anti-MRSA Antibiotics
  3. Positive Depression Screening
  4. ACO38 - "Risk Standardized Readmission Rates" - Part I (Diagnosis Counts)
  5. ACO38 - "Risk Standardized Readmission Rates" - Part II (Risk Adjustment Variables)

Cooking with CQL - Session 29 - 2018-10-25

In this session we reviewed:

  1. Measure Terminology Usage and the Value Set Authority Center
  2. Hospitalization Admission Source CQLIT-136
  3. Calculate Age Discussion
  4. Calendar Age for Immunization Question
  5. Naming conventions for Boolean-valued expressions

Cooking with CQL - Session 28 - 2018-09-27

In this session we reviewed:

  1. A Continuous Variable Ratio Measure (Hypoglycemia)
  2. First occurrence of a blood transfusion
  3. Blood pressure readings as an average
  4. Calculating conception date using gestational age assessments
  5. Reviewed user-defined functions in CQL
  6. Indicators of adverse events following a blood transfusion
  7. Calculation methods for determining doses per day using QDM medication elements
  • Examples
  • Cooking with CQL Q&A
    • Blood pressure readings as an average instead of most recent
    • Calculation methods for determining doses per day using QDM medication elements

Cooking with CQL - Session 27 - 2018-07-26

In this session we reviewed the concept of "Observation Status" and its impact on the definition of an Episode-of-Care. We then looked at how that would impact the existing Hospitalization functions and proposed new Hospitalization with Observation and Hospitalization with Outpatient functions to allow observation to be considered as part of an episode-of-care within a measure.

  • Examples
  • Cooking with CQL Q&A
    • Impact of incorporating Observation status into the Hospitalization functions
      • ED encounter observation expression
      • outpatient to inpatient logic expression
      • ‘define function’ pattern

Cooking with CQL - Session 26 - 2018-06-28

In this session we reviewed:

  • Stratification
  • Supplemental Data
  • Risk Adjustment Variables
  • Common Error Messages

For Stratifiers, Supplemental Data Elements, and Risk Adjustment Variables, we used a draft contraceptive measure to illustrate building these components. The draft measure is included in the examples for this session here.

For CQL Validation Messages, we've developed a new topic on the CQL Formatting and Usage wiki that provides CQL authors with an overview of how validation is performed on CQL, the kinds of messages that it will produce, and a catalog of validation messages that may be encountered when authoring CQL in tools like the Measure Authoring tool.

The new page is available in the CQL Error Messages topic.

Cooking with CQL - Session 25 - 2018-05-31

In this session we reviewed the following:

  1. Calculation Differences between QDM Logic and CQL
  2. Negation Redux
  3. QDM 5.4 Upcoming Changes Review
  • Examples
  • Cooking with CQL Q&A
    • Using CQL against a database to generate results?
    • Attribute result vs component (see session 18 for another example)

Cooking with CQL - Session 24 - 2018-04-26

In this session we reviewed the following:

  1. Detailed Review of the Overlaps operator
  2. A Claim query in FHIR
  3. Regional Anesthesia Measure Question
  4. Review of Contraceptive Provision Measure
  5. Radiology Report Measure Discussion
  • Examples
  • Cooking with CQL Q&A
    • Boundary – open vs closed
    • RegionalAnesthesia - “where” clause in let procedure statement
    • Denominator statement clarification

Cooking with CQL - Session 23 - 2018-03-29

In this session we reviewed the following:

  1. Representation of QDM specific occurrences in CQL
  2. Walkthrough of CQL representation of CMS 105

Cooking with CQL - Session 22 - 2018-02-22

In this session we reviewed the following:

  1. Encounter diagnoses
  2. ED Encounters
  3. Consecutive Heart Rates
  4. Allergy to Eggs
  5. Smoking Cessation

Cooking with CQL - Session 21 - 2018-01-18

In this session we reviewed the following:

  1. 2nd Tylenol Administration During an Encounter
  2. Vaccination Example from NCQA
  3. Opioid Overuse Potential Quality Measure Utilizing Decision Support Logic for MME Calculation

Wiki Index

Home

Authoring Patterns - QICore v4.1.1

Authoring Patterns - QICore v5.0.0

Authoring Patterns - QICore v6.0.0

Authoring Measures in CQL

Composite Measure Development

Cooking with CQL Examples

Cooking with CQL Q&A All Categories
Additional Q&A Examples

CQL 1.3 Impact Guidance

CQL Error Messages

Developers Introduction to CQL

Discussion Items

Example Measures

Formatting and Usage Topics

Formatting Conventions

Library Versioning

Negation in QDM

QDM Known Issues

Specific Occurrences

Specifying Population Criteria

Supplemental Data Elements

Terminology in CQL

Translator Options For Measure Development

Unions in CQL

Clone this wiki locally