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: Urinary Symptom Score Change 6-12 Months After Diagnosis of Benign Prostatic HyperplasiaFHIR

Official URL: https://madie.cms.gov/Measure/CMS771FHIRUrinarySymptomScoreBPH Version: 1.0.000
Active as of 2026-01-16 Responsible: Large Urology Group Practice Association (LUGPA) Computable Name: CMS771FHIRUrinarySymptomScoreBPH
Other Identifiers: Short Name: CMS771FHIR (use: usual, ), UUID:0748d873-8e20-441e-9bbf-c1eefe3ea054 (use: official, ), UUID:1765122b-5409-43cb-9449-3d1a62a8ea78 (use: official, ), Publisher: 771FHIR (use: official, )

Copyright/Legal: Limited proprietary coding is contained in the measure specifications for user convenience. Users of the proprietary code sets should obtain all necessary licenses from the owners of these code sets. Large Urology Group Practice Association (LUGPA) and Oregon Urology Institute (OUI) disclaim all liability for the use or accuracy of any third-party codes contained in the specifications.

CPT(R) contained in the Measure specifications is copyright 2004-2024. American Medical Association. LOINC(R) copyright 2004-2024 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation. ICD-10 copyright 2024 World Health Organization. All Rights Reserved.

Percentage of patients with an office visit within the measurement period and with a new diagnosis of clinically significant Benign Prostatic Hyperplasia who have International Prostate Symptoms Score (IPSS) or American Urological Association (AUA) Symptom Index (SI) documented at time of diagnosis and again 6-12 months later with an improvement of 3 points

Metadata
Title Urinary Symptom Score Change 6-12 Months After Diagnosis of Benign Prostatic HyperplasiaFHIR
Version 1.0.000
Short Name CMS771FHIR
GUID (Version Independent) urn:uuid:0748d873-8e20-441e-9bbf-c1eefe3ea054
GUID (Version Specific) urn:uuid:1765122b-5409-43cb-9449-3d1a62a8ea78
CMS Identifier 771FHIR
Effective Period 2026-01-01 through 2026-12-31
Steward (Publisher) Large Urology Group Practice Association (LUGPA)
Developer Large Urology Group Practice Association (LUGPA)
Description

Percentage of patients with an office visit within the measurement period and with a new diagnosis of clinically significant Benign Prostatic Hyperplasia who have International Prostate Symptoms Score (IPSS) or American Urological Association (AUA) Symptom Index (SI) documented at time of diagnosis and again 6-12 months later with an improvement of 3 points

Copyright

Limited proprietary coding is contained in the measure specifications for user convenience. Users of the proprietary code sets should obtain all necessary licenses from the owners of these code sets. Large Urology Group Practice Association (LUGPA) and Oregon Urology Institute (OUI) disclaim all liability for the use or accuracy of any third-party codes contained in the specifications.

CPT(R) contained in the Measure specifications is copyright 2004-2024. American Medical Association. LOINC(R) copyright 2004-2024 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation. ICD-10 copyright 2024 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].

Rationale

Benign prostatic hyperplasia (BPH) is one of the most common conditions affecting older males, with a prevalence of 50% by age 60 years and 90% by the ninth decade of life (Medina et al., 1999). The enlarged gland had been proposed to contribute to the overall lower urinary tract symptoms (LUTS) complex (McVary et al., 2014). Although LUTS secondary to BPH is not often a life-threatening condition, the impact of LUTS/BPH on quality of life can be significant (Wei et al., 2005). The American Urological Association Symptom Index (AUA-SI) and the International Prostate Symptom Score (IPSS) were developed to measure outcomes in studies of different treatments for BPH (Wuerstle et al., 2011). The IPSS uses the same questions as the AUA-SI, but also adds a disease-specific Quality of Life (QOL) score question (O'Leary, 2005). The IPSS was adopted in 1993 by the World Health Organization. It is a reproducible, validated index designed to determine disease severity and response to therapy (D'Silva et al., 2014). It includes 3 storage symptom questions (frequency, nocturia, urgency) and four voiding symptoms (feeling of incomplete emptying, intermittency, straining, and a weak stream) as well as a Bother question: If you were to spend the rest of your life with your urinary condition just the way it is now, how would you feel about that? A three-point improvement in the score is considered meaningful (McVary et al., 2014).

