| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with Age 18 and Length of Stay 48 Hours or More |
|
define "Encounter with Age 18 and Length of Stay 48 Hours or More":
["Encounter": "Encounter Inpatient"] InpatientEncounter
where InpatientEncounter.period ends during day of "Measurement Period"
and AgeInYearsAt(date from start of InpatientEncounter.period) >= 18
and ( duration in hours of InpatientEncounter.hospitalizationWithObservation ( ) >= 48 )
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Inpatient Encounter with Creatinine |
|
define "Inpatient Encounter with Creatinine":
from
"Encounter with Age 18 and Length of Stay 48 Hours or More" Encounter48Hours,
["Observation": "Creatinine Mass Per Volume"] CreatinineTest
let HospitalizationPeriod: Encounter48Hours.hospitalizationWithObservation ( ),
CreatinineTestStart: CreatinineTest.effective.earliest ( )
where CreatinineTest.value is not null
and CreatinineTestStart during Interval[start of HospitalizationPeriod + 48 hours, end of HospitalizationPeriod]
and CreatinineTest.status in { 'final', 'amended', 'corrected' }
return Encounter48Hours
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with Creatinine and without Obstetrical Conditions |
|
define "Encounter with Creatinine and without Obstetrical Conditions":
"Inpatient Encounter with Creatinine" EncounterWithCreatinine
where not exists ( ( EncounterWithCreatinine.encounterDiagnosis ( ) ) EncounterDiagnosis
where EncounterDiagnosis.code in "Obstetrics and VTE Obstetrics"
)
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Serum Creatinine Normal |
|
define "Serum Creatinine Normal":
if ( Patient.gender = 'female' ) then 1.02 'mg/dL'
else if ( Patient.gender = 'male' ) then 1.18 'mg/dL'
else null
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Qualifying Creatinine Lab Result by Time |
|
define "Qualifying Creatinine Lab Result by Time":
from
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter,
["Observation": "Creatinine Mass Per Volume"] CreatinineTestByTime
let CrEncId: QualifyingEncounter.id,
CrHospPeriod: QualifyingEncounter.hospitalizationWithObservation ( ),
CrLabId: CreatinineTestByTime.id,
CrTime: CreatinineTestByTime.effective.earliest ( ),
CrTimeIssued: CreatinineTestByTime.issued,
CrResult: CreatinineTestByTime.value as Quantity,
CrResultValue: CrResult.value,
CrResultUnit: CrResult.unit
where CrTime during CrHospPeriod
and CreatinineTestByTime.isLaboratory ( )
and CreatinineTestByTime.status in { 'final', 'amended', 'corrected' }
and CrResultUnit = 'mg/dL'
and CreatinineTestByTime.value is not null
and CreatinineTestByTime.value as Quantity > 0 'mg/dL'
return Tuple {
CrEncInPtId: CrEncId,
CrHospitalization: CrHospPeriod,
CrLabObsId: CrLabId,
// LabCategory: CreatinineTestByQuantity.isLaboratory(),
CrLabObsCategory: if CreatinineTestByTime.isLaboratory ( ) then 'laboratory'
else CreatinineTestByTime.isLaboratory ( ),
CrLabObsStatus: CreatinineTestByTime.status,
CrLabResult: CrResult,
CrLabResultUnit: CrResultUnit,
CrLabResultValue: CrResultValue,
CrLabTime: CrTime,
CrLabTimeIssued: CrTimeIssued
}
sort by CrLabTime
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with 1.5 Times Serum Creatinine Increase |
|
define "Encounter with 1.5 Times Serum Creatinine Increase":
from
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter,
["Observation": "Creatinine Mass Per Volume"] HighCreatinineTest,
["Observation": "Creatinine Mass Per Volume"] LowCreatinineTest
let LowCreatinineTestTime: LowCreatinineTest.effective.earliest ( ),
HighCreatinineTestTime: HighCreatinineTest.effective.earliest ( ),
HospitalWithObservationPeriod: QualifyingEncounter.hospitalizationWithObservation ( )
where ( HighCreatinineTest.value > "Serum Creatinine Normal" )
and LowCreatinineTest.status in { 'final', 'amended', 'corrected' }
and HighCreatinineTest.status in { 'final', 'amended', 'corrected' }
and HighCreatinineTest.value = "HighestSerumCreatinineResult"(QualifyingEncounter)
and LowCreatinineTest.value = "LowestSerumCreatinineResult"(QualifyingEncounter)
and "1.5IncreaseInCreatinine"(QualifyingEncounter) >= LowCreatinineTest.value
and LowCreatinineTestTime 7 days or less before HighCreatinineTestTime
and LowCreatinineTestTime during HospitalWithObservationPeriod
and HighCreatinineTestTime during Interval[start of HospitalWithObservationPeriod + 48 hours, start of HospitalWithObservationPeriod + 30 days]
and HighCreatinineTestTime during HospitalWithObservationPeriod
return QualifyingEncounter
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with 2 Times Serum Creatinine Increase |
|
/*
define "Encounter with 1.5 Times Serum Creatinine Increase":
from
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter,
["Observation": "Creatinine Mass Per Volume"] CreatinineTest
let
LowestCreatinineTestWithin7DaysPrior: "LowestSerumCreatinineWithin7DaysPrior"(QualifyingEncounter, CreatinineTest),
CreatinineTestTime: CreatinineTest.effective.earliest(),
HospitalWithObservationPeriod: QualifyingEncounter.hospitalizationWithObservation()
where
CreatinineTest.value >= LowestCreatinineTestWithin7DaysPrior * 1.5
and CreatinineTest.value > "Serum Creatinine Normal"
and CreatinineTestTime during Interval[start of HospitalWithObservationPeriod + 48 hours, start of HospitalWithObservationPeriod + 30 days]
return QualifyingEncounter*/
define "Encounter with 2 Times Serum Creatinine Increase":
from
"Encounter with 1.5 Times Serum Creatinine Increase" EncounterWithHighCreatinine,
["Observation": "Creatinine Mass Per Volume"] HighCreatinineTest,
["Observation": "Creatinine Mass Per Volume"] LowCreatinineTest
let LowCreatinineTestTime: LowCreatinineTest.effective.earliest ( ),
HighCreatinineTestTime: HighCreatinineTest.effective.earliest ( ),
HospitalWithObservationPeriod: EncounterWithHighCreatinine.hospitalizationWithObservation ( )
where ( HighCreatinineTest.value > "Serum Creatinine Normal" )
and LowCreatinineTest.status in { 'final', 'amended', 'corrected' }
and HighCreatinineTest.status in { 'final', 'amended', 'corrected' }
and HighCreatinineTest.value = "HighestSerumCreatinineResult"(EncounterWithHighCreatinine)
and LowCreatinineTest.value = "LowestSerumCreatinineResult"(EncounterWithHighCreatinine)
and ( "2.0IncreaseInCreatinine"(EncounterWithHighCreatinine) as Quantity ) >= ( LowCreatinineTest.value as Quantity )
and LowCreatinineTestTime 7 days or less before HighCreatinineTestTime
and LowCreatinineTestTime during HospitalWithObservationPeriod
and HighCreatinineTestTime during Interval[start of HospitalWithObservationPeriod + 48 hours, start of HospitalWithObservationPeriod + 30 days]
and HighCreatinineTestTime during HospitalWithObservationPeriod
return EncounterWithHighCreatinine
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with Kidney Dialysis Started More Than 48 Hours After Arrival |
|
define "Encounter with Kidney Dialysis Started More Than 48 Hours After Arrival":
from
["Procedure": "Hospital Based Dialysis Services"] Dialysis,
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter
let HospitalWithObservationPeriod: QualifyingEncounter.hospitalizationWithObservation ( )
where Dialysis.performed.toInterval ( ) starts during Interval[start of HospitalWithObservationPeriod + 48 hours, end of HospitalWithObservationPeriod]
and Dialysis.performed.toInterval ( ) starts during HospitalWithObservationPeriod
return QualifyingEncounter
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with Kidney Dialysis Started More Than 48 Hours After Arrival without High Creatinine |
|
define "Encounter with Kidney Dialysis Started More Than 48 Hours After Arrival without High Creatinine":
"Encounter with Kidney Dialysis Started More Than 48 Hours After Arrival" EncounterWithDialysisAfter48Hours
where not ( exists ( "Encounter with 2 Times Serum Creatinine Increase" EncounterWithHighCreatinine
where ( EncounterWithHighCreatinine.period includes EncounterWithDialysisAfter48Hours.period )
)
)
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Numerator |
|
define "Numerator":
"Encounter with 2 Times Serum Creatinine Increase"
union "Encounter with Kidney Dialysis Started More Than 48 Hours After Arrival without High Creatinine"
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Initial Population |
|
define "Initial Population":
"Encounter with Creatinine and without Obstetrical Conditions"
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Denominator |
|
define "Denominator":
"Initial Population"
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with Less Than 2 Creatinine Results within 48 Hours of Arrival |
|
define "Encounter with Less Than 2 Creatinine Results within 48 Hours of Arrival":
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter
where ( Count("CreatinineLabTestwithResultwithinFirst48Hours"(QualifyingEncounter)) < 2 )
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Male Encounter with eGFR Less Than 60 |
|
define "Male Encounter with eGFR Less Than 60":
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter
where "MaleeGFR"(QualifyingEncounter) is not null
and "MaleeGFR"(QualifyingEncounter) as Decimal < 60
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Female Encounter with eGFR Less Than 60 |
|
define "Female Encounter with eGFR Less Than 60":
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter
where "FemaleeGFR"(QualifyingEncounter) is not null
and "FemaleeGFR"(QualifyingEncounter) as Decimal < 60
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with Index eGFR Less Than 60 within First 48 Hours |
|
define "Encounter with Index eGFR Less Than 60 within First 48 Hours":
"Male Encounter with eGFR Less Than 60"
union "Female Encounter with eGFR Less Than 60"
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Increase of 0.3 or More Using Lowest Creatinine within 24 Hours |
|
define "Increase of 0.3 or More Using Lowest Creatinine within 24 Hours":
from
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter,
["Observation": "Creatinine Mass Per Volume"] IndexCreatinineLabResult,
["Observation": "Creatinine Mass Per Volume"] SubsequentCreatinineLabResult
let IndexCreatinineLabResultTime: IndexCreatinineLabResult.effective.earliest ( ),
SubsequentCreatinineLabResultTime: SubsequentCreatinineLabResult.effective.earliest ( ),
HospitalWithObservationPeriod: QualifyingEncounter.hospitalizationWithObservation ( )
where IndexCreatinineLabResult.status in { 'final', 'amended', 'corrected' }
and SubsequentCreatinineLabResult.status in { 'final', 'amended', 'corrected' }
and ( ( SubsequentCreatinineLabResult.value as Quantity ) - ( IndexCreatinineLabResult.value as Quantity ) ) > 0.299 'mg/dL'
and IndexCreatinineLabResult.value = "LowestSerumCreatinineResult"(QualifyingEncounter)
and IndexCreatinineLabResultTime during Interval[SubsequentCreatinineLabResultTime - 48 hours, SubsequentCreatinineLabResultTime]
and IndexCreatinineLabResultTime during HospitalWithObservationPeriod
and IndexCreatinineLabResultTime during Interval[start of HospitalWithObservationPeriod, start of HospitalWithObservationPeriod + 24 hours]
and SubsequentCreatinineLabResultTime during HospitalWithObservationPeriod
and SubsequentCreatinineLabResultTime during Interval[start of HospitalWithObservationPeriod, start of HospitalWithObservationPeriod + 48 hours]
and IndexCreatinineLabResult.id != SubsequentCreatinineLabResult.id
return QualifyingEncounter
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Increase of 0.3 or More Using First Creatinine within First 48 Hours |
|
define "Increase of 0.3 or More Using First Creatinine within First 48 Hours":
from
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter,
["Observation": "Creatinine Mass Per Volume"] IndexCreatinineLabResult,
["Observation": "Creatinine Mass Per Volume"] SubsequentCreatinineLabResult
let IndexCreatinineLabResultTime: IndexCreatinineLabResult.effective.earliest ( ),
SubsequentCreatinineLabResultTime: SubsequentCreatinineLabResult.effective.earliest ( ),
HospitalWithObservationPeriod: QualifyingEncounter.hospitalizationWithObservation ( )
where IndexCreatinineLabResult.status in { 'final', 'amended', 'corrected' }
and SubsequentCreatinineLabResult.status in { 'final', 'amended', 'corrected' }
and ( ( SubsequentCreatinineLabResult.value as Quantity ) - ( IndexCreatinineLabResult.value as Quantity ) ) > 0.299 'mg/dL'
and IndexCreatinineLabResult.value as Quantity = singleton from "EarliestSerumCreatinineResult"(QualifyingEncounter)
and IndexCreatinineLabResultTime during Interval[SubsequentCreatinineLabResultTime - 48 hours, SubsequentCreatinineLabResultTime]
and IndexCreatinineLabResultTime during HospitalWithObservationPeriod
and SubsequentCreatinineLabResultTime during Interval[start of HospitalWithObservationPeriod, start of HospitalWithObservationPeriod + 48 hours]
and SubsequentCreatinineLabResultTime during HospitalWithObservationPeriod
and IndexCreatinineLabResultTime during Interval[start of HospitalWithObservationPeriod, start of HospitalWithObservationPeriod + 48 hours]
and SubsequentCreatinineLabResultTime during Interval[start of HospitalWithObservationPeriod, start of HospitalWithObservationPeriod + 48 hours]
and IndexCreatinineLabResult.id != SubsequentCreatinineLabResult.id
return QualifyingEncounter
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with 0.3 mg dL or More Increase in Creatinine |
|
define "Encounter with 0.3 mg dL or More Increase in Creatinine":
Coalesce("Increase of 0.3 or More Using Lowest Creatinine within 24 Hours", "Increase of 0.3 or More Using First Creatinine within First 48 Hours")
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with Kidney Dialysis Started 48 Hours or Less After Arrival |
|
define "Encounter with Kidney Dialysis Started 48 Hours or Less After Arrival":
from
["Procedure": "Hospital Based Dialysis Services"] Dialysis,
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter
let HospitalWithObservationPeriod: QualifyingEncounter.hospitalizationWithObservation ( )
where Dialysis.performed.toInterval ( ) starts during Interval[start of HospitalWithObservationPeriod, start of HospitalWithObservationPeriod + 48 hours]
and Dialysis.performed.toInterval ( ) starts during HospitalWithObservationPeriod
return QualifyingEncounter
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with Kidney Dialysis Started 48 Hours or Less After Arrival without High Creatinine |
|
define "Encounter with Kidney Dialysis Started 48 Hours or Less After Arrival without High Creatinine":
"Encounter with Kidney Dialysis Started 48 Hours or Less After Arrival" EncounterWithKidneyDialysis48HoursOrAfter
where not ( exists ( "Encounter with 2 Times Serum Creatinine Increase" EncounterWithHighCreatinine
where ( EncounterWithHighCreatinine.period includes EncounterWithKidneyDialysis48HoursOrAfter.period )
)
)
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with High Risk Diagnosis for AKI |
|
define "Encounter with High Risk Diagnosis for AKI":
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter
where exists ( ( QualifyingEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
where ( EncounterDiagnosis.code in "High Risk Diagnosis for AKI" )
)
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Encounter with High Risk Procedures for AKI |
|
define "Encounter with High Risk Procedures for AKI":
"Encounter with Creatinine and without Obstetrical Conditions" QualifyingEncounter
with ["Procedure": "High Risk Procedures for AKI"] HighRiskProcedures
such that HighRiskProcedures.performed.toInterval ( ) starts during QualifyingEncounter.hospitalizationWithObservation ( )
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
Denominator Exclusion |
|
define "Denominator Exclusion":
"Encounter with Less Than 2 Creatinine Results within 48 Hours of Arrival"
union "Encounter with Index eGFR Less Than 60 within First 48 Hours"
union "Encounter with 0.3 mg dL or More Increase in Creatinine"
union "Encounter with Kidney Dialysis Started 48 Hours or Less After Arrival without High Creatinine"
union "Encounter with High Risk Diagnosis for AKI"
union "Encounter with High Risk Procedures for AKI"
|
| 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 |
| CQMCommon |
hospitalizationWithObservation |
|
/*
@description: Hospitalization with Observation returns the total interval from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter
*/
define fluent function hospitalizationWithObservation(TheEncounter Encounter ):
TheEncounter Visit
let ObsVisit: Last([Encounter: "Observation Services"] LastObs
where LastObs.status = 'finished'
and LastObs.period ends 1 hour or less on or before start of Visit.period
sort by end of period
),
VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
EDVisit: Last([Encounter: "Emergency Department Visit"] LastED
where LastED.status = 'finished'
and LastED.period ends 1 hour or less on or before VisitStart
sort by end of period
)
return Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]
|
| Library Name |
Name |
| QICoreCommon |
earliest |
|
/*
@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<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ):
(choice.toInterval()) period
return
if (period."hasStart"()) then start of period
else end of period
|
| Library Name |
Name |
| QICoreCommon |
hasStart |
|
/*
@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
)
|
| Library Name |
Name |
| CQMCommon |
encounterDiagnosis |
|
/*
@description: Returns the Condition resources referenced by the diagnosis element of the Encounter
*/
define fluent function encounterDiagnosis(Encounter Encounter ):
Encounter.diagnosis D
return singleton from ([Condition] C where C.id = D.condition.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 |
| CMS832HHAKIFHIR |
HighestSerumCreatinineResult |
|
define function "HighestSerumCreatinineResult"(QualifyingEncounter Encounter):
( Max((from
"Qualifying Creatinine Lab Result by Time" LabTests
let LabResult: LabTests.CrLabResult
where LabTests.CrEncInPtId = QualifyingEncounter.id
).CrLabResult
)
)
|
| Library Name |
Name |
| QICoreCommon |
isLaboratory |
|
/*
@description: Returns true if the given observation is a laboratory observation
*/
define fluent function isLaboratory(observation Observation):
exists (observation.category C
where C ~ "laboratory"
)
|
| Library Name |
Name |
| FHIRHelpers |
ToConcept |
|
/*
@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
}
|
| 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 |
| CMS832HHAKIFHIR |
LowestSerumCreatinineResult |
|
define function "LowestSerumCreatinineResult"(QualifyingEncounter Encounter):
( Min((from
"Qualifying Creatinine Lab Result by Time" LabTests
let LabResult: LabTests.CrLabResult
where LabTests.CrEncInPtId = QualifyingEncounter.id
).CrLabResult
)
)
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
1.5IncreaseInCreatinine |
|
// following functions work with Cr result as Quantity (not decimal, but Quantity value is decimal)
define function "1.5IncreaseInCreatinine"(QualifyingEncounter Encounter):
"HighestSerumCreatinineResult"(QualifyingEncounter) / 1.5
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
2.0IncreaseInCreatinine |
|
define function "2.0IncreaseInCreatinine"(QualifyingEncounter Encounter):
"HighestSerumCreatinineResult"(QualifyingEncounter) / 2
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
CreatinineLabTestwithResultwithinFirst48Hours |
|
define function "CreatinineLabTestwithResultwithinFirst48Hours"(QualifyingEncounter Encounter):
from
["Observation": "Creatinine Mass Per Volume"] CreatinineTest
where CreatinineTest.value is not null
and CreatinineTest.effective.earliest ( ) during Interval[start of QualifyingEncounter.hospitalizationWithObservation ( ), start of QualifyingEncounter.hospitalizationWithObservation ( ) + 48 hours]
and CreatinineTest.effective.earliest ( ) during QualifyingEncounter.hospitalizationWithObservation ( )
and CreatinineTest.status in { 'final', 'amended', 'corrected' }
return CreatinineTest
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
MaleeGFR |
|
define function "MaleeGFR"(QualifyingEncounter Encounter):
if Patient.gender = 'male' then ( 142 * Min({("IndexCreatinine"(QualifyingEncounter).value / 0.9), 1 }) ^ ( - 0.302 ) * Max({("IndexCreatinine"(QualifyingEncounter).value / 0.9), 1 }) ^ ( - 1.200 ) * 0.9938 ^ ( AgeInYearsAt(start of QualifyingEncounter.hospitalizationWithObservation()) ) )
else null
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
IndexCreatinine |
|
define function "IndexCreatinine"(QualifyingEncounter Encounter):
Coalesce("LowestSerumCreatinineIn24Hours"(QualifyingEncounter), singleton from "FirstSerumCreatinineIn48Hours"(QualifyingEncounter))
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
LowestSerumCreatinineIn24Hours |
|
define function "LowestSerumCreatinineIn24Hours"(QualifyingEncounter Encounter):
Min((from
"Qualifying Creatinine Lab Result by Time" LabTestsLow
let LabResult: LabTestsLow.CrLabResult
where LabTestsLow.CrEncInPtId = QualifyingEncounter.id
and LabTestsLow.CrLabTime during Interval[start of QualifyingEncounter.hospitalizationWithObservation(), start of QualifyingEncounter.hospitalizationWithObservation() + 24 hours]
).CrLabResult
)
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
FirstSerumCreatinineIn48Hours |
|
// find result from earliest time in 48 hrs
define function "FirstSerumCreatinineIn48Hours"(QualifyingEncounter Encounter):
from
"Qualifying Creatinine Lab Result by Time" LabTests
let LabResult: LabTests.CrLabResult
where ( "EarliestSerumCreatinineTimeIn48Hours"(QualifyingEncounter) = LabTests.CrLabTime )
return LabResult as Quantity
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
EarliestSerumCreatinineTimeIn48Hours |
|
// find earliest time in 48 hrs
define function "EarliestSerumCreatinineTimeIn48Hours"(QualifyingEncounter Encounter):
( Min((from
"Qualifying Creatinine Lab Result by Time" LabTests48
let LabResult48: LabTests48.CrLabResult
where LabTests48.CrEncInPtId = QualifyingEncounter.id
and LabTests48.CrLabTime during Interval[start of QualifyingEncounter.hospitalizationWithObservation(), start of QualifyingEncounter.hospitalizationWithObservation() + 48 hours]
).CrLabTime
)
)
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
FemaleeGFR |
|
// eGFR functions return as decimal value rather than Quantity
define function "FemaleeGFR"(QualifyingEncounter Encounter):
if Patient.gender = 'female' then ( 142 * Min({("IndexCreatinine"(QualifyingEncounter).value / 0.7), 1 }) ^ ( - 0.241 ) * Max({("IndexCreatinine"(QualifyingEncounter).value / 0.7), 1 }) ^ ( - 1.200 ) * 0.9938 ^ ( AgeInYearsAt(start of QualifyingEncounter.hospitalizationWithObservation()) ) * 1.012 )
else null
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
EarliestSerumCreatinineResult |
|
define function "EarliestSerumCreatinineResult"(QualifyingEncounter Encounter):
from
"Qualifying Creatinine Lab Result by Time" LabTests
let LabResult: LabTests.CrLabResult
where ( "EarliestSerumCreatinineTime"(QualifyingEncounter) = LabTests.CrLabTime )
return LabResult as Quantity
|
| Library Name |
Name |
| CMS832HHAKIFHIR |
EarliestSerumCreatinineTime |
|
define function "EarliestSerumCreatinineTime"(QualifyingEncounter Encounter):
( Min((from
"Qualifying Creatinine Lab Result by Time" LabTestsEarly
let LabResultEarly: LabTestsEarly.CrLabResult
where LabTestsEarly.CrEncInPtId = QualifyingEncounter.id
).CrLabTime
)
)
|