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: Preventive Care and Screening: Screening for High Blood Pressure and Follow-Up DocumentedFHIR

Official URL: https://madie.cms.gov/Measure/CMS22FHIRPCSBPScreeningFollowUp Version: 1.0.000
Active as of 2026-01-16 Responsible: Centers for Medicare & Medicaid Services (CMS) Computable Name: CMS22FHIRPCSBPScreeningFollowUp
Other Identifiers: Short Name: CMS22FHIR (use: usual, ), UUID:1b17d846-cbe0-49fa-b503-518addf19fb0 (use: official, ), UUID:54d53d09-d587-47b9-858f-2c6738fba7e7 (use: official, ), Publisher: 22FHIR (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) is 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. ICD-10 is copyright 2024 World Health Organization. All Rights Reserved.

Percentage of patient visits for patients aged 18 years and older seen during the measurement period who were screened for high blood pressure AND a recommended follow-up plan is documented, as indicated, if blood pressure is elevated or hypertensive

Metadata
Title Preventive Care and Screening: Screening for High Blood Pressure and Follow-Up DocumentedFHIR
Version 1.0.000
Short Name CMS22FHIR
GUID (Version Independent) urn:uuid:1b17d846-cbe0-49fa-b503-518addf19fb0
GUID (Version Specific) urn:uuid:54d53d09-d587-47b9-858f-2c6738fba7e7
CMS Identifier 22FHIR
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 patient visits for patients aged 18 years and older seen during the measurement period who were screened for high blood pressure AND a recommended follow-up plan is documented, as indicated, if blood pressure is elevated or hypertensive

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) is 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. ICD-10 is copyright 2024 World Health Organization. All Rights Reserved.

Disclaimer

These performance measures are not clinical guidelines and do not establish a standard of medical care, and have not been tested for all potential applications. THE MEASURES 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

Hypertension is a prevalent condition that affects approximately 66.9 million people in the United States. It is estimated that about 20-40% of the adult population has hypertension; the majority of people over age 65 have a hypertension diagnosis (Appleton et al., 2013 and Luehr et al., 2012). Winter (2013) noted that 1 in 3 American adults have hypertension and the lifetime risk of developing hypertension is 90%. The African American population or non-Hispanic Blacks, the elderly, diabetics and those with chronic kidney disease are at increased risk of stroke, myocardial infarction and renal disease. Non-Hispanic Blacks have the highest prevalence at 38.6% (Winter et al., 2013). Hypertension is a major risk factor for ischemic heart disease, left ventricular hypertrophy, renal failure, stroke and dementia (Luehr et al., 2012). Prevention of hypertension and the treatment of established hypertension are complementary approaches to reducing cardiovascular disease risk in the population, but prevention of hypertension provides the optimal means of reducing risk and avoiding harmful consequences. Periodic blood pressure (BP) screening can identify individuals who develop elevated BP over time. More frequent BP screening may be particularly important for individuals with elevated atherosclerotic cardiovascular disease (ASCVD) risk (Whelton et al., 2018).

Hypertension is the most common reason for adult office visits other than pregnancy. Garrison (2013) stated that in 2007, 42 million ambulatory visits were attributed to hypertension (Garrison & Oberhelman, 2013). It also has the highest utilization of prescription drugs. Numerous resources and treatment options are available, yet only about 40-50% of the hypertensive patients have their blood pressure under control (<140/90) (Appleton et al., 2013 and Luehr et al., 2012). In addition to medication non-compliance, poor outcomes are also attributed to poor adherence to lifestyle changes such as a low-sodium diet, weight loss, increased exercise and limiting alcohol intake. Many adults find it difficult to continue medications and lifestyle changes when they are asymptomatic. Symptoms of elevated blood pressure usually do not occur until secondary problems arise such as with vascular diseases (myocardial infarction, stroke, heart failure and renal insufficiency) (Luehr et al., 2012).

Appropriate follow-up after blood pressure measurement is a pivotal component in preventing the progression of hypertension and the development of heart disease. Detection of marginally or fully elevated blood pressure by a specialty clinician warrants referral to a provider familiar with the management of hypertension and prehypertension.

The American College of Cardiology/American Heart Association (ACC/AHA) 2017 Guidelines provide updated recommendations for ASCVD risk. For additional information please refer to the 2017 ACC/AHA guidelines: https://www.acc.org/latest-in-cardiology/ten-points-to-remember/2017/11/09/11/41/2017-guideline-for-high-blood-pressure-in-adults.

Lifestyle modifications have demonstrated effectiveness in lowering blood pressure (U.S. Department of Health and Human Services, 2003). The synergistic effect of several lifestyle modifications results in greater benefits than a single modification alone. Baseline diagnostic/laboratory testing establishes if a co-existing underlying condition is the etiology of hypertension and evaluates if end organ damage from hypertension has already occurred. Landmark trials such as the Antihypertensive and Lipid-Lowering Treatment to Prevent Heart Attack Trial (ALLHAT) have repeatedly proven the efficacy of pharmacologic therapy to control blood pressure and reduce the complications of hypertension. A review of 35 studies found that the pharmacist-led interventions involved medication counseling and patient education. Twenty-nine of the 35 studies showed statistically significant improvement in BP levels of the intervention groups at follow-up (Reeves et al., 2020). Follow-up intervals based on blood pressure control have been established by the 2017 ACC/AHA guideline and the United States Preventive Services Task Force (Whelton et al., 2018; USPSTF, 2021).

