| Library Name |
Name |
| SupplementalDataElements |
SDE Sex |
|
define "SDE Sex":
case
when Patient.gender = 'male' then "M"
when Patient.gender = 'female' then "F"
else null
end
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
SDE Sex |
|
define "SDE Sex":
SDE."SDE Sex"
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Bladder Cancer Diagnosis |
|
define "Bladder Cancer Diagnosis":
[Condition: "Bladder Cancer for Urology Care"] BladderCancer
where BladderCancer.prevalenceInterval ( ) starts before end of "Measurement Period"
and BladderCancer.isConfirmedActiveDiagnosis ( )
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
First Bladder Cancer Staging Procedure |
|
define "First Bladder Cancer Staging Procedure":
First([Procedure: "Tumor staging (tumor staging)"] BladderCancerStaging
with "Bladder Cancer Diagnosis" BladderCancer
such that BladderCancerStaging.performed.toInterval() starts on or before day of start of BladderCancer.prevalenceInterval()
where BladderCancerStaging.status = 'completed'
sort by start of performed.toInterval()
)
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
First BCG Administered |
|
define "First BCG Administered":
First([MedicationAdministration: "BCG Bacillus Calmette Guerin for Urology Care"] BCG
with "First Bladder Cancer Staging Procedure" FirstBladderCancerStaging
such that BCG.effective.toInterval() starts 6 months or less after start of FirstBladderCancerStaging.performed.toInterval()
and BCG.effective.toInterval() starts during "Measurement Period"
where BCG.status in { 'in-progress', 'completed' }
sort by start of effective.toInterval()
)
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Numerator |
|
define "Numerator":
"First BCG Administered" is not null
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Denominator Exception |
|
/*
@commentedOut: exists "BCG Not Available Within 6 Months After Bladder Cancer Staging"
@commentedOutReason: Negation issue related to https://github.com/cqframework/cql-execution/issues/296, which is tied to https://oncprojectracking.healthit.gov/support/browse/BONNIEMAT-1455. Due to this being the only logic in this population added 'false' as a placeholder.
*/
define "Denominator Exception":
//placeholder
false
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
July 1 of Year Prior to the Measurement Period |
|
define "July 1 of Year Prior to the Measurement Period":
DateTime((year from start of "Measurement Period" - 1), 7, 1, 0, 0, 0, 0, 0)
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
June 30 of the Measurement Period |
|
define "June 30 of the Measurement Period":
DateTime((year from start of "Measurement Period"), 6, 30, 23, 59, 59, 0, 0)
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
First Bladder Cancer Staging Procedure during 6 Months Prior to Measurement Period through the First 6 Months of Measurement Period |
|
define "First Bladder Cancer Staging Procedure during 6 Months Prior to Measurement Period through the First 6 Months of Measurement Period":
"First Bladder Cancer Staging Procedure" FirstBladderCancerStaging
where FirstBladderCancerStaging.performed.toInterval ( ) during day of Interval["July 1 of Year Prior to the Measurement Period", "June 30 of the Measurement Period"]
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Has Most Recent Bladder Cancer Tumor Staging is Ta HG, Tis, T1 |
|
/*Ta High Grade only to be included. Ta low grade is to be excluded from this measure.*/
define "Has Most Recent Bladder Cancer Tumor Staging is Ta HG, Tis, T1":
exists ( [Observation] StagingObservation
where StagingObservation.getStagingProcedure ( ) is not null
and ( StagingObservation.value as Concept ~ "American Joint Committee on Cancer cT1 (qualifier value)"
or StagingObservation.value as Concept ~ "American Joint Committee on Cancer cTis (qualifier value)"
or StagingObservation.value as Concept ~ "American Joint Committee on Cancer cTa (qualifier value)"
or StagingObservation.value as Concept ~ "Carcinoma in situ of bladder"
)
and StagingObservation.status in { 'final', 'amended', 'corrected' }
)
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Has Qualifying Encounter |
|
define "Has Qualifying Encounter":
exists ( [Encounter: "Office Visit"] ValidEncounter
where ValidEncounter.period during "Measurement Period"
and ValidEncounter.class !~ "virtual"
and ValidEncounter.status = 'finished'
)
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Initial Population |
|
define "Initial Population":
"Has Most Recent Bladder Cancer Tumor Staging is Ta HG, Tis, T1"
and "Has Qualifying Encounter"
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Denominator |
|
define "Denominator":
"Initial Population"
|
| Library Name |
Name |
| SupplementalDataElements |
SDE Payer |
|
define "SDE Payer":
[Coverage: type in "Payer Type"] Payer
return {
code: Payer.type,
period: Payer.period
}
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
SDE Payer |
|
define "SDE Payer":
SDE."SDE Payer"
|
| Library Name |
Name |
| SupplementalDataElements |
SDE Ethnicity |
|
define "SDE Ethnicity":
Patient.ethnicity E
return Tuple {
codes: { E.ombCategory } union E.detailed,
display: E.text
}
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
SDE Ethnicity |
|
define "SDE Ethnicity":
SDE."SDE Ethnicity"
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Acute Tuberculosis Diagnosis |
|
define "Acute Tuberculosis Diagnosis":
[Condition: "Active Tuberculosis for Urology Care"] ActiveTuberculosis
with "First Bladder Cancer Staging Procedure" FirstBladderCancerStaging
such that ActiveTuberculosis.prevalenceInterval ( ) overlaps after day of FirstBladderCancerStaging.performed.toInterval ( )
where ActiveTuberculosis.isConfirmedActiveDiagnosis ( )
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Immunosuppressive Drugs |
|
define "Immunosuppressive Drugs":
[MedicationRequest: "Immunosuppressive Drugs for Urology Care"] ImmunosuppressiveDrugs
let firstMedicationPeriod: First((collapse(ImmunosuppressiveDrugs.dosageInstruction.timing.repeat.bounds DoseTime
return DoseTime.toInterval()
)) DrugPeriods
sort by start of $this
),
//get the very first event
firstMedicationEvent: First((ImmunosuppressiveDrugs.dosageInstruction.timing dosageTiming
//returns first event for the specific dosageTiming
return First(dosageTiming.event dosageTimingEvents
sort ascending
)) firstEvents
sort ascending
),
medicationPeriod: Coalesce(firstMedicationEvent.toInterval(), firstMedicationPeriod)
with "First Bladder Cancer Staging Procedure" FirstBladderCancerStaging
such that medicationPeriod starts on or before day of start of FirstBladderCancerStaging.performed.toInterval ( )
where ImmunosuppressiveDrugs.status in { 'active', 'completed' }
and ImmunosuppressiveDrugs.intent = 'order'
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Cystectomy Done |
|
define "Cystectomy Done":
[Procedure: "Cystectomy for Urology Care"] Cystectomy
with "First Bladder Cancer Staging Procedure" FirstBladderCancerStaging
such that Cystectomy.performed.toInterval ( ) 6 months or less before start of FirstBladderCancerStaging.performed.toInterval ( )
where Cystectomy.status = 'completed'
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Has Excluding HIV, Immunocompromised Conditions or Mixed Histology Before Staging |
|
define "Has Excluding HIV, Immunocompromised Conditions or Mixed Histology Before Staging":
exists ( ( [Condition: "HIV"]
union [Condition: "Immunocompromised Conditions"]
union [Condition: "Mixed histology urothelial cell carcinoma for Urology Care"] ) ExclusionDiagnosis
with "First Bladder Cancer Staging Procedure" FirstBladderCancerStaging
such that ExclusionDiagnosis.prevalenceInterval ( ) starts on or before day of start of FirstBladderCancerStaging.performed.toInterval ( )
where ExclusionDiagnosis.isConfirmedActiveDiagnosis ( )
)
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Has Excluding Chemotherapy or Radiotherapy Procedure Before Staging |
|
define "Has Excluding Chemotherapy or Radiotherapy Procedure Before Staging":
exists ( ( [MedicationRequest: "Chemotherapy Agents for Advanced Cancer"] ExclusionMed
let firstMedicationPeriod: First((collapse(ExclusionMed.dosageInstruction.timing.repeat.bounds DoseTime
return DoseTime.toInterval()
)) DrugPeriods
sort by start of $this
)
with "First Bladder Cancer Staging Procedure" FirstBladderCancerStaging
such that firstMedicationPeriod starts 6 months or less before FirstBladderCancerStaging.performed.toInterval ( )
where ExclusionMed.status in { 'active', 'completed' }
and ExclusionMed.intent = 'order'
)
union ( [Procedure: "Combined radiotherapy (procedure)"] ExclusionProcedure
with "First Bladder Cancer Staging Procedure" FirstBladderCancerStaging
such that ExclusionProcedure.performed.toInterval ( ) starts 6 months or less before FirstBladderCancerStaging.performed.toInterval ( )
where ExclusionProcedure.status = 'completed'
)
)
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
Denominator Exclusion |
|
define "Denominator Exclusion":
exists "Acute Tuberculosis Diagnosis"
or exists "Immunosuppressive Drugs"
or exists "Cystectomy Done"
or "Has Excluding HIV, Immunocompromised Conditions or Mixed Histology Before Staging"
or "Has Excluding Chemotherapy or Radiotherapy Procedure Before Staging"
|
| Library Name |
Name |
| SupplementalDataElements |
SDE Race |
|
define "SDE Race":
Patient.race R
return Tuple {
codes: R.ombCategory union R.detailed,
display: R.text
}
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
SDE Race |
|
define "SDE Race":
SDE."SDE Race"
|
| Library Name |
Name |
| QICoreCommon |
prevalenceInterval |
|
/*
@description: Returns an interval representing the normalized prevalence period of a given Condition.
@comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from
onset to abatement as specified in the given Condition. If the condition is active, or has an abatement date the resulting
interval will have a closed ending boundary. Otherwise, the resulting interval will have an open ending boundary.
*/
define fluent function prevalenceInterval(condition Condition):
if condition.clinicalStatus ~ "active"
or condition.clinicalStatus ~ "recurrence"
or condition.clinicalStatus ~ "relapse" then
Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]
else
(end of condition.abatementInterval()) abatementDate
return if abatementDate is null then
Interval[start of condition.onset.toInterval(), abatementDate)
else
Interval[start of condition.onset.toInterval(), abatementDate]
|
| Library Name |
Name |
| QICoreCommon |
abatementInterval |
|
/*
@description: Returns an interval representing the normalized abatement of a given Condition.
@comment: If the abatement element of the Condition is represented as a DateTime, the result
is an interval beginning and ending on that DateTime.
If the abatement is represented as a Quantity, the quantity is expected to be a calendar-duration and is interpreted as the age of the patient. The
result is an interval from the date the patient turned that age to immediately before one year later.
If the abatement is represented as a Quantity Interval, the quantities are expected to be calendar-durations and are interpreted as an age range during
which the abatement occurred. The result is an interval from the date the patient turned the starting age of the quantity interval, and ending immediately
before one year later than the date the patient turned the ending age of the quantity interval.
*/
define fluent function abatementInterval(condition Condition):
if condition.abatement is DateTime then
Interval[condition.abatement as DateTime, condition.abatement as DateTime]
else if condition.abatement is Quantity then
Interval[Patient.birthDate + (condition.abatement as Quantity),
Patient.birthDate + (condition.abatement as Quantity) + 1 year)
else if condition.abatement is Interval<Quantity> then
Interval[Patient.birthDate + (condition.abatement.low as Quantity),
Patient.birthDate + (condition.abatement.high as Quantity) + 1 year)
else if condition.abatement is Interval<DateTime> then
Interval[condition.abatement.low, condition.abatement.high)
else null as Interval<DateTime>
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
isConfirmedActiveDiagnosis |
|
define fluent function isConfirmedActiveDiagnosis(Condition Condition):
Condition.isActive ( )
and Condition.verificationStatus ~ QICoreCommon."confirmed"
|
| Library Name |
Name |
| QICoreCommon |
isActive |
|
/* Candidates for FHIRCommon */
/*
@description: Returns true if the given condition has a clinical status of active, recurrence, or relapse
*/
define fluent function isActive(condition Condition):
condition.clinicalStatus ~ "active"
or condition.clinicalStatus ~ "recurrence"
or condition.clinicalStatus ~ "relapse"
|
| Library Name |
Name |
| IntravesicalBacillusCalmetteGuerinForBladderCancerFHIR |
getStagingProcedure |
|
define fluent function getStagingProcedure(StagingObservation Observation):
StagingObservation.partOf StagingReference
return "First Bladder Cancer Staging Procedure during 6 Months Prior to Measurement Period through the First 6 Months of Measurement Period" FirstBladderCancerStagingMP
where FirstBladderCancerStagingMP.id = StagingReference.reference.getId ( )
|
| Library Name |
Name |
| QICoreCommon |
getId |
|
/*
@description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).
@comment: This function can be used to determine the logical id of a given resource. It can be used in
a single-server environment to trace references. However, this function does not attempt to resolve
or distinguish the base of the given url, and so cannot be used safely in multi-server environments.
*/
define fluent function getId(uri String):
Last(Split(uri, '/'))
|
| Library Name |
Name |
| FHIRHelpers |
ToInterval |
|
/*
@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]
|
| Library Name |
Name |
| FHIRHelpers |
ToString |
|
define function ToString(value uri): value.value
|
| Library Name |
Name |
| FHIRHelpers |
ToCode |
|
/*
@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
}
|
| Library Name |
Name |
| QICoreCommon |
toInterval |
|
/*
@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
@comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> 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 QICore, allowing this function to be used across any resource.
The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>.
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 Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,
and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.
If the input is a DateTime Interval, the result is the input.
If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result
is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending
immediately before one year later than the date the patient turned the age given as the end of the quantity interval.
If the input is a Timing, an error will be thrown indicating that Timing calculations are not implemented. Any other input will reslt in a null DateTime Interval
*/
define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>, Timing>):
case
when choice is DateTime then
Interval[choice as DateTime, choice as DateTime]
when choice is Interval<DateTime> then
choice as Interval<DateTime>
when choice is Quantity then
Interval[Patient.birthDate + (choice as Quantity),
Patient.birthDate + (choice as Quantity) + 1 year)
when choice is Interval<Quantity> then
Interval[Patient.birthDate + (choice.low as Quantity),
Patient.birthDate + (choice.high as Quantity) + 1 year)
when choice is Timing then
Message(null, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported') as Interval<DateTime>
else
null as Interval<DateTime>
end
|