Clinical Recommendation Statement

The symptoms of BPH are lower urinary tract symptoms (LUTS). There are other disorders with similar symptoms that need to be excluded. History, physical examination, and testing are required prior to a diagnosis of BPH. IPSS by itself is not a reliable diagnostic tool for LUTS suggestive of BPH but serves as a quantitative measure of LUTS after the diagnosis is established (D'Silva et al., 2014). Medical and surgical interventions for BPH recommend a follow up IPSS evaluation to determine effectiveness of treatment. IPSS should be evaluated at the time of diagnosis and after definitive treatment.

Citation

D'Silva, K. A., Dahm, P., & Wong, C. L. (2014). Does this man with lower urinary tract symptoms have bladder outlet obstruction? The Rational Clinical Examination: A systematic review. Journal of the American Medical Association, 312(5), 535-542. Retrieved from https://www.ncbi.nlm.nih.gov/pubmed/25096693

Citation

McVary, K. T., Roehrborn, C. G., Avins, A. L., et al. (2014). Management of benign prostatic hyperplasia. Retrieved from https://pubmed.ncbi.nlm.nih.gov/21420124/

Citation

Medina, J. J., Parra, R. O., & Moore, R. G. (1999). Benign prostatic hyperplasia (the aging prostate). Medical Clinics of North America, 83(5), 1213-1229. Retrieved from http://www.sciencedirect.com/science/article/pii/S0025712505701590

Citation

O'Leary, M. P. (2005). Validity of the Bother Score in the evaluation and treatment of symptomatic benign prostatic hyperplasia. Reviews in Urology, 7(1), 1-10. Retrieved from https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1477553/

Citation

Wei, J., Calhoun, E., & Jacobsen, S. (2005). Urologic diseases in America project: Benign prostatic hyperplasia. Journal of Urology, 173(4), 1256-1261. Retrieved from https://www.ncbi.nlm.nih.gov/pubmed/15758764

Citation

Wuerstle, M. C., Van Den Eeden, S. K., Poon, K. T., et al. (2011). Contribution of common medications to lower urinary tract symptoms in men. Archives of Internal Medicine, 171(18), 1680-1682. Retrieved from https://www.ncbi.nlm.nih.gov/pubmed/21987200

Definition Clinically Significant Benign Prostatic Hyperplasia (BPH) : BPH with lower urinary tract symptoms (LUTS)
Guidance (Usage) The IPSS is inclusive of the symptom index score and the Quality of Life (QOL) score. The AUA-SI is the symptom index score alone and must be added to the QOL score. The AUA-SI with the QOL equals the IPSS. Both of these are the urinary symptom score. The patient must have a urinary symptom score (USS) within 1 month after initial diagnosis. If more than one USS in the initial one month, then the first USS counts. The patient must have a USS again at 6-12 months after the initial diagnosis and if more than one USS in this time frame, then the last USS counts. The result of the test is a numeric value that relates to a continuous numeric scale. Reported either as an integer, a ratio, a real number, or a range. The test result value may optionally contain a relational operator from the set {\<=, \<, \>, \>=}. Valid values for a quantitative test are of the form "7", "-7", "7.4", "-7.4", "7.8912", "0.125", "\<10", "\<10.15", "\>12000", 1-10, 1:256. Hospitalization within 30 days of Initial BPH Diagnosis refers to a 30-day period between the end of the hospitalization and the clinical office setting BPH diagnosis. This is due to aggravating factors from hospitalization, such as bed rest, medications, surgery, and altered body functions. Symptoms of BPH include urinary frequency, urinary urgency, difficulty starting urination, weak urine stream, dribbling at the end of urination, incomplete bladder emptying. This eCQM is a patient-based measure. 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 CMS771v7. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU6/) for more information on QI-Core and mapping recommendations from QDM to QI-Core STU 6 (https://hl7.org/fhir/us/qicore/STU6/qdm-to-qicore.html).
Measure Group (Rate) (ID: Group_1)
Basis boolean
Scoring Proportion
Improvement Notation Increased score indicates improvement
Improvement Notation Guidance

A meaningful improvement is a negative 3-point change in the urinary symptom score. The quality improves when a higher proportion of people meet the meaningful improvement definition.

Type Outcome
Rate Aggregation None
Initial Population ID: InitialPopulation_1
Description:

Male patients with an initial diagnosis of benign prostatic hyperplasia 6 months prior to the measurement period who had a qualifying visit during the measurement period

Criteria: Initial Population
Denominator ID: Denominator_1
Description:

Patients in the Initial Population with a urinary symptom score assessment within 1 month of initial diagnosis and a follow-up urinary symptom score assessment within 6-12 months

Criteria: Denominator
Denominator Exclusion ID: DenominatorExclusion_1
Description:

Patients with urinary retention that starts within 1 year of initial BPH diagnosis. Patients with an initial BPH diagnosis that starts during, or within 30 days after end of hospitalization. Patients with a diagnosis of morbid obesity, or with a BMI Exam \>=40 before the follow up urinary symptom score.

Criteria: Denominator Exclusions
Numerator ID: Numerator_1
Description:

Patients with a documented improvement of at least 3 points in their urinary symptom score during the measurement period

Criteria: Numerator
<p>For every patient evaluated by this measure also identify payer, race, ethnicity and sex</p>
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/CMS771FHIRUrinarySymptomScoreBPH
Contents Population Criteria
Logic Definitions
Terminology
Dependencies
Data Requirements
Parameters
Population Criteria
Measure Group (Rate) (ID: Group_1)
Initial Population
define "Initial Population":
  ( "Patient is Male" )
    and "Has Qualifying Encounter"
    and "Has Qualifying BPH Diagnosis"
Definition
Denominator
define "Denominator":
  "Initial Population"
    and "Urinary Symptom Score Within 1 Month After Initial BPH Diagnosis" is not null
    and "Urinary Symptom Score 6 to 12 Months After Initial BPH Diagnosis" is not null
Definition
Denominator Exclusion
define "Denominator Exclusions":
  exists ( "Urinary Retention Diagnosis Starts Within 1 Year After Initial BPH Diagnosis" )
    or ( "Has Initial BPH Diagnosis Starts During or Within 30 Days After End of Hospitalization" is not null )
    or ( "Morbid Obesity Diagnosis or BMI Exam Result Greater Than or Equal to 40 Starts On or Before Follow Up USS Assessment" )
Definition
Numerator
define "Numerator":
  "Urinary Symptom Score Improvement Greater Than or Equal To 3"
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: CMS771FHIRUrinarySymptomScoreBPH
define "SDE Sex":
  SDE."SDE Sex"
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Documented IPSS Assessment Result":
  [ObservationScreeningAssessment: "International Prostate Symptom Score [IPSS]"] IPSSAssessment
    where IPSSAssessment.status in { 'final', 'amended', 'corrected' }
      and IPSSAssessment.value is not null
    return {
      effectiveDatetime: IPSSAssessment.effective.earliest ( ),
      valueInteger: IPSSAssessment.value as FHIR.integer
    }
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "AUA Symptom Index and Quality of Life Assessment Result":
  [ObservationScreeningAssessment: "American Urological Association Symptom Index [AUASI]"] AUASIAssessment
    let LastQOLOnDate: Last([ObservationScreeningAssessment: "If you were to spend the rest of your life with your urinary condition just the way it is now, how would you feel about that [IPSS]"] QOLAssessment
        where QOLAssessment.effective.earliest() same day as AUASIAssessment.effective.earliest()
          and QOLAssessment.status in { 'final', 'amended', 'corrected' }
          and QOLAssessment.value is not null
        sort by effective.earliest()
    )
    where AUASIAssessment.status in { 'final', 'amended', 'corrected' }
      and AUASIAssessment.value is not null
    return {
      effectiveDatetime: AUASIAssessment.effective.earliest ( ),
      valueInteger: ( AUASIAssessment.value as FHIR.integer ) + ( LastQOLOnDate.value as FHIR.integer )
    }
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Urinary Symptom Score Assessment":
  "Documented IPSS Assessment Result"
    union "AUA Symptom Index and Quality of Life Assessment Result"
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Initial BPH Diagnosis Starts Within 6 Months Before the Measurement Period":
  First(([ConditionProblemsHealthConcerns: "Benign prostatic hyperplasia with lower urinary tract symptoms"]
      union [ConditionEncounterDiagnosis: "Benign prostatic hyperplasia with lower urinary tract symptoms"]) NewBPHDiagnosis
      where NewBPHDiagnosis.onset.toInterval ( ) starts during Interval[start of "Measurement Period" - 6 months, start of "Measurement Period"]
        and NewBPHDiagnosis.verificationStatusIsNotInvalid ( )
      sort by start of onset.toInterval ( )
  )
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Urinary Symptom Score Within 1 Month After Initial BPH Diagnosis":
  First("Urinary Symptom Score Assessment" USSAssessment
      with "Initial BPH Diagnosis Starts Within 6 Months Before the Measurement Period" InitialBPHDiagnosis
        such that USSAssessment.effectiveDatetime 1 month or less on or after day of start of InitialBPHDiagnosis.onset.toInterval ( )
      sort by effectiveDatetime
  )
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Urinary Symptom Score 6 to 12 Months After Initial BPH Diagnosis":
  Last("Urinary Symptom Score Assessment" USSAssessment
      with "Initial BPH Diagnosis Starts Within 6 Months Before the Measurement Period" InitialBPHDiagnosis
        such that difference in months between start of InitialBPHDiagnosis.onset.toInterval ( ) and USSAssessment.effectiveDatetime in Interval[6, 12]
      sort by effectiveDatetime
  )
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Urinary Symptom Score Change":
  from
    "Urinary Symptom Score Within 1 Month After Initial BPH Diagnosis" FirstUSSAssessment,
    "Urinary Symptom Score 6 to 12 Months After Initial BPH Diagnosis" FollowUpUSSAssessment
    let USSChange: ( FirstUSSAssessment.valueInteger ) - ( FollowUpUSSAssessment.valueInteger )
    return USSChange
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Urinary Symptom Score Improvement Greater Than or Equal To 3":
  ( "Urinary Symptom Score Change" USSImprovement
      where USSImprovement >= 3
  ) is not null
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Numerator":
  "Urinary Symptom Score Improvement Greater Than or Equal To 3"
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Patient is Male":
  SDE."SDE Sex" ~ SDE."Male (finding)"
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Has Qualifying Encounter":
  exists ( [Encounter: "Office Visit"] ValidEncounter
      where ValidEncounter.period during day of "Measurement Period"
        and ValidEncounter.class !~ "virtual"
        and ValidEncounter.status = 'finished'
  )
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Has Qualifying BPH Diagnosis":
  "Initial BPH Diagnosis Starts Within 6 Months Before the Measurement Period" is not null
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Initial Population":
  ( "Patient is Male" )
    and "Has Qualifying Encounter"
    and "Has Qualifying BPH Diagnosis"
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Denominator":
  "Initial Population"
    and "Urinary Symptom Score Within 1 Month After Initial BPH Diagnosis" is not null
    and "Urinary Symptom Score 6 to 12 Months After Initial BPH Diagnosis" is not null
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "SDE Payer":
  SDE."SDE Payer"
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "SDE Ethnicity":
  SDE."SDE Ethnicity"
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Urinary Retention Diagnosis Starts Within 1 Year After Initial BPH Diagnosis":
  ( [ConditionProblemsHealthConcerns: "Urinary Retention"]
    union [ConditionEncounterDiagnosis: "Urinary Retention"] ) UrinaryRetention
    with "Initial BPH Diagnosis Starts Within 6 Months Before the Measurement Period" InitialBPHDiagnosis
      such that UrinaryRetention.onset.toInterval ( ) starts 1 year or less on or after day of start of InitialBPHDiagnosis.onset.toInterval ( )
    where UrinaryRetention.verificationStatusIsNotInvalid ( )
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Has Initial BPH Diagnosis Starts During or Within 30 Days After End of Hospitalization":
  "Initial BPH Diagnosis Starts Within 6 Months Before the Measurement Period" InitialBPHDiagnosis
    with [Encounter: "Hospital Services for Urology Care"] UrologyHospitalServices
      such that InitialBPHDiagnosis.onset.toInterval ( ) starts during Interval[start of UrologyHospitalServices.period, end of UrologyHospitalServices.period + 31 days]
        and UrologyHospitalServices.status = 'finished'
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Morbid Obesity Diagnosis On or Before Follow Up USS Assessment":
  ( [ConditionProblemsHealthConcerns: "Morbid Obesity"]
    union [ConditionEncounterDiagnosis: "Morbid Obesity"] ) MorbidObesityDiagnosis
    with "Urinary Symptom Score 6 to 12 Months After Initial BPH Diagnosis" FollowUpUSSAssessment
      such that MorbidObesityDiagnosis.onset.toInterval ( ) overlaps "Measurement Period"
        and MorbidObesityDiagnosis.onset.toInterval ( ) starts on or before FollowUpUSSAssessment.effectiveDatetime
    where MorbidObesityDiagnosis.verificationStatusIsNotInvalid ( )
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
/*
* @code: Body mass index (BMI) [Ratio] - 39156-5
* @profile: http://hl7.org/fhir/StructureDefinition/bmi
*/


define "BMI Exam Result Greater Than or Equal To 40 During Measurement Period and On or Before Follow Up USS Assessment":
  exists ( ["USCore.BMIProfile"] BMIExam
      with "Urinary Symptom Score 6 to 12 Months After Initial BPH Diagnosis" FollowUpUSSAssessment
        such that BMIExam.value >= 40 'kg/m2'
          and BMIExam.status in { 'final', 'amended', 'corrected' }
          and BMIExam.effective.earliest ( ) during day of "Measurement Period"
          and BMIExam.effective.earliest ( ) on or before FollowUpUSSAssessment.effectiveDatetime
      return BMIExam.effective.earliest ( )
  )
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Morbid Obesity Diagnosis or BMI Exam Result Greater Than or Equal to 40 Starts On or Before Follow Up USS Assessment":
  exists "Morbid Obesity Diagnosis On or Before Follow Up USS Assessment"
    or "BMI Exam Result Greater Than or Equal To 40 During Measurement Period and On or Before Follow Up USS Assessment"
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "Denominator Exclusions":
  exists ( "Urinary Retention Diagnosis Starts Within 1 Year After Initial BPH Diagnosis" )
    or ( "Has Initial BPH Diagnosis Starts During or Within 30 Days After End of Hospitalization" is not null )
    or ( "Morbid Obesity Diagnosis or BMI Exam Result Greater Than or Equal to 40 Starts On or Before Follow Up USS Assessment" )
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define "SDE Race":
  SDE."SDE Race"
Logic Definition Library Name: CMS771FHIRUrinarySymptomScoreBPH
define fluent function verificationStatusIsNotInvalid(condition Choice<"ConditionEncounterDiagnosis", "ConditionProblemsHealthConcerns">):
  condition.verificationStatus is null
    or not ( condition.verificationStatus ~ Status."unconfirmed"
        or condition.verificationStatus ~ Status."refuted"
        or condition.verificationStatus ~ Status."entered-in-error"
    )
Logic Definition Library Name: FHIRHelpers
define function ToString(value string): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value uri): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value ObservationStatus): value.value
Logic Definition Library Name: FHIRHelpers
define function ToDateTime(value dateTime): value.value
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)
value to a CQL DateTime Interval
@comment: If the start value of the given period is unspecified, the starting
boundary of the resulting interval will be open (meaning the start of the interval
is unknown, as opposed to interpreted as the beginning of time).
*/
define function ToInterval(period FHIR.Period):
    if period is null then
        null
    else
        if period."start" is null then
            Interval(period."start".value, period."end".value]
        else
            Interval[period."start".value, period."end".value]
