Chronic Disease Surveillance
0.1.0 - CI Build International flag

Chronic Disease Surveillance, published by Clinical Quality Framework. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/aphl-chronic-ig/ and changes regularly. See the Directory of published versions

Measure: Controlling High Blood Pressure

Official URL: http://fhir.org/guides/cqf/aphl/chronic-ds/Measure/ControllingHighBloodPressureFHIR Version: 0.1.0
Draft as of 2025-09-25 Computable Name: ControllingHighBloodPressureFHIR
Other Identifiers: short-name#CMS165v12 (use: usual, ), publisher#236 (use: official, ), http://hl7.org/fhir/cqi/ecqm/Measure/Identifier/guid#abdc37cc-bac6-4156-9b91-d1be2c8b7268 (use: official, )

Copyright/Legal: This Physician Performance Measure (Measure) and related data specifications are owned and were developed by the National Committee for Quality Assurance (NCQA). NCQA is not responsible for any use of the Measure. NCQA makes no representations, warranties, or endorsement about the quality of any organization or physician that uses or reports performance measures and NCQA has no liability to anyone who relies on such measures or specifications. NCQA holds a copyright in the Measure. The Measure can be reproduced and distributed, without modification, for noncommercial purposes (e.g., use by healthcare providers in connection with their practices) without obtaining approval from NCQA. Commercial use is defined as the sale, licensing, or distribution of the Measure for commercial gain, or incorporation of the Measure into a product or service that is sold, licensed or distributed for commercial gain. All commercial uses or requests for modification must be approved by NCQA and are subject to a license at the discretion of NCQA. (C) 2012-2022 National Committee for Quality Assurance. All Rights Reserved. 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. NCQA disclaims all liability for use or accuracy of any third-party codes contained in the specifications. CPT(R) codes, descriptions and other data are copyright 2022. American Medical Association. All rights reserved. CPT is a trademark of the American Medical Association. No fee schedules, basic units, relative values or related listings are included in CPT. The AMA assumes no liability for the data contained herein. Applicable FARS/DFARS restrictions apply to government use. LOINC(R) copyright 2004-2022 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2022 International Health Terminology Standards Development Organisation. ICD-10 copyright 2022 World Health Organization. All Rights Reserved.

Percentage of patients 18-85 years of age who had a diagnosis of essential hypertension starting before and continuing into, or starting during the first six months of the measurement period, and whose most recent blood pressure was adequately controlled (<140/90 mmHg) during the measurement period

Unknown

Metadata
Title Controlling High Blood Pressure
Version 0.1.0
Identifier CMS165v12
Identifier 236
Identifier abdc37cc-bac6-4156-9b91-d1be2c8b7268
Effective Period 2024-01-01 through 2024-12-31
Status Draft
Jurisdiction 001 from http://unstats.un.org/unsd/methods/m49/m49.htm
Steward (Publisher) Clinical Quality Framework
Description

Percentage of patients 18-85 years of age who had a diagnosis of essential hypertension starting before and continuing into, or starting during the first six months of the measurement period, and whose most recent blood pressure was adequately controlled (<140/90 mmHg) during the measurement period

Purpose

Unknown

Copyright

This Physician Performance Measure (Measure) and related data specifications are owned and were developed by the National Committee for Quality Assurance (NCQA). NCQA is not responsible for any use of the Measure. NCQA makes no representations, warranties, or endorsement about the quality of any organization or physician that uses or reports performance measures and NCQA has no liability to anyone who relies on such measures or specifications. NCQA holds a copyright in the Measure. The Measure can be reproduced and distributed, without modification, for noncommercial purposes (e.g., use by healthcare providers in connection with their practices) without obtaining approval from NCQA. Commercial use is defined as the sale, licensing, or distribution of the Measure for commercial gain, or incorporation of the Measure into a product or service that is sold, licensed or distributed for commercial gain. All commercial uses or requests for modification must be approved by NCQA and are subject to a license at the discretion of NCQA. (C) 2012-2022 National Committee for Quality Assurance. All Rights Reserved. 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. NCQA disclaims all liability for use or accuracy of any third-party codes contained in the specifications. CPT(R) codes, descriptions and other data are copyright 2022. American Medical Association. All rights reserved. CPT is a trademark of the American Medical Association. No fee schedules, basic units, relative values or related listings are included in CPT. The AMA assumes no liability for the data contained herein. Applicable FARS/DFARS restrictions apply to government use. LOINC(R) copyright 2004-2022 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2022 International Health Terminology Standards Development Organisation. ICD-10 copyright 2022 World Health Organization. All Rights Reserved.

Disclaimer

The performance Measure is not a clinical guideline and 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].

Measure Scoring Proportion
Improvement Notation Lower score indicates better quality
Measure Type intermediateOutcome
Rationale

High blood pressure (HBP), also known as hypertension, is when the pressure in blood vessels is higher than normal (Centers for Disease Control and Prevention [CDC], 2021). The causes of hypertension are multiple and multifaceted and can be based on genetic predisposition, environmental risk factors, being overweight and obese, sodium intake, potassium intake, physical activity, and alcohol use. High blood pressure is common; according to the American Heart Association, between 2013-2016, approximately 121.5 million US adults >= 20 years of age had HBP and the prevalence of hypertension among US adults 65 and older was 77.0 percent (Virani et al., 2021). In an analysis of adults with hypertension in NHANES, the estimated age-adjusted proportion with controlled BP increased from 31.8 percent in 1999 to 53.8 percent in 2014. However, that proportion declined to 43.7 percent in 2017 to 2018 (Tsao et al., 2022). HBP, known as the “silent killer,” increases risks of heart disease and stroke which are two of the leading causes of death in the US; a person who has HBP is four times more likely to die from a stroke and three times more likely to die from heart disease (CDC, 2012). The National Center for Health Statistics reported that in 2020 there were over 670,000 deaths with HBP as a primary or contributing cause (CDC, 2022). Between 2009 and 2019 the number of deaths due to HBP rose by 65.3 percent (Tsao et al., 2022). Managing and treating HBP would reduce cardiovascular disease mortality for males and females by 30.4 percent and 38.0 percent, respectively (Patel et al., 2015). Age-adjusted death rates attributable to HBP in 2019 were more than twice as high in non-Hispanic Black males (56.7 percent) when compared to rates for non-Hispanic White males (25.7 percent) (Tsao et al., 2022). HBP costs the U.S. approximately 131 billion dollars each year, averaged over 12 years from 2003 to 2014 (Kirkland et al., 2018). A study on cost-effectiveness on treating hypertension found that controlling HBP in patients with cardiovascular disease and systolic blood pressures (SBP) of >= 160 mmHg could be effective and cost-saving (Moran, 2015). Many studies have shown that controlling high blood pressure reduces cardiovascular events and mortality. The Systolic Blood Pressure Intervention Trial (SPRINT) investigated the impact of obtaining a SBP goal of <120 mmHg compared to a SBP goal of <140 mmHg among patients 50 and older with established cardiovascular disease and found that the patients with the former goal had reduced cardiovascular events and mortality (SPRINT Research Group et al., 2015). Controlling HBP will significantly reduce the risks of cardiovascular disease mortality and lead to better health outcomes like reduction of heart attacks, stroke, and kidney disease (James et al., 2014). Thus, the relationship between the measure (control of hypertension) and the long-term clinical outcomes listed is well established.