Clinical Recommendation Statement

The U.S. Preventive Services Task Force (USPSTF, 2021) recommends screening for high blood pressure in adults aged 18 years and older. This is a grade A recommendation.

Citation

Appleton, S. L., Neo, C., Hill, C. L., Douglas, K. A., & Adams, R. J. (2013). Untreated hypertension: prevalence and patient factors and beliefs associated with under-treatment in a population sample. Journal of Human Hypertension, 27, 453-462. https://doi.org/10.1038/jhh.2012.62

Citation

Garrison, G. M. & Oberhelman, S. (2013). Screening for hypertension annually compared with current practice. Annals of Family Medicine, 11 (2), 116-121. doi:10.1370/afm.1467

Citation

Luehr, D., Woolley, T., Burke, R., Dohmen, F., Hayes, R., Johnson, M...., Schoenleber, M. (2012). Hypertension diagnosis and treatment; Institute for Clinical Systems Improvement health care guideline. Updated November, 2012

Citation

Reeves, L., Robinson, K., McClelland, T., Adedoyin, C., Broeseker, A., and Adunlin, G. (2020). "Pharmacist Interventions in the Management of Blood Pressure Control and Adherence to Antihypertensive Medications: A Systematic Review of Randomized Controlled Trials." Journal of Pharmacy Practice. Available at https://doi.org/10.1177/0897190020903573. Accessed October 5, 2020

Citation

U.S. Department of Health and Human Services, National Institutes of Health, National Heart, Lung, and Blood Institute & National High Blood Pressure Education Program (2003). The Seventh Report of the Joint National Committee on the Prevention, Detection, Evaluation, and Treatment of High Blood Pressure (JNC-7). NIH Publication No. 03-5233

Citation

U.S. Preventive Services Task Force (USPSTF) (2021). Screening for hypertension in adults. US Preventive Services Task Force reaffirmation recommendation statement. Journal of the American Medical Association, 325(16): 1650-1656. doi:10.1001/jama.2021.4987

Citation

Whelton, P.K., Carey, R.M., Aronow, W.S., Casey, D.E., Collins, K., Dennison Himmelfarb, C., Depalma, S.M., Gidding, S., Jamerson, K.A., Jones, D.W., MacLaughlin, E.J, Muntener, P., Ovbiaggele, B., Smith, S.C., Spencer, C.C., Stafford, R.S., Taler, S.J., Thomas, R.J., Williams, K. A., Williamson, J.D., Wright, J.T., (2018). 2017 ACC/AHA/AAPA/ABC/ACPM/AGS/APhA/ASH/ASPC/NMA/PCNA Guideline for the Prevention, Detection, Evaluation, and Management of High Blood Pressure in Adults: A Report of the American College of Cardiology/American Heart Association Task Force on Clinical Practice Guidelines. Hypertension, 71(6), e13-e115. doi.org/10.1161/HYP.0000000000000065

Citation

Winter, K. H., Tuttle, L. A. & Viera, A.J. (2013). Hypertension. Primary Care Clinics in Office Practice, 40, 179-194. doi:10.1016/j.pop.2012.11.008

Guidance (Usage) This eCQM is an episode-based measure. An episode is defined as each eligible encounter for patients aged 18 years and older during the measurement period. This measure should be reported for every visit. The measure requires that blood pressure measurements (i.e., diastolic and systolic) be obtained during each visit in order to determine the blood pressure reading used to evaluate if an intervention is needed. Both the systolic and diastolic blood pressure measurements are required for inclusion. If there are multiple blood pressures obtained during a patient visit, only the last, or most recent, pressure measurement will be used to evaluate the measure requirements. The intent of this measure is to screen patients for high blood pressure and provide recommended follow-up as indicated. The documented follow-up plan must be related to the current blood pressure reading as indicated, example: "Patient referred to primary care provider for BP management." Telehealth encounters are not eligible for this measure because the measure requires a clinical action that cannot be conducted via telehealth. This FHIR-based measure has been derived from the QDM-based measure: CMS22v14. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU6/index.html) 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 patient visits for patients aged 18 years and older seen during the measurement period who were screened for high blood pressure AND a recommended follow-up plan is documented, as indicated, if blood pressure is elevated or hypertensive
Basis Encounter
Scoring Proportion
Improvement Notation Increased score indicates improvement
Type Process
Initial Population ID: InitialPopulation_1
Description:

All patient visits for patients aged 18 years and older at the beginning of the measurement period

Criteria: Initial Population
Denominator ID: Denominator_1
Description:

Equals Initial Population

Criteria: Denominator
Denominator Exclusion ID: DenominatorExclusion_1
Description:

Patient has an active diagnosis of hypertension

Criteria: Denominator Exclusions
Denominator Exception ID: DenominatorException_1
Description:

