This page is part of the Clinical Guidelines (v1.0.0: STU 1) based on FHIR R4. This is the current published version in it's permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions
Formats: Narrative, XML, JSON, Turtle
Raw xml
<Library xmlns="http://hl7.org/fhir">
<id value="CKDRiskLogic"/>
<meta>
<profile
value="http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-computablelibrary"/>
</meta>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml"><h2>Contents</h2><p><code>text/cql</code></p><pre><code class="language-sql">library CKDRiskLogic version '1.0'
using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0' called FHIRHelpers
codesystem "SNOMEDCT": 'http://snomed.info/sct'
codesystem "LOINC": 'http://loinc.org'
codesystem "RxNorm": 'http://www.nlm.nih.gov/research/umls/rxnorm'
valueset "Chronic Kidney Disease": 'ckd-valueset-ckd'
valueset "Diabetes mellitus": 'ckd-valueset-diabetes'
valueset "eGFR Labs": 'ckd-valueset-egfr'
valueset "UACR Labs": 'ckd-valueset-uacr'
valueset "Creatinine Labs": 'ckd-valueset-creatinine'
code "Blood pressure systolic and diastolic": '55284-4' from "LOINC"
context Patient
// Conditions
//
define "Has CKD or Diabetes":
"Has CKD" or "Has Diabetes"
define "Has CKD":
exists( "Chronic Kidney Disease Dx" )
define "Has Diabetes":
exists( "Diabetes Dx" )
define "CKD or Diabetes Dx":
"Chronic Kidney Disease Dx" union "Diabetes Dx"
define "Chronic Kidney Disease Dx":
[Condition: code in "Chronic Kidney Disease"] condition
where condition.clinicalStatus.value in { 'active', 'recurrence' }
define "Diabetes Dx":
[Condition: code in "Diabetes mellitus"] condition
where condition.clinicalStatus.value in { 'active', 'recurrence' }
// Laboratory observations
//
define "Has eGFR or UACR Lab":
"Last eGFR Lab Result" is not null
or "Last UACR Lab Result" is not null
define "Last eGFR Lab Result":
Last( [Observation: code in "eGFR Labs"] )
define "Last eGFR Quantity":
"Last eGFR Lab Result" Result
return ToQuantity(Result.value as Quantity)
define "Has Abnormal eGFR":
"Last eGFR Quantity".value < 60
define "Last UACR Lab Result":
Last( [Observation: code in "UACR Labs"] )
define "Last UACR Quantity":
"Last UACR Lab Result" Result
return ToQuantity(Result.value as Quantity)
define "Has Abnormal UACR":
"Last UACR Quantity" uacr
return UACRtoMetric(uacr).value > 30
define "Last Creatinine Lab Result":
Last( [Observation: code in "Creatinine Labs"] )
define "Last Creatinine Quantity":
"Last Creatinine Lab Result" Result
return ToQuantity(Result.value as Quantity)
define "Needs eGFR Lab":
"eGFR Lab is Overdue"
or ("eGFR Lab Frequency" is not null and "Last eGFR Lab Result" is null)
define "eGFR Lab Frequency":
case
when "CKD Stage" >= 4
then 3 months
when "CKD Stage" >= 3
then 6 months
when "Has CKD or Diabetes"
then 12 months
else null
end
define "eGFR Lab is Overdue":
"Last eGFR Lab Result" Result
return
case
when Result.effective is null
then true
when Result.effective is dateTime
then (Result.effective.value + "eGFR Lab Frequency") < Today()
when Result.effective is Period
then (end of PeriodToInterval(Result.effective) + "eGFR Lab Frequency") < Today()
else false
end
define NeedsGFRSummary: 'Order Renal Lab Panel'
define NeedsGFRDetail:
case
when "CKD Stage" >= 1
then 'eGFR lab recommended every ' + ToString("eGFR Lab Frequency") + ' for Stage ' + ToString("CKD Stage") + ' CKD.'
when "Has CKD or Diabetes"
then 'eGFR lab recommended every ' + ToString("eGFR Lab Frequency") + ' for CKD or Diabetes.'
else null
end
define NeedsGFRSeverity: 'info'
define "CKD Stage":
"Last eGFR Quantity" egfr
return case
when egfr.value < 15
then 5
when egfr.value < 30
then 4
when egfr.value < 60
then 3
when egfr.value < 90
then 2
when egfr.value >= 90
// TODO this does not parse
//case when UACRtoMetric("Get UACR Quantity").value > 20
// then 1
//else 0
//end
then 0
else 0
end
// Referrals
//
define "Recommend Nephrology Referral":
"5-Year Risk Level" = 'High'
define NephrologyReferralDetail: 'Referral to a nephrologist is recommended when 5-year risk is High'
define NephrologyReferralSeverity: 'info'
//
// Tangri CKD risk model
//
// 4 variable
// 1 – 0.9750 ^ exp (-0.2201 × (age/10 – 7.036) + 0.2467 × (male – 0.5642) – 0.5567 × (eGFR/5 – 7.222) + 0.4510 × (logACR – 5.137))
// 5 year factor = 0.9240
//
// 8 variable
// 1 – 0.9780 ^ exp (-0.1992 × (age/10 – 7.036) + 0.1602 × (male – 0.5642) – 0.4919 × (eGFR/5 – 7.222) + 0.3364 × (logACR – 5.137)
// – 0.3441 × (albumin – 3.997) + 0.2604 × (phosphorous – 3.916) – 0.07354 × (bicarbonate – 25.57) – 0.2228 × (calcium – 9.355))
// 5 year factor = 0.9301
define "2-YearRiskDetail":
'2-year kidney failure risk of ' + ToString("2-Year CKD Risk Percent") + '% is considered to be ' + "2-Year Risk Level" + ' risk.'
define "5-YearRiskDetail":
'5-year kidney failure risk of ' + ToString("5-Year CKD Risk Percent") + '% is considered to be ' + "5-Year Risk Level" + ' risk.'
define "2-YearRiskSeverity": if "2-Year Risk Level" = 'High' then 'warning' else 'info'
define "5-YearRiskSeverity": if "5-Year Risk Level" = 'High' then 'warning' else 'info'
define "2-Year CKD Risk Percent":
"2-Year CKD Risk" risk
return Round(risk * 100, 2)
define "5-Year CKD Risk Percent":
"5-Year CKD Risk" risk
return Round(risk * 100, 2)
define "2-Year CKD Risk":
"Last eGFR Quantity" egfr
return calculateCkdRisk(0.9750, 0, AgeInYears(), egfr, UACRtoMetric("Last UACR Quantity"))
define "5-Year CKD Risk":
"Last eGFR Quantity" egfr
return calculateCkdRisk(0.9240, 0, AgeInYears(), egfr, UACRtoMetric("Last UACR Quantity"))
// The ckdFactor is a variable determined by (Non-) North American location and whether calculation is 2 or 5 year prediction
define function calculateCkdRisk(ckdFactor Decimal, sex Integer, age Integer, egfr System.Quantity, acr System.Quantity):
1.0 - Power(ckdFactor, Exp(-0.2201 * (age / 10 - 7.036) + 0.2467 * (sex - 0.5642) - 0.5567 * (egfr.value / 5 - 7.222) + 0.4510 * (Ln(acr.value) - 5.137)))
define "2-Year Risk Level":
"2-Year CKD Risk Percent" riskPercent
return case
when riskPercent < 5
then 'Low'
when riskPercent < 15
then 'Intermediate'
when riskPercent > 15
then 'High'
else null
end
define "5-Year Risk Level":
"5-Year CKD Risk Percent" riskPercent
return case
when riskPercent < 5
then 'Low'
when riskPercent < 15
then 'Intermediate'
when riskPercent > 15
then 'High'
else null
end
// Conversion functions
define function PeriodToInterval(value FHIR.Period):
Interval[value."start".value, value."end".value]
define function CodingToCode(coding FHIR.Coding):
System.Code {
code: coding.code.value,
system: coding.system.value,
version: coding.version.value,
display: coding.display.value
}
define function ToConcept(concept FHIR.CodeableConcept):
System.Concept {
codes: concept.coding C return CodingToCode(C),
display: concept.text.value
}
define function ToQuantity(quantity FHIR.Quantity):
System.Quantity {
value: quantity.value.value,
unit: quantity.unit.value
}
define function UACRtoMetric(qty System.Quantity):
case when qty.unit = 'mg/mmol creatinine' then
System.Quantity { value: qty.value * 8.84, unit: 'mg/g' }
when qty.unit = 'mg/g' then
qty
else
// unknown units, ignore this quantity in calculation
null
end
define function ToMetric(qty System.Quantity):
case when qty.unit = 'lb' then
System.Quantity { value: qty.value * 0.454, unit: 'kg' }
when qty.unit = 'in' then
System.Quantity { value: qty.value * 0.0254, unit: 'm' }
else
qty
end
</code></pre></div>
</text>
<extension
url="http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability">
<valueCode value="shareable"/>
</extension>
<extension
url="http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability">
<valueCode value="computable"/>
</extension>
<extension
url="http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability">
<valueCode value="publishable"/>
</extension>
<extension
url="http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeRepresentationLevel">
<valueCode value="structured"/>
</extension>
<url value="http://hl7.org/fhir/uv/cpg/Library/CKDRiskLogic"/>
<version value="1.0.0"/>
<name value="CKDRiskLogic"/>
<title value="Chronic Kidney Disease (CKD) risk screening logic"/>
<status value="active"/>
<experimental value="true"/>
<type>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/library-type"/>
<code value="logic-library"/>
</coding>
</type>
<date value="2021-02-11T20:30:11+00:00"/>
<publisher value="HL7 FHIR Clinical Guidelines Example Artifact"/>
<description value="Chronic Kidney Disease (CKD) risk screening logic"/>
<jurisdiction>
<coding>
<system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
<code value="001"/>
<display value="World"/>
</coding>
</jurisdiction>
<content>
<contentType value="text/cql"/>
<data
value="bGlicmFyeSBDS0RSaXNrTG9naWMgdmVyc2lvbiAnMS4wJwoKdXNpbmcgRkhJUiB2ZXJzaW9uICc0LjAuMCcKCmluY2x1ZGUgRkhJUkhlbHBlcnMgdmVyc2lvbiAnNC4wLjAnIGNhbGxlZCBGSElSSGVscGVycwoKY29kZXN5c3RlbSAiU05PTUVEQ1QiOiAnaHR0cDovL3Nub21lZC5pbmZvL3NjdCcKY29kZXN5c3RlbSAiTE9JTkMiOiAnaHR0cDovL2xvaW5jLm9yZycKY29kZXN5c3RlbSAiUnhOb3JtIjogJ2h0dHA6Ly93d3cubmxtLm5paC5nb3YvcmVzZWFyY2gvdW1scy9yeG5vcm0nCgp2YWx1ZXNldCAiQ2hyb25pYyBLaWRuZXkgRGlzZWFzZSI6ICdja2QtdmFsdWVzZXQtY2tkJwp2YWx1ZXNldCAiRGlhYmV0ZXMgbWVsbGl0dXMiOiAnY2tkLXZhbHVlc2V0LWRpYWJldGVzJwoKdmFsdWVzZXQgImVHRlIgTGFicyI6ICdja2QtdmFsdWVzZXQtZWdmcicKdmFsdWVzZXQgIlVBQ1IgTGFicyI6ICdja2QtdmFsdWVzZXQtdWFjcicKdmFsdWVzZXQgIkNyZWF0aW5pbmUgTGFicyI6ICdja2QtdmFsdWVzZXQtY3JlYXRpbmluZScKCmNvZGUgIkJsb29kIHByZXNzdXJlIHN5c3RvbGljIGFuZCBkaWFzdG9saWMiOiAnNTUyODQtNCcgZnJvbSAiTE9JTkMiCgpjb250ZXh0IFBhdGllb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