| 3.0.0-ballot |
| urn:oid:2.16.840.1.113883.4.642.40.48.28.1 |
| true |
|
World
|
| HL7 International / Clinical Decision Support |
| HL7 International / Clinical Decision Support |
Logic for an example congestive heart failure pathway
|
|
http://terminology.hl7.org/CodeSystem/library-type#logic-library
|
Type: Patient
Profile(s):
Patient
|
Type: Observation
Profile(s):
Observation
Must Support Elements: code, status, encounter
Code Filter(s):
Path: code
Code(s):
CHF Example Codes: body-weight-change (Body weight change)
|
Type: Observation
Profile(s):
Observation
Must Support Elements: code, status, encounter, issued, value
Code Filter(s):
Path: code
Code(s):
LOINC: 29463-7 (Body weight)
|
Type: Observation
Profile(s):
Observation
Must Support Elements: code, status, encounter, issued
Code Filter(s):
Path: code
Code(s):
LOINC: 9192-6 (Urine output 24 hour)
|
Type: Observation
Profile(s):
Observation
Must Support Elements: code, status, encounter, issued
Code Filter(s):
Path: code
Code(s):
CHF Example Codes: net-intake-output (Net intake/output)
|
Type: Observation
Profile(s):
Observation
Must Support Elements: code, status, encounter
Code Filter(s):
Path: code
Code(s):
CHF Example Codes: jvp (Jugular venous pressure)
|
Type: Observation
Profile(s):
Observation
Must Support Elements: code, status, encounter
Code Filter(s):
Path: code
Code(s):
LOINC: 2708-6 (Oxygen saturation in Arterial blood)
|
Type: Observation
Profile(s):
Observation
Must Support Elements: code, status, encounter
Code Filter(s):
Path: code
Code(s):
LOINC: 86919-8 (Potassium goal [Moles/volume] Serum or Plasma)
|
Type: Observation
Profile(s):
Observation
Must Support Elements: code, status, encounter
Code Filter(s):
Path: code
Code(s):
LOINC: 2160-0 (Creatinine [Mass/volume] in Serum or Plasma)
|
Type: Observation
Profile(s):
Observation
Must Support Elements: code, status, encounter
Code Filter(s):
Path: code
Code(s):
CHF Example Codes: egfr (eGFR result)
|
Type: Condition
Profile(s):
Condition
Must Support Elements: code, clinicalStatus, verificationStatus
|
| Name |
Use |
Card. |
Type |
Documentation |
| Encounter |
In |
0..1 |
Encounter |
|
| Patient |
Out |
0..1 |
Patient |
|
| Body Weight |
Out |
0..* |
Observation |
|
| Body Weight Change Assertion |
Out |
0..* |
Observation |
|
| Body Weight Change |
Out |
0..* |
Observation |
|
| Current Body Weight |
Out |
0..1 |
Observation |
|
| Previous Body Weight |
Out |
0..1 |
Observation |
|
| Current Body Weight Change |
Out |
0..1 |
integer |
|
| Urine Output |
Out |
0..* |
Observation |
|
| Current Urine Output |
Out |
0..1 |
Observation |
|
| Net Intake/Output |
Out |
0..* |
Observation |
|
| Current Net Intake/Output |
Out |
0..1 |
Observation |
|
| Jugular Venous Pressure |
Out |
0..* |
Observation |
|
| Oxygen Saturation |
Out |
0..* |
Observation |
|
| Potassium |
Out |
0..* |
Observation |
|
| Creatinine |
Out |
0..* |
Observation |
|
| eGFR |
Out |
0..* |
Observation |
|
| Eligibility Criteria |
Out |
0..* |
Condition |
|
|
library CHF version '3.0.0-ballot'
using FHIR version '4.0.1'
include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1' called FHIRHelpers
codesystem "SNOMED-CT": 'http://snomed.info/sct'
codesystem "LOINC": 'http://loinc.org'
codesystem "CHFCodes": 'http://hl7.org/fhir/uv/cpg/CodeSystem/chf-example-codes'
codesystem "Condition Clinical Status Code": 'http://terminology.hl7.org/CodeSystem/condition-clinical'
codesystem "Condition Verification Status Code": 'http://terminology.hl7.org/CodeSystem/condition-ver-status'
code "Congestive heart failure": '42343007' from "SNOMED-CT"
code "Body weight": '29463-7' from "LOINC"
code "Body weight change": 'body-weight-change' from "CHFCodes"
code "Urine output": '9192-6' from "LOINC"
code "Net intake/output": 'net-intake-output' from "CHFCodes"
code "Jugular venous pressure": 'jvp' from "CHFCodes"
code "Oxygen saturation": '2708-6' from "LOINC"
code "Potassium goal": '86919-8' from "LOINC" display 'Potassium goal [Moles/volume] Serum or Plasma' // meq/L
code "Creatinine in serum": '2160-0' from "LOINC" display 'Creatinine [Mass/volume] in Serum or Plasma'
code "eGFR result": 'egfr' from "CHFCodes" // NOTE: Too many to pick from, needs clinical/terminological SME input, in mol/mm/m2
code "Active condition": 'active' from "Condition Clinical Status Code"
code "Provisional condition": 'provisional' from "Condition Verification Status Code"
code "Confirmed condition": 'confirmed' from "Condition Verification Status Code"
parameter Encounter Encounter
context Patient
// Case Features
define "Body Weight":
[Observation: "Body weight"] O
where O.status = 'final'
and references(O.encounter, Encounter)
define "Body Weight Change Assertion":
[Observation: "Body weight change"] O
where O.status = 'final'
and references(O.encounter, Encounter)
define "Body Weight Change":
"Daily Body Weight Change" WC
return Observation {
id: id { value: Encounter.id + '-bodyweight-change' + ToString(WC.date) },
extension: {
Extension {
url: url { value: 'http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-instantiatesCaseFeature' },
value: canonical { value: 'http://hl7.org/fhir/uv/cpg/StructureDefinition/chf-bodyweight-change' }
},
Extension {
url: url { value: 'http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-caseFeatureType' },
value: code { value: 'asserted' }
}
},
status: ObservationStatus { value: 'final' },
code: CodeableConcept {
coding: {
Coding {
system: uri { value: 'http://hl7.org/fhir/uv/cpg/CodeSystem/chf-example-codes' },
code: code { value: 'body-weight-change' }
}
}
},
effective: dateTime { value: WC.date },
issued: instant { value: Now() },
subject: referenceTo(Patient),
encounter: referenceTo(Encounter),
value: Quantity {
value: decimal { value: WC.change.value },
unit: string { value: WC.change.unit },
system: uri { value: 'http://unitsofmeasure.org' },
code: code { value: WC.change.unit }
}
}
// These intermediate tuples are used to build the public Body Weight Change observations.
define private "Daily Body Weight":
(expand Encounter.period per day) Date
let maxWeight: Max("Body Weight" WT where WT.issued same day as Date return WT.value as FHIR.Quantity)
return { date: Date, weight: maxWeight }
define private "Daily Body Weight Change":
"Daily Body Weight" WT
let priorWeight: First("Daily Body Weight" PWT where PWT.date < WT.date sort by date descending).weight
return { date: WT.date, weight: WT.weight, priorWeight: priorWeight, change: WT.weight - priorWeight}
define "Current Body Weight":
First("Body Weight" WT where WT.issued same day as Today() sort by issued descending)
define "Previous Body Weight":
First("Body Weight" WT where WT.issued 1 day before day of Today() sort by issued descending)
define "Current Body Weight Change":
"Current Body Weight".value - "Previous Body Weight".value
define "Urine Output":
[Observation: "Urine output"] O
where O.status = 'final'
and references(O.encounter, Encounter)
define "Current Urine Output":
First("Urine Output" UO where UO.issued same day as Today() sort by issued descending)
define "Net Intake/Output":
[Observation: "Net intake/output"] O
where O.status = 'final'
and references(O.encounter, Encounter)
define "Current Net Intake/Output":
First("Net Intake/Output" IO where IO.issued same day as Today() sort by issued descending)
define "Jugular Venous Pressure":
[Observation: "Jugular venous pressure"] O
where O.status = 'final'
and references(O.encounter, Encounter)
define "Oxygen Saturation":
[Observation: "Oxygen saturation"] O
where O.status = 'final'
and references(O.encounter, Encounter)
define "Potassium":
[Observation: "Potassium goal"] O
where O.status = 'final'
and references(O.encounter, Encounter)
define "Creatinine":
[Observation: "Creatinine in serum"] O
where O.status = 'final'
and references(O.encounter, Encounter)
define "eGFR":
[Observation: "eGFR result"] O
where O.status = 'final'
and references(O.encounter, Encounter)
// Eligibility Criteria
define "Eligibility Criteria":
[Condition] C
where C.code ~ "Congestive heart failure"
and C.clinicalStatus ~ "Active condition"
and C.verificationStatus ~ "Confirmed condition"
// TODO: Handle contained references
// TODO: Handle bundle references
// TODO: Handle remote references
define function references(reference Reference, encounter Encounter):
EndsWith(reference.reference, '/' + encounter.id)
define function referenceTo(encounter Encounter):
Reference { reference: string { value: 'Encounter/' + encounter.id } }
define function referenceTo(patient Patient):
Reference { reference: string { value: 'Patient/' + patient.id } }
|
Encoded data
|
Encoded data
|
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
|
Description: Code System SNOMED-CT
Resource: SNOMED CT (all versions)
Canonical URL: http://snomed.info/sct
|
Description: Code System LOINC
Resource: Logical Observation Identifiers, Names and Codes (LOINC)
Canonical URL: http://loinc.org
|
Description: Code System CHFCodes
Resource: CHF Example Codes
Canonical URL: http://hl7.org/fhir/uv/cpg/CodeSystem/chf-example-codes
|
Description: Code System Condition Clinical Status Code
Resource: Condition Clinical Status Codes
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-clinical
|
Description: Code System Condition Verification Status Code
Resource: ConditionVerificationStatus
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-ver-status
|