Documentation of medical reason(s) for not screening for high blood pressure (e.g., patient is in an urgent or emergent medical situation where time is of the essence and to delay treatment would jeopardize the patient's health status). Documentation of patient reason(s) for not screening for blood pressure measurements or for not ordering an appropriate follow-up intervention if patient BP is elevated or hypertensive (e.g., patient refuses).

Criteria: Denominator Exceptions
Numerator ID: Numerator_1
Description:

Patient visits where patients were screened for high blood pressure AND have a recommended follow-up plan documented, as indicated, if the blood pressure is elevated or hypertensive

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/CMS22FHIRPCSBPScreeningFollowUp
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 Measurement Period" QualifyingEncounter
    where AgeInYearsAt(date from start of "Measurement Period") >= 18
Definition
Denominator
define "Denominator":
  "Initial Population"
Definition
Denominator Exclusion
define "Denominator Exclusions":
  "Qualifying Encounter during Measurement Period" QualifyingEncounter
    with [ConditionProblemsHealthConcerns: "Diagnosis of Hypertension"] Hypertension
      such that Hypertension.prevalenceInterval ( ) starts before or on day of QualifyingEncounter.period
        and Hypertension.isVerified ( )
Definition
Denominator Exception
define "Denominator Exceptions":
  "Encounter with Medical Reason for Not Obtaining or Patient Declined Blood Pressure Measurement"
    union "Encounter with Order for Hypertension Follow Up Declined by Patient"
Definition
Numerator
define "Numerator":
  "Encounter with Normal Blood Pressure Reading"
    union ( "Encounter with Elevated Blood Pressure Reading SBP 120 to 129 AND DBP less than 80 and Interventions" )
    union ( "Encounter with First Hypertensive Reading SBP Greater than or Equal to 130 OR DBP Greater than or Equal to 80 and Interventions" )
    union ( "Encounter with Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89 and Interventions" )
    union ( "Encounter with Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90 and Interventions" )
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: 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: 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: FHIRCommon
/*
@description: Returns an interval representing the normalized prevalence period of a given Condition resource.
@comment: Uses the toInterval and toAbatementInterval functions to determine the widest potential interval from
onset to abatement as specified in the given Condition.
*/
define fluent function prevalenceInterval(condition Condition):
if condition.clinicalStatus ~ "active"
  or condition.clinicalStatus ~ "recurrence"
  or condition.clinicalStatus ~ "relapse" then
  Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]
else
  (end of condition.abatementInterval()) abatementDate
    return 
	  if abatementDate is null then
        Interval[start of condition.onset.toInterval(), abatementDate)
      else
        Interval[start of condition.onset.toInterval(), abatementDate]