Logic Definition Library Name: FHIRHelpers
define function ToDateTime(value 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 ToInteger(value integer): value.value
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
*/
define function ToConcept(concept FHIR.CodeableConcept):
    if concept is null then
        null
    else
        System.Concept {
            codes: concept.coding C return ToCode(C),
            display: concept.text.value
        }
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
*/
define function ToCode(coding FHIR.Coding):
    if coding is null then
        null
    else
        System.Code {
          code: coding.code.value,
          system: coding.system.value,
          version: coding.version.value,
          display: coding.display.value
        }
Logic Definition Library Name: FHIRHelpers
define function ToString(value EncounterStatus): value.value
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: Given an interval, return the starting point if the interval has a starting boundary specified,
otherwise, return the ending point
*/
define fluent function earliest(choice Choice<FHIR.dateTime, FHIR.Period, FHIR.Age, FHIR.Range>):
  (choice.toInterval()) period
    return
      if (period.hasStart()) then start of period
      else end of period
Logic Definition Library Name: FHIRCommon
/*
@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
@comment: Normalizes a choice type of FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instance, FHIR.string, FHIR.Age, or FHIR.Range types
to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible
representations for timing-valued elements in FHIR, allowing this function to be used across any resource.

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

NOTE: Due to the
complexity of determining a single interval from a Timing or String type, this function will throw a run-time exception if it is used
with a Timing or String.
*/
define fluent function toInterval(choice Choice<FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range>):
  case
    when choice is FHIR.dateTime then
      Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]
    when choice is FHIR.Period then
      FHIRHelpers.ToInterval(choice as FHIR.Period)
    when choice is FHIR.instant then
      Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)]
    when choice is FHIR.Age then
      Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age),
        FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year)
    when choice is FHIR.Range then
      Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low),
        FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year)
    when choice is FHIR.Timing then
      Message(null as Interval<DateTime>, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported')
    when choice is FHIR.string then
      Message(null as Interval<DateTime>, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a String value is not supported')
    else
      null as Interval<DateTime>
  end
Logic Definition Library Name: FHIRCommon
/*
@description: Given an interval, return true if the interval has a starting boundary specified
(i.e. the start of the interval is not null and not the minimum DateTime value)
*/
define fluent function hasStart(period Interval<DateTime>):
  not ( start of period is null
      or start of period = minimum DateTime
  )
Logic Definition Library Name: FHIRCommon
/*
@description: Returns the single extension (if present) on the given element with the specified url.
@comment: This function uses singleton from to ensure that a run-time exception is thrown if there
is more than one extension on the given element with the specified url.
*/
define fluent function ext(element Element, url String):
  singleton from element.exts(url)
Logic Definition Library Name: FHIRCommon
/*
@description: Returns any extensions defined on the given element with the specified url.
*/
define fluent function exts(element Element, url String):
  element.extension E
    where E.url = url
    return E
Logic Definition Library Name: USCoreCommon
/*
@description: Returns the sex element as defined for the USCore patient profile
*/
define fluent function sex(patient Patient):
  patient.ext('http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex').value as FHIR.code
Logic Definition Library Name: USCoreCommon
define fluent function ethnicity(patient Patient):
  (patient.ext('http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity')) E
    return {
      ombCategory: E.ext('ombCategory').value as FHIR.Coding,
      detailed: (E.exts('detailed')) d return d.value as FHIR.Coding,
      text: E.ext('text').value as FHIR.string
    }
Logic Definition Library Name: USCoreCommon
define fluent function race(patient Patient):
  (patient.ext('http://hl7.org/fhir/us/core/StructureDefinition/us-core-race')) E
    return {
      ombCategory: (E.exts('ombCategory')) o return o.value as FHIR.Coding,
      detailed: (E.exts('detailed')) d return d.value as FHIR.Coding,
      text: E.ext('text').value as FHIR.string
    }
Terminology
Code System Description: Code system SNOMEDCT
Resource: SNOMED CT (all versions)
Canonical URL: http://snomed.info/sct
Code System Description: Code system LOINC
Resource: Logical Observation Identifiers, Names and Codes (LOINC)
Canonical URL: http://loinc.org
Code System Description: Code system ICD10CM
Resource: International Classification of Diseases, 10th Revision, Clinical Modification (ICD-10-CM)
Canonical URL: http://hl7.org/fhir/sid/icd-10-cm
Code System Description: Code system ConditionVerificationStatusCodes
Resource: ConditionVerificationStatus
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-ver-status
Code System Description: Code system ActCode
Resource: ActCode
Canonical URL: http://terminology.hl7.org/CodeSystem/v3-ActCode
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 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 Urinary Retention
Resource: Urinary Retention
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.372
Value Set Description: Value set Hospital Services for Urology Care
Resource: Hospital Services for Urology Care
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.360
Value Set Description: Value set Morbid Obesity
Resource: Morbid Obesity
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.368
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: International Prostate Symptom Score [IPSS]
Code: 80976-4
System: http://loinc.org
Direct Reference Code Display: American Urological Association Symptom Index [AUASI]
Code: 80883-2
System: http://loinc.org
Direct Reference Code Display: If you were to spend the rest of your life with your urinary condition just the way it is now, how would you feel about that [IPSS]
Code: 81090-3
System: http://loinc.org
Direct Reference Code Display: Benign prostatic hyperplasia with lower urinary tract symptoms
Code: N40.1
System: http://hl7.org/fhir/sid/icd-10-cm
Direct Reference Code Display: unconfirmed
Code: unconfirmed
System: http://terminology.hl7.org/CodeSystem/condition-ver-status
Direct Reference Code Display: refuted
Code: refuted
System: http://terminology.hl7.org/CodeSystem/condition-ver-status
Direct Reference Code Display: entered-in-error
Code: entered-in-error
System: http://terminology.hl7.org/CodeSystem/condition-ver-status
Direct Reference Code Display: virtual
Code: VR
System: http://terminology.hl7.org/CodeSystem/v3-ActCode
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
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: Patient
Profile(s): Patient
Must Support Elements: birthDate
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-observation-screening-assessment
Must Support Elements: code, effective, status, value
Code Filter(s):
Path: code
Code(s): LOINC: 81090-3 (If you were to spend the rest of your life with your urinary condition just the way it is now, how would you feel about that [IPSS])
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-observation-screening-assessment
Must Support Elements: code, effective, status, value
Code Filter(s):
Path: code
Code(s): LOINC: 80883-2 (American Urological Association Symptom Index [AUASI])
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-observation-screening-assessment
Must Support Elements: code, status, value, effective
Code Filter(s):
Path: code
Code(s): LOINC: 80976-4 (International Prostate Symptom Score [IPSS])
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
Code(s): International Classification of Diseases, 10th Revision, Clinical Modification (ICD-10-CM): N40.1 (Benign prostatic hyperplasia with lower urinary tract symptoms)
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: Urinary Retention
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: Morbid Obesity
Data Requirement Type: Condition
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-condition-encounter-diagnosis
Must Support Elements: code
Code Filter(s):
Path: code
Code(s): International Classification of Diseases, 10th Revision, Clinical Modification (ICD-10-CM): N40.1 (Benign prostatic hyperplasia with lower urinary tract symptoms)
Data Requirement Type: Condition
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-condition-encounter-diagnosis
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: Urinary Retention
Data Requirement Type: Condition
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-condition-encounter-diagnosis
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: Morbid Obesity
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, class, status
Code Filter(s):
Path: type
ValueSet: Office Visit
Path: class
Path: status
Code(s): [not stated]: finished (finished)
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period, status
Code Filter(s):
Path: type
ValueSet: Hospital Services for Urology Care
Path: status
Code(s): [not stated]: finished (finished)
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: Observation
Profile(s): US Core BMI Profile
Must Support Elements: value, status, effective
Parameters
Name Use Card. Type Documentation
Measurement Period In 0..1 Period
SDE Sex Out 0..1 Coding
Numerator Out 0..1 boolean
Denominator Out 0..1 boolean
SDE Payer Out 0..* Resource
Initial Population Out 0..1 boolean
SDE Ethnicity Out 0..1 Resource
Denominator Exclusions Out 0..1 boolean
SDE Race Out 0..1 Resource
Generated using version 0.5.4 of the sample-content-ig Liquid templates