Clinical Recommendation Statement

U.S. Preventive Services Task Force (USPSTF) (2021):

  • The USPSTF recommends screening for hypertension in adults 18 years or older with office blood pressure measurement (OBPM). The USPSTF recommends obtaining blood pressure measurements outside of the clinical setting for diagnostic confirmation before starting treatment. This is a grade A recommendation.

American College of Cardiology/American Heart Association (2017):

  • For adults with confirmed hypertension and known CVD or 10-year ASCVD event risk of 10 percent or higher, a blood pressure target of less than 130/80 mmHg is recommended (Level of evidence: B-R (for systolic blood pressures), Level of evidence: C-EO (for diastolic blood pressure))
  • For adults with confirmed hypertension, without additional markers of increased CVD risk, a blood pressure target of less than 130/80 mmHg may be reasonable (Note: clinical trial evidence is strongest for a target blood pressure of 140/90 mmHg in this population. However, observational studies suggest that these individuals often have a high lifetime risk and would benefit from blood pressure control earlier in life) (Level of evidence: B-NR (for systolic blood pressure), Level of evidence: C-EO (for diastolic blood pressure)).

American College of Physicians and the American Academy of Family Physicians (2017):

  • Initiate or intensify pharmacologic treatment in some adults aged 60 years or older at high cardiovascular risk, based on individualized assessment, to achieve a target systolic blood pressure of less than 140 mmHg (Grade: weak recommendation, Quality of evidence: low)
  • Initiate or intensify pharmacologic treatment in adults aged 60 years or older with a history of stroke or transient ischemic attack to achieve a target systolic blood pressure of less than 140 mmHg to reduce the risk of recurrent stroke (Grade: weak recommendation, Quality of evidence: moderate)

American Diabetes Association (2021):

  • For individuals with diabetes and hypertension at higher cardiovascular risk (existing atherosclerotic cardiovascular disease or 10-year atherosclerotic cardiovascular disease risk >=15 percent), a blood pressure target of <130/80 mmHg may be appropriate, if it can be safely attained (Level of evidence: C)
  • For individuals with diabetes and hypertension at lower risk for cardiovascular disease (10-year atherosclerotic cardiovascular disease risk <15 percent), treat to a blood pressure target of <140/90 mmHg (Level of evidence: A)
Measure Group (Rate)
Initial Population ID: F348D767-1BDE-41AB-884D-5F0E19093980
Description:

Patients 18-85 years of age who had a visit during the measurement period and diagnosis of essential hypertension

Criteria: Initial Population
Denominator ID: 3E0D40B3-64FC-4998-B371-34978D033116
Description:

Patients 18-85 years of age who had a visit during the measurement period and diagnosis of essential hypertension

Criteria: Denominator
Numerator ID: 24803F44-C643-45C7-A2A5-4C58BD540579
Description:

Patients whose most recent blood pressure is adequately controlled (systolic blood pressure < 140 mmHg and diastolic blood pressure < 90 mmHg) during the measurement period

Criteria: Numerator
Denominator Exclusions ID: 95E1480E-8B61-4777-865D-B2A1D6525E1A
Description:

Patients with ESRD or dialysis or renal transplant or pregnancy or in hospice or 66+ in nursing care or 66-80 with frailty and advanced illness or 81+ with frailty or receiving palliative care

Criteria: Denominator Exclusion
Stratifier ID: stratifier-ethnicity
Code: Ethnicity
Description: Ethnicity (CDC Value Set)
Stratifier ID: stratifier-payer
Code: SDE Payer
Description: Payer
Stratifier ID: stratifier-race
Code: SDE Race
Description: Race (CDC Value Set)
Stratifier ID: stratifier-sex
Code: Sex [HL7.v3]
Description: Administrative sex
Stratifier ID: stratifier-age
Code: Age
Description: Age
Stratifier ID: stratifier-state-of-residence
Code: State, district or territory federal abbreviation
Description: State of residence
Stratifier ID: stratifier-postal-code-of-residence
Code: Postal code
Description: Postal code of residence
Stratifier ID: stratifier-food-insecurity-risk-status
Code: Food insecurity risk [HVS]
Description: Food insecurity risk status
Supplemental Data Elements
Supplemental Data Element ID: sde-ethnicity
Usage Code: Supplemental Data
Description: Ethnicity (CDC Value Set)
Logic Definition: SDE Ethnicity
Supplemental Data Element ID: sde-payer
Usage Code: Supplemental Data
Description: Payer
Logic Definition: SDE Payer
Supplemental Data Element ID: sde-race
Usage Code: Supplemental Data
Description: Race (CDC Value Set)
Logic Definition: SDE Race
Supplemental Data Element ID: sde-sex
Usage Code: Supplemental Data
Description: Administrative sex
Logic Definition: SDE Sex
Supplemental Data Element ID: sde-age
Usage Code: Supplemental Data
Description: Age
Logic Definition: SDE Age
Supplemental Data Element ID: sde-state-of-residence
Usage Code: Supplemental Data
Description: State of residence
Logic Definition: SDE State of Residence
Supplemental Data Element ID: sde-postal-code-of-residence
Usage Code: Supplemental Data
Description: Postal code of residence
Logic Definition: SDE Postal Code of Residence
Supplemental Data Element ID: sde-food-insecurity-risk-status
Usage Code: Supplemental Data
Description: Food insecurity risk status
Logic Definition: SDE Food Insecurity Risk Status
Measure Logic
Primary Library ControllingHighBloodPressureFHIR
Contents Population Criteria
Logic Definitions
Terminology
Dependencies
Data Requirements
Population Criteria
Measure Group (Rate)
Initial Population
define "Initial Population":
  AgeInYearsAt(date from end of "Measurement Period") in Interval[18, 85]
		and exists "Essential Hypertension Diagnosis"
		and exists AdultOutpatientEncounters."Qualifying Encounters"