Logic Definition Library Name: FHIRCommon
/*
@description: Returns an interval representing the normalized Abatement of a given Condition resource.
@comment: @comment: If the abatement element of the Condition is represented as a DateTime, the result
is an interval beginning and ending on that DateTime.
If 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
result is an interval from the date the patient turned that age to immediately before one year later.
If the abatement is represented as a Quantity Interval, the quantities are expected to be calendar-durations and are interpreted as an age range during
which the abatement occurred. The result is an interval from the date the patient turned the starting age of the quantity interval, and ending immediately
before one year later than the date the patient turned the ending age of the quantity interval.

NOTE: Due to the complexity of determining an interval from a String, this function will throw
a run-time exception if used with a Condition instance that has a String as the abatement value.
*/
define fluent function abatementInterval(condition Condition):
  if condition.abatement is FHIR.dateTime then
    Interval[FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime), FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime)]
  else if condition.abatement is FHIR.Period then
    FHIRHelpers.ToInterval(condition.abatement as FHIR.Period)
  else if condition.abatement 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 if condition.abatement is FHIR.Age then
    Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age),
      FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age) + 1 year)
  else if condition.abatement is FHIR.Range then
    Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((condition.abatement as FHIR.Range).low),
      FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((condition.abatement as FHIR.Range).high) + 1 year)
  else if condition.abatement is FHIR.boolean then
    Interval[end of condition.onset.toInterval(), condition.recordedDate)
  else 
    null
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "SDE Sex":
  SDE."SDE Sex"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Qualifying Encounter during Measurement Period":
  [Encounter: "Encounter to Screen for Blood Pressure"] ValidEncounter
    where ValidEncounter.period ends during day of "Measurement Period"
      and ValidEncounter.status ~ 'finished'
      and ValidEncounter.class !~ "virtual"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with Normal Blood Pressure Reading":
  "Qualifying Encounter during Measurement Period" QualifyingEncounter
    let EncounterLastBP: Last([USCore.BloodPressureProfile] BloodPressure
        where BloodPressure.effective.toInterval ( ) ends during day of QualifyingEncounter.period
          and BloodPressure.status in { 'final', 'amended', 'corrected' }
        sort by start of effective.toInterval ( )
    )
    where ( singleton from ( EncounterLastBP.component C
          where C.code ~ "Systolic blood pressure"
      )
    ).value in Interval[1 'mm[Hg]', 120 'mm[Hg]' )
      and ( singleton from ( EncounterLastBP.component C
            where C.code ~ "Diastolic blood pressure"
        )
      ).value in Interval[1 'mm[Hg]', 80 'mm[Hg]' )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with Elevated Blood Pressure Reading SBP 120 to 129 AND DBP less than 80":
  "Qualifying Encounter during Measurement Period" QualifyingEncounter
    let EncounterLastBP: Last([USCore.BloodPressureProfile] BloodPressure
        where BloodPressure.effective.toInterval ( ) ends during day of QualifyingEncounter.period
          and BloodPressure.status in { 'final', 'amended', 'corrected' }
        sort by start of effective.toInterval ( )
    )
    where ( ( singleton from ( EncounterLastBP.component C
            where C.code ~ "Systolic blood pressure"
        )
      ).value in Interval[120 'mm[Hg]', 129 'mm[Hg]']
        and ( singleton from ( EncounterLastBP.component C
              where C.code ~ "Diastolic blood pressure"
          )
        ).value in Interval[1 'mm[Hg]', 80 'mm[Hg]' )
    )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Follow up with Rescreen Within 6 Months":
  [ServiceRequest: "Follow Up Within 6 Months"] FollowUp
    where FollowUp.intent ~ 'order'
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "NonPharmacological Interventions":
  ( [ServiceRequest: "Lifestyle Recommendation"]
    union [ServiceRequest: "Weight Reduction Recommended"]
    union [ServiceRequest: "Dietary Recommendations"]
    union [ServiceRequest: "Recommendation to Increase Physical Activity"]
    union [ServiceRequest: "Referral or Counseling for Alcohol Consumption"] ) NonPharmaInterventions
    where NonPharmaInterventions.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Referral to Alternate or Primary Healthcare Professional for Hypertensive Reading":
  [ServiceRequest: "Referral to Primary Care or Alternate Provider"] Referral
    where Referral.reasonCode in "Finding of Elevated Blood Pressure or Hypertension"
      and Referral.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with Elevated Blood Pressure Reading SBP 120 to 129 AND DBP less than 80 and Interventions":
  ( "Encounter with Elevated Blood Pressure Reading SBP 120 to 129 AND DBP less than 80" ElevatedEncounter
      with "Follow up with Rescreen Within 6 Months" Twoto6MonthRescreen
        such that Twoto6MonthRescreen.authoredOn during day of ElevatedEncounter.period
      with "NonPharmacological Interventions" NonPharmInterventions
        such that NonPharmInterventions.authoredOn during day of ElevatedEncounter.period
  )
    union ( "Encounter with Elevated Blood Pressure Reading SBP 120 to 129 AND DBP less than 80" ElevatedEncounter
        with "Referral to Alternate or Primary Healthcare Professional for Hypertensive Reading" Referral
          such that Referral.authoredOn during day of ElevatedEncounter.period
    )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with Hypertensive Reading Within Year Prior":
  ( "Qualifying Encounter during Measurement Period" QualifyingEncounter
      let EncounterLastBP: Last([USCore.BloodPressureProfile] BloodPressure
          where BloodPressure.effective.toInterval ( ) ends 1 year or less before or on start of QualifyingEncounter.period
            and BloodPressure.status in { 'final', 'amended', 'corrected' }
          sort by start of effective.toInterval ( )
      )
      where ( ( singleton from ( EncounterLastBP.component C
              where C.code ~ "Systolic blood pressure"
          )
        ).value > 0 'mm[Hg]'
          and ( singleton from ( EncounterLastBP.component C
                where C.code ~ "Diastolic blood pressure"
            )
          ).value > 0 'mm[Hg]'
          and ( ( singleton from ( EncounterLastBP.component C
                  where C.code ~ "Systolic blood pressure"
              )
            ).value >= 130 'mm[Hg]'
              or ( singleton from ( EncounterLastBP.component C
                    where C.code ~ "Diastolic blood pressure"
                )
              ).value >= 80 'mm[Hg]'
          )
      )
  )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with First Hypertensive Reading SBP Greater than or Equal to 130 OR DBP Greater than or Equal to 80":
  ( "Qualifying Encounter during Measurement Period" QualifyingEncounter
      let EncounterLastBP: Last([USCore.BloodPressureProfile] BloodPressure
          where BloodPressure.effective.toInterval ( ) ends during day of QualifyingEncounter.period
            and BloodPressure.status in { 'final', 'amended', 'corrected' }
          sort by start of effective.toInterval ( )
      )
      where ( ( ( singleton from ( EncounterLastBP.component C
                where C.code ~ "Systolic blood pressure"
            )
          ).value > 0 'mm[Hg]'
            and ( singleton from ( EncounterLastBP.component C
                  where C.code ~ "Diastolic blood pressure"
              )
            ).value > 0 'mm[Hg]'
        )
          and ( ( singleton from ( EncounterLastBP.component C
                  where C.code ~ "Systolic blood pressure"
              )
            ).value >= 130 'mm[Hg]'
              or ( singleton from ( EncounterLastBP.component C
                    where C.code ~ "Diastolic blood pressure"
                )
              ).value >= 80 'mm[Hg]'
          )
      )
  )
    except "Encounter with Hypertensive Reading Within Year Prior"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "First Hypertensive Reading Interventions or Referral to Alternate Professional":
  ( [ServiceRequest: "Follow Up Within 4 Weeks"] FourWeekRescreen
      with "NonPharmacological Interventions" NonPharmInterventionsHTN
        such that FourWeekRescreen.authoredOn during day of "Measurement Period"
          and NonPharmInterventionsHTN.authoredOn during day of "Measurement Period"
          and FourWeekRescreen.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
  )
    union ( "Referral to Alternate or Primary Healthcare Professional for Hypertensive Reading" )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with First Hypertensive Reading SBP Greater than or Equal to 130 OR DBP Greater than or Equal to 80 and Interventions":
  "Encounter with First Hypertensive Reading SBP Greater than or Equal to 130 OR DBP Greater than or Equal to 80" FirstHTNEncounter
    with "First Hypertensive Reading Interventions or Referral to Alternate Professional" FirstHTNIntervention
      such that FirstHTNIntervention.authoredOn during day of FirstHTNEncounter.period
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89":
  ( ( "Qualifying Encounter during Measurement Period" QualifyingEncounter
        let EncounterLastBP: Last([USCore.BloodPressureProfile] BloodPressure
            where BloodPressure.effective.toInterval ( ) ends during day of QualifyingEncounter.period
              and BloodPressure.status in { 'final', 'amended', 'corrected' }
            sort by start of effective.toInterval ( )
        )
        where ( ( ( singleton from ( EncounterLastBP.component C
                  where C.code ~ "Systolic blood pressure"
              )
            ).value in Interval[130 'mm[Hg]', 139 'mm[Hg]']
              or ( singleton from ( EncounterLastBP.component C
                    where C.code ~ "Diastolic blood pressure"
                )
              ).value in Interval[80 'mm[Hg]', 89 'mm[Hg]']
          )
            and not ( ( singleton from ( EncounterLastBP.component C
                    where C.code ~ "Systolic blood pressure"
                )
              ).value >= 140 'mm[Hg]'
                or ( singleton from ( EncounterLastBP.component C
                      where C.code ~ "Diastolic blood pressure"
                  )
                ).value >= 90 'mm[Hg]'
            )
        )
    )
      intersect "Encounter with Hypertensive Reading Within Year Prior"
  )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Laboratory Test or ECG for Hypertension":
  ( [ServiceRequest: "12 lead EKG panel"]
    union [ServiceRequest: "EKG study"]
    union [ServiceRequest: "Laboratory Tests for Hypertension"] ) EKGLab
    where EKGLab.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89 and Interventions":
  "Follow up with Rescreen Within 6 Months" Rescreen2to6
    with "Laboratory Test or ECG for Hypertension" LabECGIntervention
      such that Rescreen2to6.authoredOn during day of "Measurement Period"
        and LabECGIntervention.authoredOn during day of "Measurement Period"
    with "NonPharmacological Interventions" NonPharmSecondIntervention
      such that NonPharmSecondIntervention.authoredOn during day of "Measurement Period"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89 and Interventions":
  ( "Encounter with Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89" SecondHTNEncounterReading
      with "Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89 and Interventions" EncounterInterventions
        such that EncounterInterventions.authoredOn during day of SecondHTNEncounterReading.period
  )
    union ( "Encounter with Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89" SecondHTNEncounterReading
        with "Referral to Alternate or Primary Healthcare Professional for Hypertensive Reading" ReferralForHTN
          such that ReferralForHTN.authoredOn during day of SecondHTNEncounterReading.period
    )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90":
  ( ( "Qualifying Encounter during Measurement Period" QualifyingEncounter
        let EncounterLastBP: Last([USCore.BloodPressureProfile] BloodPressure
            where BloodPressure.effective.toInterval ( ) ends during day of QualifyingEncounter.period
              and BloodPressure.status in { 'final', 'amended', 'corrected' }
            sort by start of effective.toInterval ( )
        )
        where ( ( singleton from ( EncounterLastBP.component C
                where C.code ~ "Systolic blood pressure"
            )
          ).value > 0 'mm[Hg]'
            and ( singleton from ( EncounterLastBP.component C
                  where C.code ~ "Diastolic blood pressure"
              )
            ).value > 0 'mm[Hg]'
            and ( ( singleton from ( EncounterLastBP.component C
                    where C.code ~ "Systolic blood pressure"
                )
              ).value >= 140 'mm[Hg]'
                or ( singleton from ( EncounterLastBP.component C
                      where C.code ~ "Diastolic blood pressure"
                  )
                ).value >= 90 'mm[Hg]'
            )
        )
    )
      intersect "Encounter with Hypertensive Reading Within Year Prior"
  )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90 Interventions":
  ( [ServiceRequest: "Follow Up Within 4 Weeks"] WeeksRescreen
      with "Laboratory Test or ECG for Hypertension" ECGLabTest
        such that WeeksRescreen.authoredOn during day of "Measurement Period"
          and ECGLabTest.authoredOn during day of "Measurement Period"
          and WeeksRescreen.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
          and ECGLabTest.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
      with "NonPharmacological Interventions" HTNInterventions
        such that HTNInterventions.authoredOn during day of "Measurement Period"
      with ["MedicationRequest": "Pharmacologic Therapy for Hypertension"] Medications
        such that Medications.authoredOn during day of "Measurement Period"
          and Medications.status in { 'active', 'completed' }
  )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90 and Interventions":
  ( "Encounter with Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90" SecondHTNEncounterReading140Over90
      with "Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90 Interventions" SecondHTN140Over90Interventions
        such that SecondHTN140Over90Interventions.authoredOn during day of SecondHTNEncounterReading140Over90.period
  )
    union "Encounter with Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90" SecondHTNEncounterReading140Over90
      with "Referral to Alternate or Primary Healthcare Professional for Hypertensive Reading" ReferralToProfessional
        such that ReferralToProfessional.authoredOn during day of SecondHTNEncounterReading140Over90.period
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Numerator":
  "Encounter with Normal Blood Pressure Reading"
    union ( "Encounter with Elevated Blood Pressure Reading SBP 120 to 129 AND DBP less than 80 and Interventions" )
    union ( "Encounter with First Hypertensive Reading SBP Greater than or Equal to 130 OR DBP Greater than or Equal to 80 and Interventions" )
    union ( "Encounter with Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89 and Interventions" )
    union ( "Encounter with Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90 and Interventions" )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Initial Population":
  "Qualifying Encounter during Measurement Period" QualifyingEncounter
    where AgeInYearsAt(date from start of "Measurement Period") >= 18
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Denominator":
  "Initial Population"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "SDE Payer":
  SDE."SDE Payer"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "SDE Ethnicity":
  SDE."SDE Ethnicity"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Denominator Exclusions":
  "Qualifying Encounter during Measurement Period" QualifyingEncounter
    with [ConditionProblemsHealthConcerns: "Diagnosis of Hypertension"] Hypertension
      such that Hypertension.prevalenceInterval ( ) starts before or on day of QualifyingEncounter.period
        and Hypertension.isVerified ( )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "SDE Race":
  SDE."SDE Race"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with Medical Reason for Not Obtaining or Patient Declined Blood Pressure Measurement":
  "Qualifying Encounter during Measurement Period" QualifyingEncounter
    with ( [ObservationCancelled: code ~ "Blood pressure panel with all children optional"]
      union [ObservationCancelled: code ~ "Systolic blood pressure"]
      union [ObservationCancelled: code ~ "Diastolic blood pressure"] ) NoBPScreen
      such that NoBPScreen.issued during day of QualifyingEncounter.period
        and ( NoBPScreen.notDoneReason () in "Patient Declined"
            or NoBPScreen.notDoneReason () in "Medical Reason"
        )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "NonPharmacological Intervention Not Ordered":
  ( [ServiceNotRequested: "Lifestyle Recommendation"]
    union [ServiceNotRequested: "Weight Reduction Recommended"]
    union [ServiceNotRequested: "Dietary Recommendations"]
    union [ServiceNotRequested: "Recommendation to Increase Physical Activity"]
    union [ServiceNotRequested: "Referral or Counseling for Alcohol Consumption"] ) NonPharmIntervention
    where NonPharmIntervention.status in { 'active', 'completed', 'on-hold' }
      and NonPharmIntervention.reasonCode in "Patient Declined"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Laboratory Test or ECG for Hypertension Not Ordered":
  ( [ServiceNotRequested: code = "12 lead EKG panel"]
    union [ServiceNotRequested: code = "EKG study"]
    union [ServiceNotRequested: "Laboratory Tests for Hypertension"] ) LabECGNotDone
    where LabECGNotDone.status in { 'active', 'completed', 'on-hold' }
      and LabECGNotDone.reasonCode in "Patient Declined"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89 Interventions Declined":
  ( ( [ServiceNotRequested: "Referral to Primary Care or Alternate Provider"]
      union [ServiceNotRequested: "Follow Up Within 6 Months"] ) SecondHTNDeclinedReferralAndFollowUp
      where SecondHTNDeclinedReferralAndFollowUp.status in { 'active', 'completed', 'on-hold' }
        and SecondHTNDeclinedReferralAndFollowUp.reasonCode in "Patient Declined"
  )
    union "Laboratory Test or ECG for Hypertension Not Ordered"
    union "NonPharmacological Intervention Not Ordered"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90 Interventions Declined":
  ( ( ( [ServiceNotRequested: "Referral to Primary Care or Alternate Provider"]
        union [ServiceNotRequested: "Follow Up Within 4 Weeks"] ) SecondHTN140Over90ReferralFollowUpNotDone
        where SecondHTN140Over90ReferralFollowUpNotDone.status in { 'active', 'completed', 'on-hold' }
          and SecondHTN140Over90ReferralFollowUpNotDone.reasonCode in "Patient Declined"
    )
      union ( [MedicationNotRequested: "Pharmacologic Therapy for Hypertension"] MedicationRequestNotOrdered
          where MedicationRequestNotOrdered.status in { 'active', 'completed' }
      )
      union "Laboratory Test or ECG for Hypertension Not Ordered"
      union "NonPharmacological Intervention Not Ordered"
  )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Encounter with Order for Hypertension Follow Up Declined by Patient":
  ( ( "Encounter with Elevated Blood Pressure Reading SBP 120 to 129 AND DBP less than 80" ElevatedBPEncounter
        with ( [ServiceNotRequested: "Referral to Primary Care or Alternate Provider"]
          union [ServiceNotRequested: "Follow Up Within 6 Months"] ) ElevatedBPDeclinedInterventions
          such that ElevatedBPDeclinedInterventions.authoredOn during day of ElevatedBPEncounter.period
            and ElevatedBPDeclinedInterventions.status in { 'active', 'completed', 'on-hold' }
            and ElevatedBPDeclinedInterventions.reasonCode in "Patient Declined"
    )
      union ( "Encounter with Elevated Blood Pressure Reading SBP 120 to 129 AND DBP less than 80" ElevatedBPEncounter
          with "NonPharmacological Intervention Not Ordered" NotOrdered
            such that NotOrdered.authoredOn during day of ElevatedBPEncounter.period
      )
      union ( "Encounter with First Hypertensive Reading SBP Greater than or Equal to 130 OR DBP Greater than or Equal to 80" FirstHTNEncounter
          with ( [ServiceNotRequested: "Follow Up Within 4 Weeks"]
            union [ServiceNotRequested: "Referral to Primary Care or Alternate Provider"] ) FirstHTNDeclinedInterventions
            such that FirstHTNDeclinedInterventions.authoredOn during day of FirstHTNEncounter.period
              and FirstHTNDeclinedInterventions.status in { 'active', 'completed', 'on-hold' }
              and FirstHTNDeclinedInterventions.reasonCode in "Patient Declined"
      )
      union ( "Encounter with First Hypertensive Reading SBP Greater than or Equal to 130 OR DBP Greater than or Equal to 80" FirstHTNEncounter
          with "NonPharmacological Intervention Not Ordered" NoNonPharm
            such that NoNonPharm.authoredOn during day of FirstHTNEncounter.period
      )
      union ( "Encounter with Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89" SecondHTNEncounter
          with "Second Hypertensive Reading SBP 130 to 139 OR DBP 80 to 89 Interventions Declined" SecondHTNDeclinedInterventions
            such that SecondHTNDeclinedInterventions.authoredOn during day of SecondHTNEncounter.period
      )
      union ( "Encounter with Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90" SecondHTN140Over90Encounter
          with "Second Hypertensive Reading SBP Greater than or Equal to 140 OR DBP Greater than or Equal to 90 Interventions Declined" SecondHTN140Over90DeclinedInterventions
            such that SecondHTN140Over90DeclinedInterventions.authoredOn during day of SecondHTN140Over90Encounter.period
      )
  )
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
define "Denominator Exceptions":
  "Encounter with Medical Reason for Not Obtaining or Patient Declined Blood Pressure Measurement"
    union "Encounter with Order for Hypertension Follow Up Declined by Patient"
