Clinical Quality Language Specification, published by Clinical Decision Support WG. This guide is not an authorized publication; it is the continuous build for version 1.5.3 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/cql/ and changes regularly. See the Directory of published versions
library CMS146 version '2'
/* CMS 146v2
*
* ============================================================================
* QDM Logic
* ============================================================================
* Initial Patient Population =
* AND: "Patient Characteristic Birthdate: birth date" >= 2 year(s) starts before start of "Measurement Period"
* AND: "Patient Characteristic Birthdate: birth date" < 18 year(s) starts before start of "Measurement Period"
* AND:
* AND: "Occurrence A of Encounter, Performed: Ambulatory/ED Visit" during "Measurement Period"
* AND: "Medication, Order: Antibiotic Medications" <= 3 day(s) starts after start of "Occurrence A of Encounter, Performed: Ambulatory/ED Visit"
* AND:
* OR: "Occurrence A of Encounter, Performed: Ambulatory/ED Visit" during
* OR: "Occurrence A of Diagnosis, Active: Acute Pharyngitis"
* OR: "Occurrence A of Diagnosis, Active: Acute Tonsillitis"
* OR:
* OR: "Occurrence A of Diagnosis, Active: Acute Pharyngitis"
* OR: "Occurrence A of Diagnosis, Active: Acute Tonsillitis"
* starts during "Occurrence A of Encounter, Performed: Ambulatory/ED Visit"
*
* Denominator =
* AND: "Initial Patient Population"
*
* Denominator Exclusions =
* AND: "Medication, Active: Antibiotic Medications" <= 30 day(s) starts before start of
* OR: "Occurrence A of Diagnosis, Active: Acute Pharyngitis"
* OR: "Occurrence A of Diagnosis, Active: Acute Tonsillitis"
*
* Numerator =
* AND:
* OR: "Laboratory Test, Result: Group A Streptococcus Test (result)" <= 3 day(s) starts before or during "Occurrence A of Encounter, Performed: Ambulatory/ED Visit"
* OR: "Laboratory Test, Result: Group A Streptococcus Test (result)" <= 3 day(s) starts after end of "Occurrence A of Encounter, Performed: Ambulatory/ED Visit"
*
* Denominator Exceptions =
* None
* ============================================================================
*/
using QUICK
valueset "Acute Pharyngitis": '2.16.840.1.113883.3.464.1003.102.12.1011'
valueset "Acute Tonsillitis": '2.16.840.1.113883.3.464.1003.102.12.1012'
valueset "Ambulatory/ED Visit": '2.16.840.1.113883.3.464.1003.101.12.1061'
valueset "Antibiotic Medications": '2.16.840.1.113883.3.464.1003.196.12.1001'
valueset "Group A Streptococcus Test": '2.16.840.1.113883.3.464.1003.198.12.1012'
parameter MeasurementPeriod Interval<DateTime>
context Patient
define "InDemographic":
AgeInYearsAt(start of MeasurementPeriod) >= 2 and AgeInYearsAt(start of MeasurementPeriod) < 18
define "Pharyngitis":
["Condition": "Acute Pharyngitis"] union ["Condition": "Acute Tonsillitis"]
define "Antibiotics":
["MedicationPrescription": "Antibiotic Medications"]
define "MeasurementPeriodEncounters":
["Encounter": "Ambulatory/ED Visit"] E
where "InDemographic" and E."period" during MeasurementPeriod
define "PharyngitisEncounters":
"MeasurementPeriodEncounters" E
with "Pharyngitis" P such that
Interval[P."onsetDateTime", P."abatementDate"] includes E."period"
or P."onsetDateTime" in E."period"
with "Antibiotics" A such that A."dateWritten" 3 days or less after start of E."period"
define "PharyngitisWithPriorAntibiotics":
"Pharyngitis" P
with "Antibiotics" A such that A."dateWritten" 30 days or less before P."onsetDateTime"
define "ExcludedEncounters":
"PharyngitisEncounters" E
with "PharyngitisWithPriorAntibiotics" P such that
Interval[P."onsetDateTime", P."abatementDate"] includes E."period"
or P."onsetDateTime" in E."period"
define "StrepTestEncounters":
"PharyngitisEncounters" E
with ["DiagnosticReport": "Group A Streptococcus Test"] T
such that T."result" is not null
and T."issued" in Interval[start of E."period" - 3 days, end of E."period" + 3 days]
define "IPPCount":
Count("PharyngitisEncounters")
define "DenominatorCount":
"IPPCount"
define "DenominatorExclusionsCount":
Count("ExcludedEncounters")
define "NumeratorCount":
Count("StrepTestEncounters" except "ExcludedEncounters")