Definition
Denominator
define "Denominator":
	"Initial Population"
Definition
Numerator
define "Numerator":
	"Has Diastolic Blood Pressure Less Than 90"
	    and "Has Systolic Blood Pressure Less Than 140"
Definition
Denominator Exclusions
define "Denominator Exclusion":
  Hospice."Has Hospice"
    or exists ("Pregnancy Or Renal Diagnosis")
    or exists ("End Stage Renal Disease Procedures")
    or exists ("End Stage Renal Disease Encounter")
    or FrailtyLTI."Is Age 66 to 80 with Advanced Illness and Frailty or Is Age 81 or Older with Frailty"
    or FrailtyLTI."Is Age 66 or Older Living Long Term in a Nursing Home"
    or PalliativeCare."Palliative Care in the Measurement Period"
Definition
Stratifier
define "SDE Ethnicity":
  (flatten (
      Patient.extension Extension
        where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'
          return Extension.extension
    )) E
      where E.url = 'ombCategory'
        or E.url = 'detailed'
      return E.value as Coding
Definition
Stratifier
define "SDE Ethnicity":
  SDE."SDE Ethnicity"
Definition
Stratifier
define "SDE Payer":
  [Coverage: type in "Payer"] Payer
        return {
          code: Payer.type,
          period: Payer.period
        }
Definition
Stratifier
define "SDE Payer":
  SDE."SDE Payer"
Definition
Stratifier
define "SDE Race":
  (flatten (
      Patient.extension Extension
        where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'
          return Extension.extension
    )) E
      where E.url = 'ombCategory'
        or E.url = 'detailed'
      return E.value as Coding
Definition
Stratifier
define "SDE Race":
  SDE."SDE Race"