Logic Definition Library Name: CMS22FHIRPCSBPScreeningFollowUp
/*
@description: Returns true if the given condition either has no verification status or has a verification status of confirmed, unconfirmed, provisional, or differential
*/


define fluent function isVerified(condition Choice<ConditionProblemsHealthConcerns, ConditionEncounterDiagnosis>):
  condition.verificationStatus is not null implies ( condition.verificationStatus ~ Status."confirmed"
      or condition.verificationStatus ~ Status."unconfirmed"
      or condition.verificationStatus ~ Status."provisional"
      or condition.verificationStatus ~ Status."differential"
  )
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 notDoneReason for an ObservationCancelled
*/
define fluent function notDoneReason(observationCancelled ObservationCancelled):
  observationCancelled.ext('http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-notDoneReason').value as FHIR.CodeableConcept
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
/*
@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 ToString(value EncounterStatus): value.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
        }
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 ObservationStatus): 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
define function ToString(value ServiceRequestIntent): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value MedicationRequestStatus): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value ServiceRequestStatus): value.value
Terminology
Code System Description: Code system SNOMEDCT
Resource: SNOMED CT (all versions)
Canonical URL: http://snomed.info/sct
Code System Description: Code system ActCode
Resource: ActCode
Canonical URL: http://terminology.hl7.org/CodeSystem/v3-ActCode
Code System Description: Code system LOINC
Resource: Logical Observation Identifiers, Names and Codes (LOINC)
Canonical URL: http://loinc.org
Code System Description: Code system ConditionClinicalStatusCodes
Resource: Condition Clinical Status Codes
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-clinical
Code System Description: Code system ConditionVerificationStatusCodes
Resource: ConditionVerificationStatus
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-ver-status
Value Set Description: Value set Encounter to Screen for Blood Pressure
Resource: Encounter to Screen for Blood Pressure
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1920
Value Set Description: Value set Follow Up Within 6 Months
Resource: Follow Up Within 6 Months
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1108.125
Value Set Description: Value set Lifestyle Recommendation
Resource: Lifestyle Recommendation
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1581
Value Set Description: Value set Weight Reduction Recommended
Resource: Weight Reduction Recommended
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1510
Value Set Description: Value set Dietary Recommendations
Resource: Dietary Recommendations
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1515
Value Set Description: Value set Recommendation to Increase Physical Activity
Resource: Recommendation to Increase Physical Activity
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1518
Value Set Description: Value set Referral or Counseling for Alcohol Consumption
Resource: Referral or Counseling for Alcohol Consumption
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1583
Value Set Description: Value set Referral to Primary Care or Alternate Provider
Resource: Referral to Primary Care or Alternate Provider
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1580
Value Set Description: Value set Finding of Elevated Blood Pressure or Hypertension
Resource: Finding of Elevated Blood Pressure or Hypertension
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1047.514
Value Set Description: Value set Follow Up Within 4 Weeks
Resource: Follow Up Within 4 Weeks
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1578
Value Set Description: Value set Laboratory Tests for Hypertension
Resource: Laboratory Tests for Hypertension
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1482
Value Set Description: Value set Pharmacologic Therapy for Hypertension
Resource: Pharmacologic Therapy for Hypertension
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.1577
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
Value Set Description: Value set Diagnosis of Hypertension
Resource: Diagnosis of Hypertension
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.263
Value Set Description: Value set Patient Declined
Resource: Patient Declined
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1582
Value Set Description: Value set Medical Reason
Resource: Medical Reason
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1007
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: virtual
Code: VR
System: http://terminology.hl7.org/CodeSystem/v3-ActCode
Direct Reference Code Display: Systolic blood pressure
Code: 8480-6
System: http://loinc.org
Direct Reference Code Display: Diastolic blood pressure
Code: 8462-4
System: http://loinc.org
Direct Reference Code Display: EKG 12 channel panel
Code: 34534-8
System: http://loinc.org
Direct Reference Code Display: EKG study
Code: 11524-6
System: http://loinc.org
Direct Reference Code Code: active
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Code: recurrence
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Code: relapse
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: confirmed
Code: confirmed
System: http://terminology.hl7.org/CodeSystem/condition-ver-status
Direct Reference Code Display: unconfirmed
Code: unconfirmed
System: http://terminology.hl7.org/CodeSystem/condition-ver-status
Direct Reference Code Display: provisional
Code: provisional
System: http://terminology.hl7.org/CodeSystem/condition-ver-status
Direct Reference Code Display: differential
Code: differential
System: http://terminology.hl7.org/CodeSystem/condition-ver-status
Direct Reference Code Display: Blood pressure panel with all children optional
Code: 85354-9
System: http://loinc.org
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 Status
Resource: Status version: 2.1.000
Canonical URL: https://madie.cms.gov/Library/Status|2.1.000
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, period, status, class
Code Filter(s):
Path: type
ValueSet: Encounter to Screen for Blood Pressure
Path: status
Code(s): [not stated]: finished (finished)
Path: class
Data Requirement Type: Patient
Profile(s): Patient
Must Support Elements: birthDate
Data Requirement Type: Observation
Profile(s): US Core Blood Pressure Profile
Must Support Elements: effective, status, component
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, intent, authoredOn
Code Filter(s):
Path: code
ValueSet: Lifestyle Recommendation
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, intent, authoredOn
Code Filter(s):
Path: code
ValueSet: Weight Reduction Recommended
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, intent, authoredOn
Code Filter(s):
Path: code
ValueSet: Dietary Recommendations
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, intent, authoredOn
Code Filter(s):
Path: code
ValueSet: Recommendation to Increase Physical Activity
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, intent, authoredOn
Code Filter(s):
Path: code
ValueSet: Referral or Counseling for Alcohol Consumption
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, intent, authoredOn
Code Filter(s):
Path: code
ValueSet: Follow Up Within 6 Months
Path: intent
Code(s): [not stated]: order (order)
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, intent, authoredOn
Code Filter(s):
Path: code
Code(s): LOINC: 34534-8 (EKG 12 channel panel)
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, intent, authoredOn
Code Filter(s):
Path: code
Code(s): LOINC: 11524-6 (EKG study)
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, intent, authoredOn
Code Filter(s):
Path: code
ValueSet: Laboratory Tests for Hypertension
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, intent, authoredOn
Code Filter(s):
Path: code
ValueSet: Follow Up Within 6 Months
Path: intent
Code(s): [not stated]: order (order)
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, authoredOn, intent
Code Filter(s):
Path: code
ValueSet: Follow Up Within 4 Weeks
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, reasonCode, intent, authoredOn
Code Filter(s):
Path: code
ValueSet: Referral to Primary Care or Alternate Provider
Data Requirement Type: Medication
Profile(s): Medication
Must Support Elements: id, code
Code Filter(s):
Path: code
ValueSet: Pharmacologic Therapy for Hypertension
Data Requirement Type: MedicationRequest
Profile(s): MedicationRequest
Must Support Elements: medication.reference, authoredOn, status
Data Requirement Type: MedicationRequest
Profile(s): MedicationRequest
Must Support Elements: medication, authoredOn, status
Code Filter(s):
Path: medication
ValueSet: Pharmacologic Therapy for Hypertension
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: Condition
Profile(s): Condition
Must Support Elements: abatement, onset, recordedDate, clinicalStatus
Data Requirement Type: Condition
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-condition-problems-health-concerns
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: Diagnosis of Hypertension
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-observationcancelled
Must Support Elements: code, issued
Code Filter(s):
Path: code
Code(s): LOINC: 85354-9 (Blood pressure panel with all children optional)
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-observationcancelled
Must Support Elements: code, issued
Code Filter(s):
Path: code
Code(s): LOINC: 8480-6 (Systolic blood pressure)
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-observationcancelled
Must Support Elements: code, issued
Code Filter(s):
Path: code
Code(s): LOINC: 8462-4 (Diastolic blood pressure)
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
ValueSet: Lifestyle Recommendation
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
ValueSet: Weight Reduction Recommended
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
ValueSet: Dietary Recommendations
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
ValueSet: Recommendation to Increase Physical Activity
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
ValueSet: Referral or Counseling for Alcohol Consumption
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
Code(s): LOINC: 34534-8 (EKG 12 channel panel)
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
Code(s): LOINC: 11524-6 (EKG study)
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
ValueSet: Laboratory Tests for Hypertension
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
ValueSet: Follow Up Within 6 Months
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
ValueSet: Follow Up Within 4 Weeks
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicenotrequested
Must Support Elements: code, status, reasonCode, authoredOn
Code Filter(s):
Path: code
ValueSet: Referral to Primary Care or Alternate Provider
Data Requirement Type: MedicationRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-medicationnotrequested
Must Support Elements: medication, status
Code Filter(s):
Path: medication
ValueSet: Pharmacologic Therapy for Hypertension
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
Denominator Exclusions Out 0..* Encounter
SDE Race Out 0..1 Resource
Denominator Exceptions Out 0..* Encounter
Generated using version 0.5.4 of the sample-content-ig Liquid templates