Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wsg 101 indicators 46 55 rebased #17

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 92 additions & 67 deletions input/cql/HIVB2DTLogic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -2,87 +2,112 @@
Library: HIV.B2.DT Logic

@DecisionID: HIV.B2.DT
@BusinessRule:
@Trigger:
@Description:

Check for signs of serious illness
Consolidated guidelines on HIV prevention, testing, treatment, service delivery and monitoring: recommendations for a public health approach (2021) Chapter 5: Advanced HIV Disease. Figure 5.1: Algorithm for providing a package of care for people with advanced HIV disease.
Should this just be for anyone with HIV?
Wouldn't other disease domains also code for general exam?
@BusinessRule: Check for signs of serious illness
@Trigger: HIV.B2 Check for signs of serious illness
@Trigger: HIV.D3 Check for signs of serious illness
@HitPolicy: Rule Order
@Description: Check for serious illness

Data Concepts:
* HIV.A.DE17: Age | Calculated age (number of years) of the client based on date of birth
* HIV.D.DE17: Signs of serious illness | Signs that may indicate the client has a serious illness and needs triage or an emergency referral
* HIV.D.DE9: Body temperature | Temperature of the client in Celsius

Consolidated guidelines on HIV prevention, testing, treatment, service delivery and monitoring: recommendations for a public health approach (2021) Chapter 5: Advanced HIV Disease. Figure 5.1: Algorithm for providing a package of care for people with advanced HIV disease.
*/

library HIVB2DTLogic

using FHIR version '4.0.1'

using FHIR version '4.0.1'

include HIVCommon version '0.0.1' called HIC
include FHIRHelpers version '4.0.1'
include WHOCommon called WCom
include FHIRCommon called FC
include HIVCommon version '0.0.1' called HIC
include HIVConcepts called HCx
include HIVEncounterElements called Elements
include FHIRHelpers version '4.0.1'

valueset "Tachycardia": ''
valueset "Tachypnea": ''
valueset "Unable to walk unaided": ''
valueset "Body temperature = ≥ 39 °C": ''
valueset "Other sign of serious illness (specify)": ''
valueset "Lethargy": ''
valueset "Unconsciousness": ''
valueset "Convulsions": ''
valueset "Unable to breastfeed": ''
valueset "Unable to drink": ''
valueset "Repeated vomiting": ''
include WHOCommon called WCom

context Patient
context Patient

/*
* Age = ≥ 10 years
@input: "Age 10 or older"
@pseudocode: 'Age' >= 10 years
*/

define "Age_10_or_more":
define "Age 10 or older":
AgeInYearsAt(Today()) >= 10

/*
* Age < 10 years
@input: "Age under 10"
@pseudocode: 'Age' < 10 years
*/

define "Age_less_than_10":
define "Age under 10":
AgeInYearsAt(Today()) < 10

define "Take action or refer client showing signs of a serious illness":
exists(([Observation: "Tachycardia"]
union [Observation: "Tachypnea"]
union [Observation: "Unable to walk unaided"]) O
where Age_10_or_more
and O.status in { 'final', 'amended' })
or exists(([Observation: "Lethargy"]
union [Observation: "Unconsciousness"]
union [Observation: "Convulsions"]
union [Observation: "Unable to breastfeed"]
union [Observation: "Unable to drink"]
union [Observation: "Unconsciousness"]
union [Observation: "Repeated vomiting"]) O
where Age_less_than_10
and O.status in { 'final', 'amended' }
)

//plan definition Immediately take action or refer for care if a client is having this issue.

/*
@output: "Immediately take action or refer for care if a client is having this issue"
*/
define "Immediately take action or refer for care if a client is having this issue":
exists(Elements."Signs of serious illness" O
where "Age 10 or older"
and O.value ~ HCx."Tachycardia")

/*
@output "Immediately take action or refer for care if client is showing this sign of a serious illness."
*/
define "Immediately take action or refer for care if client is showing this sign of a serious illness":
"Signs of serious illness age 10 or older" or "Signs of serious illness age under 10"

/*
@output "Use clinical judgement and consider local epidemiology to determine if symptoms suggest client is seriously ill"
*/
define "Use clinical judgement and consider local epidemiology to determine if symptoms suggest client is seriously ill":
exists (([Observation: "Body temperature = ≥ 39 °C"]
union [Observation: "Other sign of serious illness (specify)"]) O
where Age_10_or_more
and O.status in { 'final', 'amended' })
// Please this condition needs to be fixed
// or exists((([Observation: "Body temperature = ≥ 39 °C"]
// intersect [Observation: "Tachycardia"])
// or ([Observation: "Body temperature = ≥ 39 °C"]
// intersect [Observation: "Tachypnea"])
// or [Observation: "Other sign of serious illness (specify)"]) O
// where Age_less_than_10
// and O.status in { 'final', 'amended' })
// )


//plan definition Use clinical judgement and consider local epidemiology to determine if symptoms suggest client is seriously ill.
"Signs of serious illness requiring clinical judgement age 10 or older" or "Signs of serious illness requiring clinical judgement age under 10"

/*
@dynamicValue: Guidance
*/
define "Guidance":
case
when "Immediately take action or refer for care if a client is having this issue"
then "Immediately take action or refer for care if a client is having this issue."
when "Immediately take action or refer for care if client is showing this sign of a serious illness" and "Age 10 or older"
then "Immediately take action or refer for care if client is showing this sign of a serious illness."
when "Immediately take action or refer for care if client is showing this sign of a serious illness" and "Age under 10"
then """This is a sign and/or symptom of a serious health condition.

Immediately take action or refer for care if client is showing this sign of a serious illness."""
else null
end

/*
Supporting Logic
*/
define "Signs of serious illness age 10 or older":
"Age 10 or older" and Elements."Signs of serious illness" O
where
O.value ~ HCx."Tachypnea" or
O.value ~ HCx."Unable to walk unaided"

define "Signs of serious illness age under 10":
"Age under 10" and Elements."Signs of serious illness" O
where
O.value in {
HCx."Lethargy - HIV.D.DE22",
HCx."Unconsciousness",
HCx."Convulsions",
HCx."Unable to breastfeed",
HCx."Unable to drink",
HCx."Repeated vomiting"
}

define "Signs of serious illness requiring clinical judgement age 10 or older":
"Age 10 or older" and Elements."Signs of serious illness" O
where
O.value ~ HCx."Fever of 39 C or greater" or
O.value ~ HCx."Other sign of serious illness"

define "Signs of serious illness requiring clinical judgement age under 10":
"Age under 10" and Elements."Signs of serious illness" O
where
O.value ~ HCx."Fever of 39 C or greater" or
O.value ~ HCx."Other sign of serious illness"
2 changes: 1 addition & 1 deletion input/cql/HIVB7DTLogic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ valueset "Non-reactive": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de10

include FHIRHelpers version '4.0.1'
include WHOCommon called WCom
include FHIRCommon called FC


//code "Assay 1 Reactive": 'HIV.B.DE95' from "TestresultofHIVassay1Codes" display 'Assay 1 reactive'
//code "Reactive": 'HIV.B.DE103' from "HIV_DAK_Codes" display 'Reactive'
Expand Down
Loading
Loading