Definition
Stratifier
define "SDE Sex":
  case
      when Patient.gender = 'male' then Code { code: 'M', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Male' }
      when Patient.gender = 'female' then Code { code: 'F', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Female' }
      else null
    end
Definition
Stratifier
define "SDE Sex":
  SDE."SDE Sex"
Definition
Stratifier
define "SDE Age":
  SurveillanceDataElements."Age"
Definition
Stratifier
define "SDE State of Residence":
  SurveillanceDataElements."State of Residence"
Definition
Stratifier
define "SDE Postal Code of Residence":
  SurveillanceDataElements."Postal Code of Residence"
Definition
Stratifier
define "SDE Food Insecurity Risk Status":
  SurveillanceDataElements."Food Insecurity Risk Status"
Definition
Logic Definitions
Logic Definition Library Name: AdultOutpatientEncountersFHIR4
define "Qualifying Encounters":
  (
	[Encounter: "Office Visit"]
      union [Encounter: "Annual Wellness Visit"]
      union [Encounter: "Preventive Care Services - Established Office Visit, 18 and Up"]
      union [Encounter: "Preventive Care Services - Initial Office Visit, 18 and Up"]
      union [Encounter: "Home Healthcare Services"]
      union [Encounter: "Online Assessments"]
      union [Encounter: "Telephone Visits"]
  ) ValidEncounters
    where FC.ToInterval(ValidEncounters.period) during "Measurement Period"
	  and ValidEncounters.status ~ 'finished' or ValidEncounters.status ~ 'in-progress'
Logic Definition Library Name: SurveillanceDataElementsFHIR4
// Jurisdiction of residence (jurisdiction of the patient)
define "Most recent physical home address":
  First(
    Patient.address A
      where A.use = 'home'
        and A.type = 'physical'
      sort by end of period desc
  )
Logic Definition Library Name: SurveillanceDataElementsFHIR4
define "Postal Code of Residence":
  "Most recent physical home address".postalCode
Logic Definition Library Name: SurveillanceDataElementsFHIR4
define "State of Residence":
  "Most recent physical home address".state
Logic Definition Library Name: SurveillanceDataElementsFHIR4
// Jurisdiction of care (jurisdiction of the most recent encounter)
// TODO:
//define "Most recent address of care":

// NOTE: Included in eICR
// Occupational Data for Health - Past or Present Job
// http://hl7.org/fhir/us/odh/StructureDefinition-odh-PastOrPresentJob.html
// Observation: LOINC#11341-5, valueCodeableConcept in https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7186

// Social Determinants of Health (SDOH)
// http://build.fhir.org/ig/HL7/fhir-sdoh-clinicalcare/StructureDefinition-SDOHCC-ObservationScreeningResponse.html
// Food insecurity risk: http://build.fhir.org/ig/HL7/fhir-sdoh-clinicalcare/Observation-SDOHCC-ObservationResponseHungerVitalSignQuestion3Example.html
// Observation: LOINC#88124-3, valueCodeableConcept in https://loinc.org/LL2510-7/ (At risk, No risk)
define "Food Insecurity Risk Status":
  First(
    [Observation: "Food insecurity risk [HVS]"] O
      sort by issued desc
  ).value as CodeableConcept
Logic Definition Library Name: SurveillanceDataElementsFHIR4
// Age
define "Age":
  AgeInYearsAt(end of "Measurement Period")
Logic Definition Library Name: HospiceFHIR4
define "Has Hospice":
  exists(
    (AC.QualifiedEncounters([Encounter: "Encounter Inpatient"])) HospiceInp
      where (HospiceInp.hospitalization.dischargeDisposition ~ "Discharge to home for hospice care (procedure)"
        or HospiceInp.hospitalization.dischargeDisposition ~ "Discharge to healthcare facility for hospice care (procedure)")
      and FC.ToInterval(HospiceInp.period) ends during "Measurement Period"
  ) or exists(
    (AC.QualifiedEncounters([Encounter: "Hospice Encounter"])) HospiceEnc
      where FC.ToInterval(HospiceEnc.period) overlaps "Measurement Period"
  ) or exists(
    (AC.QualifiedObservations([Observation: "Hospice care [Minimum Data Set]"])) HospiceObs
      where HospiceObs.value ~ ToConcept("Yes (qualifier value)")
        and FC.ToInterval(HospiceObs.effective) overlaps "Measurement Period"
  ) or exists(
    (AC.QualifiedServiceRequests([ServiceRequest: "Hospice Care Ambulatory"])) HospiceSR
      where FC.ToInterval(HospiceSR.authoredOn) during "Measurement Period"
  ) or exists(
    (AC.QualifiedProcedures([Procedure: "Hospice Care Ambulatory"])) HospiceProc
      where FC.ToInterval(HospiceProc.performed) overlaps "Measurement Period"
  ) or exists(
    (AC.QualifiedConditions([Condition: "Hospice Diagnosis"])) HospiceCareDiagnosis
      where FC.ToPrevalenceInterval(HospiceCareDiagnosis) overlaps "Measurement Period"
  )
Logic Definition Library Name: AdvancedIllnessandFrailtyExclusionECQMFHIR4
define "Has Criteria Indicating Frailty":
  exists(
    (AC.QualifiedDeviceRequests([DeviceRequest: "Frailty Device"])) FrailtyDeviceOrder
      where FrailtyDeviceOrder.authoredOn during day of "Measurement Period"
    ) 
    or exists(
        (AC.QualifiedObservations([Observation: "Medical Equipment Used"])) EquipmentUsed
          where EquipmentUsed.value in "Frailty Device"
            and FC.ToInterval(EquipmentUsed.effective) ends during day of "Measurement Period"
    )
    or exists(
      (AC.QualifiedConditions([Condition: "Frailty Diagnosis"])) FrailtyDiagnosis
        where FC.ToPrevalenceInterval(FrailtyDiagnosis) overlaps "Measurement Period"
    )
    or exists(
      (AC.QualifiedEncounters([Encounter: "Frailty Encounter"])) FrailtyEnc
        where FC.ToInterval(FrailtyEnc.period) overlaps "Measurement Period"
    )
    or exists(
      (AC.QualifiedObservations([Observation: "Frailty Symptom"])) FrailtySymptom
        where FC.ToInterval(FrailtySymptom.effective) overlaps "Measurement Period"
    )
Logic Definition Library Name: AdvancedIllnessandFrailtyExclusionECQMFHIR4
define "Up To One Year Prior Including Measurement Period":
  Interval[start of "Measurement Period" - 1 year, end of "Measurement Period"]
Logic Definition Library Name: AdvancedIllnessandFrailtyExclusionECQMFHIR4
define "Outpatient Encounters With Advanced Illness":
  ((AC.QualifiedEncounters([Encounter: "Outpatient"]))
    union (AC.QualifiedEncounters([Encounter: "Observation"]))
    union (AC.QualifiedEncounters([Encounter: "Emergency Department Visit"]))
    union (AC.QualifiedEncounters([Encounter: "Nonacute Inpatient"]))) OutpatientEnc
      with (AC.QualifiedConditions([Condition: "Advanced Illness"])) AdvanIll
        such that FC.ToPrevalenceInterval(AdvanIll) overlaps "Measurement Period"
      and FC.ToInterval(OutpatientEnc.period) overlaps "Up To One Year Prior Including Measurement Period"
Logic Definition Library Name: AdvancedIllnessandFrailtyExclusionECQMFHIR4
define "Has Two Outpatient Encounters With Advanced Illness on Different Dates of Service":
  from
    "Outpatient Encounters With Advanced Illness" OutpatientEncounter1,
    "Outpatient Encounters With Advanced Illness" OutpatientEncounter2
  where OutpatientEncounter2.period ends 1 day or more after day of end of OutpatientEncounter1.period
  return OutpatientEncounter1
Logic Definition Library Name: AdvancedIllnessandFrailtyExclusionECQMFHIR4
define "Has Inpatient Encounter With Advanced Illness":  
  (AC.QualifiedEncounters([Encounter: "Acute Inpatient"])) InpatientEnc
    with (AC.QualifiedConditions([Condition: "Advanced Illness"])) AdvanIll
      such that FC.ToPrevalenceInterval(AdvanIll) overlaps InpatientEnc.period
        and FC.ToInterval(InpatientEnc.period) overlaps "Up To One Year Prior Including Measurement Period"
Logic Definition Library Name: AdvancedIllnessandFrailtyExclusionECQMFHIR4
define "Has Dementia Medications In Year Before or During Measurement Period":
  (AC.QualifiedMedicationRequests([MedicationRequest: "Dementia Medications"])) DementiaMed
    where exists(
      DementiaMed.dosageInstruction dosage
      where exists(
        FC.ToTimingInterval(dosage.timing)) timing
        where timing overlaps "Up To One Year Prior Including Measurement Period")
Logic Definition Library Name: AdvancedIllnessandFrailtyExclusionECQMFHIR4
define "Is Age 66 to 80 with Advanced Illness and Frailty or Is Age 81 or Older with Frailty":
  (
    AgeInYearsAt(date from end of "Measurement Period") in Interval[66, 80]
      and "Has Criteria Indicating Frailty"
      and (
        exists("Has Two Outpatient Encounters With Advanced Illness on Different Dates of Service")
        or exists("Has Inpatient Encounter With Advanced Illness")
        or exists("Has Dementia Medications In Year Before or During Measurement Period")
      )
  ) 
  or (
    AgeInYearsAt(date from end of "Measurement Period") >= 81
      and "Has Criteria Indicating Frailty"
  )
Logic Definition Library Name: AdvancedIllnessandFrailtyExclusionECQMFHIR4
define "Lives In A Nursing Home":
  Last(
    (AC.QualifiedObservations([Observation: "Housing Status"])) HousingStatus
      where FC.ToInterval(HousingStatus.effective) ends on or before end of "Measurement Period"
        and HousingStatus.value ~ ToConcept("Lives In A Nursing Home (finding)")
    sort by issued ascending
  ) is not null
Logic Definition Library Name: AdvancedIllnessandFrailtyExclusionECQMFHIR4
define "Is Age 66 or Older Living Long Term in a Nursing Home":
  AgeInYearsAt(date from end of "Measurement Period") >= 66
    and "Lives In A Nursing Home"
Logic Definition Library Name: PalliativeCareFHIR
define "Palliative Care in the Measurement Period":
  exists(
    (AC.QualifiedObservations([Observation: "Functional Assessment of Chronic Illness Therapy - Palliative Care Questionnaire (FACIT-Pal)"])) PalliativeObservation
      where FC.ToInterval(PalliativeObservation.effective) overlaps "Measurement Period"
  ) or exists(
    (AC.QualifiedConditions([Condition: "Palliative Care Diagnosis"])) PalliativeDiagnosis
      where FC.ToPrevalenceInterval(PalliativeDiagnosis) overlaps "Measurement Period"
  ) or exists(
    (AC.QualifiedEncounters([Encounter: "Palliative Care Encounter"])) PalliativeEncounter
      where FC.ToInterval(PalliativeEncounter.period) overlaps "Measurement Period"
  ) or exists(
    (AC.QualifiedProcedures([Procedure: "Palliative Care Intervention"])) PalliativeProcedure
      where FC.ToInterval(PalliativeProcedure.performed) overlaps "Measurement Period"
  )
Logic Definition Library Name: SupplementalDataElementsFHIR4
define "SDE Sex":
  case
      when Patient.gender = 'male' then Code { code: 'M', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Male' }
      when Patient.gender = 'female' then Code { code: 'F', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Female' }
      else null
    end
Logic Definition Library Name: SupplementalDataElementsFHIR4
define "SDE Payer":
  [Coverage: type in "Payer"] Payer
        return {
          code: Payer.type,
          period: Payer.period
        }
Logic Definition Library Name: SupplementalDataElementsFHIR4
define "SDE Ethnicity":
  (flatten (
      Patient.extension Extension
        where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'
          return Extension.extension
    )) E
      where E.url = 'ombCategory'
        or E.url = 'detailed'
      return E.value as Coding
Logic Definition Library Name: SupplementalDataElementsFHIR4
define "SDE Race":
  (flatten (
      Patient.extension Extension
        where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'
          return Extension.extension
    )) E
      where E.url = 'ombCategory'
        or E.url = 'detailed'
      return E.value as Coding
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "SDE Sex":
  SDE."SDE Sex"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "SDE Postal Code of Residence":
  SurveillanceDataElements."Postal Code of Residence"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Qualifying Diastolic Blood Pressure Reading":
	[Observation: "Blood pressure"] BloodPressure
    without ([Encounter: "Encounter Inpatient"]
      union [Encounter: "Emergency Department Evaluation and Management Visit"]) DisqualifyingEncounter
      such that Common.Latest(BloodPressure.effective) during day of DisqualifyingEncounter.period
    where BloodPressure.status in {'final', 'amended'}
      and Common.Latest(BloodPressure.effective) during "Measurement Period"
      and exists (
        BloodPressure.component DiastolicBP
          where DiastolicBP.code ~ "Diastolic blood pressure"
            and (DiastolicBP.value as Quantity).code.value = 'mm[Hg]'
      )
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Qualifying Systolic Blood Pressure Reading":
	[Observation: "Blood pressure"] BloodPressure
    without ([Encounter: "Encounter Inpatient"]
      union [Encounter: "Emergency Department Evaluation and Management Visit"]) DisqualifyingEncounter
      such that Common.Latest(BloodPressure.effective) during day of DisqualifyingEncounter.period
    where BloodPressure.status in {'final', 'amended'}
      and Common.Latest(BloodPressure.effective) during "Measurement Period"
      and exists (
        BloodPressure.component SystolicBP
          where SystolicBP.code ~ "Systolic blood pressure"
            and (SystolicBP.value as Quantity).code.value = 'mm[Hg]'
      )
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Blood Pressure Days":
	("Qualifying Diastolic Blood Pressure Reading" DBPExam 
        return Common.Latest(DBPExam.effective)
    ) 
        intersect ("Qualifying Systolic Blood Pressure Reading" SBPExam 
            return Common.Latest(SBPExam.effective)
        )
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Most Recent Blood Pressure Day":
	Max("Blood Pressure Days")
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Lowest Diastolic Reading on Most Recent Blood Pressure Day":
	First(
        "Qualifying Diastolic Blood Pressure Reading" DBPReading
		    where Common.Earliest(DBPReading.effective) same day as "Most Recent Blood Pressure Day"
        return singleton from (
            DBPReading.component C
                where C.code ~ "Diastolic blood pressure"
                return C.value as FHIR.Quantity
        ) sort ascending
	)
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Has Diastolic Blood Pressure Less Than 90":
    "Lowest Diastolic Reading on Most Recent Blood Pressure Day" < 90 'mm[Hg]'
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Lowest Systolic Reading on Most Recent Blood Pressure Day":
	First(
        "Qualifying Systolic Blood Pressure Reading" SBPReading
		    where Common.Latest(SBPReading.effective) same day as "Most Recent Blood Pressure Day"
        return singleton from (
            SBPReading.component C
                where C.code ~ "Systolic blood pressure"
                return C.value as FHIR.Quantity
        ) sort ascending
    )
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Has Systolic Blood Pressure Less Than 140":
	"Lowest Systolic Reading on Most Recent Blood Pressure Day" < 140 'mm[Hg]'
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Numerator":
	"Has Diastolic Blood Pressure Less Than 90"
	    and "Has Systolic Blood Pressure Less Than 140"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Essential Hypertension Diagnosis":
	[Condition: "Essential Hypertension"] Hypertension
    where Hypertension.verificationStatus ~ Common."confirmed"
      and Common."Prevalence Period"(Hypertension) overlaps Interval[start of "Measurement Period", start of "Measurement Period" + 6 months]
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Initial Population":
  AgeInYearsAt(date from end of "Measurement Period") in Interval[18, 85]
		and exists "Essential Hypertension Diagnosis"
		and exists AdultOutpatientEncounters."Qualifying Encounters"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Denominator":
	"Initial Population"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "SDE Payer":
  SDE."SDE Payer"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "SDE State of Residence":
  SurveillanceDataElements."State of Residence"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "SDE Food Insecurity Risk Status":
  SurveillanceDataElements."Food Insecurity Risk Status"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "SDE Ethnicity":
  SDE."SDE Ethnicity"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "SDE Age":
  SurveillanceDataElements."Age"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Pregnancy Or Renal Diagnosis":
	( [Condition: "Pregnancy"]
		union [Condition: "End Stage Renal Disease"]
		union [Condition: "Kidney Transplant Recipient"]
		union [Condition: "Chronic Kidney Disease, Stage 5"] ) PregnancyESRDDiagnosis
      where PregnancyESRDDiagnosis.verificationStatus ~ Common."confirmed"
        and PregnancyESRDDiagnosis.recordedDate during "Measurement Period"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "End Stage Renal Disease Procedures":
	([Procedure: "Kidney Transplant"]
		union [Procedure: "Dialysis Services"]) ESRDProcedure
		    where ESRDProcedure.status = 'completed'
                and end of Common."Normalize Interval"(ESRDProcedure.performed) on or before end of "Measurement Period"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "End Stage Renal Disease Encounter":
	[Encounter: "ESRD Monthly Outpatient Services"] ESRDEncounter
		where ESRDEncounter.status in { 'arrived', 'triaged', 'in-progress', 'onleave', 'finished' }
		  and ESRDEncounter.period starts on or before end of "Measurement Period"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "Denominator Exclusion":
  Hospice."Has Hospice"
    or exists ("Pregnancy Or Renal Diagnosis")
    or exists ("End Stage Renal Disease Procedures")
    or exists ("End Stage Renal Disease Encounter")
    or FrailtyLTI."Is Age 66 to 80 with Advanced Illness and Frailty or Is Age 81 or Older with Frailty"
    or FrailtyLTI."Is Age 66 or Older Living Long Term in a Nursing Home"
    or PalliativeCare."Palliative Care in the Measurement Period"
Logic Definition Library Name: ControllingHighBloodPressureFHIR
define "SDE Race":
  SDE."SDE Race"
Logic Definition Library Name: MATGlobalCommonFunctionsFHIR4
/*
Returns an interval representing the period during which the condition was prevalent (i.e. onset to abatement)
If the condition is "active", then abatement being unknown
would indicate the condition is ongoing, and the ending boundary of the prevalence
period is inclusive, otherwise, the abatement is considered unknown and the ending boundary
of the prevalence period is exclusive.
Note that when using this function it should be noted that many clinical systems
do not actually capture abatement, so care should be taken when using this function
to meet clinical intent.
*/
define function "Prevalence Period"(condition Condition ):
  if condition.clinicalStatus ~ "active"
    or condition.clinicalStatus ~ "recurrence"
    or condition.clinicalStatus ~ "relapse" then
    Interval[start of "Normalize Interval"(condition.onset), end of "Normalize Abatement"(condition)]
  else
    Interval[start of "Normalize Interval"(condition.onset), end of "Normalize Abatement"(condition))
Logic Definition Library Name: MATGlobalCommonFunctionsFHIR4
/**
* Returns an interval representing the abatement of the given condition, if an
abatement element is present, null otherwise.
This function uses the semantics of Normalize Interval to interpret the abatement
element.
*/
define function "Normalize Abatement"(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, '1', 'Error', 'Cannot compute an interval from a String value')
	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 "Normalize Interval"(condition.onset), condition.recordedDate)
	else null
Logic Definition Library Name: AlphoraCommon
/* Common Resource Qualifications and Negations */
define function QualifiedEncounters(value List<FHIR.Encounter>):
  value Encounter
    where (
      //planned | arrived | triaged | in-progress | onleave | finished | cancelled | entered-in-error | unknown
      Encounter.status ~ 'arrived'
      or Encounter.status ~ 'in-progress'
      or Encounter.status ~ 'finished'
      or Encounter.status ~ 'onleave'
      or Encounter.status ~ 'triaged'
    )
Logic Definition Library Name: AlphoraCommon
define function QualifiedObservations(value List<FHIR.Observation>):
  value Observation
		where (
      //registered | preliminary | final | amended | corrected | cancelled | entered-in-error | unknown
      Observation.status ~ 'final'
			or Observation.status ~ 'amended'
			or Observation.status ~ 'corrected'
		)
Logic Definition Library Name: AlphoraCommon
define function QualifiedServiceRequests(value List<FHIR.ServiceRequest>):
  value ServiceRequest
    where (
      //draft | active | on-hold | revoked | completed | entered-in-error | unknown
      ServiceRequest.status ~ 'active'
      or ServiceRequest.status ~ 'completed'
      and ServiceRequest.intent ~ 'order'
    )
    and (
      ServiceRequest.doNotPerform is null
      or ServiceRequest.doNotPerform = false
    )
Logic Definition Library Name: AlphoraCommon
define function QualifiedProcedures(value List<FHIR.Procedure>):
  value Procedure
    where (
      //preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown
      Procedure.status ~ 'completed'
    )
Logic Definition Library Name: AlphoraCommon
define function QualifiedConditions(value List<FHIR.Condition>):
  value Condition
    where (
      FHIRHelpers.ToConcept(Condition.clinicalStatus) ~ FC."active"
    )
    and (
      FHIRHelpers.ToConcept(Condition.verificationStatus) ~ FC."confirmed"
    )
Logic Definition Library Name: AlphoraCommon
define function QualifiedDeviceRequests(value List<FHIR.DeviceRequest>):
  value DeviceRequest
    where (
      //draft | active | on-hold | revoked | completed | entered-in-error | unknown
      DeviceRequest.status ~ 'completed'
      or DeviceRequest.status ~ 'active'
      and DeviceRequest.intent ~ 'order'
    )
Logic Definition Library Name: AlphoraCommon
define function QualifiedMedicationRequests(value List<FHIR.MedicationRequest>):
  value MedicationRequest
    where (
      //active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown
      (MedicationRequest.status ~ 'active'
        or MedicationRequest.status ~ 'completed'
      )
        and (
          MedicationRequest.doNotPerform is null
          or MedicationRequest.doNotPerform = false
        )
        and MedicationRequest.intent ~ 'order'
    )
Logic Definition Library Name: FHIRHelpers
define function ToString(value AdministrativeGender): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value AddressUse): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value AddressType): value.value
Logic Definition Library Name: FHIRHelpers
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 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
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
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 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 ToDate(value date): value.value
Logic Definition Library Name: FHIRHelpers
define function ToDateTime(value instant): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value EncounterStatus): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value uri): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value ServiceRequestStatus): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value ServiceRequestIntent): value.value
Logic Definition Library Name: FHIRHelpers
define function ToBoolean(value boolean): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value ProcedureStatus): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value DeviceRequestStatus): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value RequestIntent): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value string): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value MedicationRequestStatus): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value MedicationRequestIntent): value.value
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 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
			//Interval[FHIRHelpers.ToDateTime(choice as FHIR.timing), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]
		  Message(null as Interval<DateTime>, true, '1', 'Error', 'Cannot compute a single interval from a Timing type')
    when choice is FHIR.string then
      Message(null as Interval<DateTime>, true, '1', 'Error', 'Cannot compute an interval from a String value')
		else
			null as Interval<DateTime>
	end
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 function ToPrevalenceInterval(condition Condition):
if condition.clinicalStatus ~ "active"
  or condition.clinicalStatus ~ "recurrence"
  or condition.clinicalStatus ~ "relapse" then
  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]
else
  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))
Logic Definition Library Name: FHIRCommon
/*
@description: Returns an interval representing the normalized Abatement of a given Condition resource.
@comment: 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 function ToAbatementInterval(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, '1', 'Error', 'Cannot compute an interval from a String value')
	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 ToInterval(condition.onset), condition.recordedDate)
	else null
Logic Definition Library Name: FHIRCommon
define function ToTimingInterval(timing FHIR.Timing):
  convert (
    NullToEmptyInterval(ToIntervalFromList(timing.event))
    union NullToEmptyInterval({ToInterval(timing.repeat.bounds as FHIR.Period)})
  ) to List<Interval<DateTime>> except { null }
Logic Definition Library Name: FHIRCommon
define function NullToEmptyInterval(value List<Interval<DateTime>>):
  if value is not null then value else { }
Logic Definition Library Name: FHIRCommon
define function ToIntervalFromList(value List<FHIR.dateTime>):
  value v
    return ToInterval(v)
Terminology
Code System Description: Code system LOINC
Resource: Logical Observation Identifiers, Names and Codes (LOINC)
Canonical URL: http://loinc.org
Code System Description: Code system ConditionVerificationStatusCodes
Resource: ConditionVerificationStatus
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-ver-status
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 SNOMEDCT
Resource: SNOMED CT (all versions)
Canonical URL: http://snomed.info/sct
Value Set Description: Value set Encounter Inpatient
Resource: Encounter Inpatient
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Value Set Description: Value set Emergency Department Evaluation and Management Visit
Resource: Emergency Department Visit
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010
Value Set Description: Value set Essential Hypertension
Resource: Essential Hypertension
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.104.12.1011
Value Set Description: Value set Office Visit
Resource: Office Visit
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001
Value Set Description: Value set Annual Wellness Visit
Resource: Annual Wellness Visit
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1240
Value Set Description: Value set Preventive Care Services - Established Office Visit, 18 and Up
Resource: Preventive Care Services - Established Office Visit, 18 and Up
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1025
Value Set Description: Value set Preventive Care Services - Initial Office Visit, 18 and Up
Resource: Preventive Care Services-Initial Office Visit, 18 and Up
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1023
Value Set Description: Value set Home Healthcare Services
Resource: Home Healthcare Services
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1016
Value Set Description: Value set Online Assessments
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089
Value Set Description: Value set Telephone Visits
Resource: Telephone Visits
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080
Value Set Description: Value set Payer
Resource: Payer
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Value Set Description: Value set Hospice Encounter
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003
Value Set Description: Value set Hospice Care Ambulatory
Resource: Hospice care ambulatory
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1108.15
Value Set Description: Value set Hospice Diagnosis
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165
Value Set Description: Value set Pregnancy
Resource: Pregnancy
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.378
Value Set Description: Value set End Stage Renal Disease
Resource: End Stage Renal Disease
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.353
Value Set Description: Value set Kidney Transplant Recipient
Resource: Kidney Transplant Recipient
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.109.12.1029
Value Set Description: Value set Chronic Kidney Disease, Stage 5
Resource: Chronic Kidney Disease, Stage 5
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1002
Value Set Description: Value set Kidney Transplant
Resource: Kidney Transplant
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.109.12.1012
Value Set Description: Value set Dialysis Services
Resource: Dialysis Services
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.109.12.1013
Value Set Description: Value set ESRD Monthly Outpatient Services
Resource: ESRD Monthly Outpatient Services
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.109.12.1014
Value Set Description: Value set Frailty Device
Resource: Frailty Device
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.118.12.1300
Value Set Description: Value set Frailty Diagnosis
Resource: Frailty Diagnosis
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.113.12.1074
Value Set Description: Value set Frailty Encounter
Resource: Frailty Encounter
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1088
Value Set Description: Value set Frailty Symptom
Resource: Frailty Symptom
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.113.12.1075
Value Set Description: Value set Outpatient
Resource: Outpatient
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1087
Value Set Description: Value set Observation
Resource: Observation
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1086
Value Set Description: Value set Nonacute Inpatient
Resource: Nonacute Inpatient
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1084
Value Set Description: Value set Advanced Illness
Resource: Advanced Illness
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.110.12.1082
Value Set Description: Value set Acute Inpatient
Resource: Acute Inpatient
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1083
Value Set Description: Value set Dementia Medications
Resource: Dementia Medications
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.196.12.1510
Value Set Description: Value set Palliative Care Diagnosis
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1167
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1167
Value Set Description: Value set Palliative Care Encounter
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1090
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1090
Value Set Description: Value set Palliative Care Intervention
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1135
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1135
Direct Reference Code Display: blood pressure
Code: 85354-9
System: http://loinc.org
Direct Reference Code Display: Diastolic blood pressure
Code: 8462-4
System: http://loinc.org
Direct Reference Code Display: Systolic blood pressure
Code: 8480-6
System: http://loinc.org
Direct Reference Code Display: confirmed
Code: confirmed
System: http://terminology.hl7.org/CodeSystem/condition-ver-status
Direct Reference Code Display: active
Code: active
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: recurrence
Code: recurrence
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: relapse
Code: relapse
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: Food insecurity risk [HVS]
Code: 88124-3
System: http://loinc.org
Direct Reference Code Display: Discharge to home for hospice care (procedure)
Code: 428361000124107
System: http://snomed.info/sct
Direct Reference Code Display: Discharge to healthcare facility for hospice care (procedure)
Code: 428371000124100
System: http://snomed.info/sct
Direct Reference Code Display: Hospice care [Minimum Data Set]
Code: 45755-6
System: http://loinc.org
Direct Reference Code Display: Yes (qualifier value)
Code: 373066001
System: http://snomed.info/sct
Direct Reference Code Display: Medical equipment used
Code: 98181-1
System: http://loinc.org
Direct Reference Code Display: Housing status
Code: 71802-3
System: http://loinc.org
Direct Reference Code Display: Lives in a nursing home (finding)
Code: 160734000
System: http://snomed.info/sct
Direct Reference Code Display: Functional Assessment of Chronic Illness Therapy - Palliative Care Questionnaire (FACIT-Pal)
Code: 71007-9
System: http://loinc.org
Dependencies
Dependency None
Data Requirements
Data Requirement Type: Patient
Profile(s): Patient
Must Support Elements: use, type, url, extension, value
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, effective, status, component
Code Filter(s):
Path: code
Code(s): LOINC 85354-9: blood pressure
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, value, effective, component, status
Code Filter(s):
Path: code
Code(s): LOINC 45755-6: Hospice care [Minimum Data Set]
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, value, effective, component, status
Code Filter(s):
Path: code
Code(s): LOINC 98181-1: Medical equipment used
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, effective, component, status
Code Filter(s):
Path: code
ValueSet: Frailty Symptom
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, effective, value, component, status
Code Filter(s):
Path: code
Code(s): LOINC 71802-3: Housing status
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, effective, component, status
Code Filter(s):
Path: code
Code(s): LOINC 71007-9: Functional Assessment of Chronic Illness Therapy - Palliative Care Questionnaire (FACIT-Pal)
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, effective, component, status
Code Filter(s):
Path: code
Code(s): LOINC 88124-3: Food insecurity risk [HVS]
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Office Visit
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Annual Wellness Visit
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Preventive Care Services - Established Office Visit, 18 and Up
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Preventive Care Services-Initial Office Visit, 18 and Up
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Home Healthcare Services
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1089
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Telephone Visits
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status, hospitalization, hospitalization.dischargeDisposition
Code Filter(s):
Path: type
ValueSet: Encounter Inpatient
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, status, period
Code Filter(s):
Path: type
ValueSet: ESRD Monthly Outpatient Services
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Frailty Encounter
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Outpatient
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Observation
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Emergency Department Visit
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Nonacute Inpatient
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Acute Inpatient
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1090
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code, verificationStatus, clinicalStatus, recordedDate
Code Filter(s):
Path: code
ValueSet: Essential Hypertension
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code, clinicalStatus, verificationStatus, recordedDate
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1165
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code, clinicalStatus, verificationStatus, recordedDate
Code Filter(s):
Path: code
ValueSet: Pregnancy
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code, clinicalStatus, verificationStatus, recordedDate
Code Filter(s):
Path: code
ValueSet: End Stage Renal Disease
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code, clinicalStatus, verificationStatus, recordedDate
Code Filter(s):
Path: code
ValueSet: Kidney Transplant Recipient
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code, clinicalStatus, verificationStatus, recordedDate
Code Filter(s):
Path: code
ValueSet: Chronic Kidney Disease, Stage 5
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code, clinicalStatus, verificationStatus, recordedDate
Code Filter(s):
Path: code
ValueSet: Frailty Diagnosis
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code, clinicalStatus, verificationStatus, recordedDate
Code Filter(s):
Path: code
ValueSet: Advanced Illness
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code, clinicalStatus, verificationStatus, recordedDate
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1167
Data Requirement Type: Coverage
Profile(s): Coverage
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Payer
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code, authoredOn, status, intent, doNotPerform
Code Filter(s):
Path: code
ValueSet: Hospice care ambulatory
Data Requirement Type: Procedure
Profile(s): Procedure
Must Support Elements: code, performed, status
Code Filter(s):
Path: code
ValueSet: Hospice care ambulatory
Data Requirement Type: Procedure
Profile(s): Procedure
Must Support Elements: code, status, performed
Code Filter(s):
Path: code
ValueSet: Kidney Transplant
Data Requirement Type: Procedure
Profile(s): Procedure
Must Support Elements: code, status, performed
Code Filter(s):
Path: code
ValueSet: Dialysis Services
Data Requirement Type: Procedure
Profile(s): Procedure
Must Support Elements: code, performed, status
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1135
Data Requirement Type: DeviceRequest
Profile(s): DeviceRequest
Must Support Elements: code, status, intent, authoredOn
Code Filter(s):
Path: code
ValueSet: Frailty Device
Data Requirement Type: MedicationRequest
Profile(s): MedicationRequest
Must Support Elements: medication, status, doNotPerform, intent, dosageInstruction
Code Filter(s):
Path: medication
ValueSet: Dementia Medications
Data Requirement Type: MedicationRequest
Profile(s): MedicationRequest
Must Support Elements: medication.reference, status, doNotPerform, intent, dosageInstruction
Data Requirement Type: Medication
Profile(s): Medication
Must Support Elements: id, code
Generated using version 0.5.1-cibuild of the sample-content-ig Liquid templates