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

Decision Table Logic #19

Closed
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
4 changes: 1 addition & 3 deletions input/cql/HIVB2DTLogic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ define "Guidance":
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.'''
then 'This is a sign and/or symptom of a serious health condition.\nImmediately take action or refer for care if client is showing this sign of a serious illness.'
else null
end

Expand Down
57 changes: 24 additions & 33 deletions input/cql/HIVB9DTLogic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,28 @@ include WHOCommon called WCom
include WHOConcepts called WCx
include WHOEncounterElements called WElm

parameter Today Date default Today()

context Patient

/*
@input: "HIV status negative or unknown"
@pseudocode: "HIV status" IN 'HIV-negative', 'Unknown'
*/
define "HIV status negative or unknown":
exists(Elements."HIV status" S
where S in { Concepts."HIV-negative", Concepts."Unknown" })
exists(Elements."HIV Status" O
where O.value ~ Concepts."HIV-negative" or
O.value ~ Concepts."Unknown"
)

/*
@input: "Partner HIV reported positive"
@pseudocode: "Partner HIV status (reported)"='HIV-positive'
*/
define "Partner HIV positive":
exists(Elements."Partner HIV status reported Observation" O
where O.value ~ Concepts."HIV-positive")
where O.value ~ Concepts."HIV-positive"
)

/*
@input: "Sex partner's HIV treatment status is partner not virally suppressed"
Expand Down Expand Up @@ -80,8 +85,7 @@ define "HIV burden of setting is low HIV burden setting":
@pseudocode: "Key population member" = TRUE
*/
define "Key population member":
exists(Elements."Key population member B.DE49 Observation" O
where O.value is true)
Elements."Is Key population member B.DE49"

/*
@input: "Currently pregnant"
Expand Down Expand Up @@ -111,16 +115,14 @@ define "Presumptive TB":
@pseudocode: "Currently on PrEP"=True
*/
define "Currently on PrEP":
exists(Elements."Currently on PrEP" O
where O.value is true)
Elements."Currently on PrEP"

/*
@input: "At elevated risk for HIV acquisition"
@pseudocode: "At elevated risk for HIV acquisition"=True
*/
define "At elevated risk for HIV acquisition":
exists(Elements."At elevated risk for HIV acquisition" O
where O.value is true)
exists(Elements."At elevated risk for HIV acquisition B.DE225")

/*
@output: "Schedule an annual follow-up test"
Expand All @@ -133,7 +135,7 @@ define "Schedule an annual follow-up test":
then true
when "HIV burden of setting is high HIV burden setting"
then true
when "Key population memeber"
when "Key population member"
then true
when "At elevated risk for HIV acquisition"
then true
Expand Down Expand Up @@ -182,11 +184,9 @@ define "Schedule a 'Follow-up test recommended date' during a third trimester vi
define "Schedule a 'Follow-up test recommended date' at first ANC contact date":
"Pregnant in low HIV burden setting" and
case
when "Key population member":
then true
when "Partner has HIV and is not virally suppressed":
then true
when "At elevated risk for HIV acquisition"
when "Key population member" or
"Partner has HIV and is not virally suppressed" or
"At elevated risk for HIV acquisition"
then true
else false
end
Expand All @@ -197,35 +197,26 @@ define "Schedule a 'Follow-up test recommended date' at first ANC contact date":
define "Guidance":
case
when "Schedule an annual follow-up test"
then """Schedule an annual follow-up test.

WHO guidance recommends annual retesting for people who have ongoing HIV-related risks in all settings. These include people with a known HIV-positive partner who is not virally suppressed on ART."""
then 'Schedule an annual follow-up test.\nWHO guidance recommends annual retesting for people who have ongoing HIV-related risks in all settings. These include people with a known HIV-positive partner who is not virally suppressed on ART.'
when "Follow-up test recommended"
then """Recommend a follow-up test.

In certain conditions and situations, individuals who have been tested for HIV in the past can be advised to retest. These include:
* Individuals presenting with a diagnosis or receiving treatment for STIs or viral hepatitis,
* Individuals with a confirmed or presumptive TB diagnosis,
* Outpatients presenting with clinical conditions or symptoms indicative of HIV, individuals with recent HIV risk exposure."""
then 'Recommend a follow-up test.\nIn certain conditions and situations, individuals who have been tested for HIV in the past can be advised to retest. These include:\n * Individuals presenting with a diagnosis or receiving treatment for STIs or viral hepatitis,\n * Individuals with a confirmed or presumptive TB diagnosis,\n * Outpatients presenting with clinical conditions or symptoms indicative of HIV, individuals with recent HIV risk exposure.'
when "Schedule quarterly retesting for PrEP users"
then """Schedule quarterly retesting for PrEP users."""
then 'Schedule quarterly retesting for PrEP users.'
when "Schedule an HIV test, syphilis test, hepatitis B test as early as possible during this pregnancy"
then """Schedule an HIV test, syphilis test, hepatitis B test as early as possible during this pregnancy

All pregnant women should be tested for HIV as well as syphilis and hepatitis B virus at least once and as early as possible during pregnancy."""
when "Schedule a 'Follow-up test recommended date' at first ANC contact date":
then """In low HIV burden settings, retesting all pregnant women is not warranted unless focused among women from key populations or at high ongoing risk, such as those from key populations or with partners with HIV who are not virally suppressed. Countries could consider one additional retest in the post-partum period, such as at 14 weeks, six months or nine months for women in high HIV burden or incidence districts or provinces, key populations or women with partners with HIV who are not virally suppressed."""
then 'Schedule an HIV test, syphilis test, hepatitis B test as early as possible during this pregnancy.\nAll pregnant women should be tested for HIV as well as syphilis and hepatitis B virus at least once and as early as possible during pregnancy.'
when "Schedule a 'Follow-up test recommended date' at first ANC contact date"
then 'In low HIV burden settings, retesting all pregnant women is not warranted unless focused among women from key populations or at high ongoing risk, such as those from key populations or with partners with HIV who are not virally suppressed. Countries could consider one additional retest in the post-partum period, such as at 14 weeks, six months or nine months for women in high HIV burden or incidence districts or provinces, key populations or women with partners with HIV who are not virally suppressed.'
else null
end

/*
@dynamicValue: "Date to schedule"
*/
define "Schedule Follow-up Date"
define "Schedule Follow-up Date":
case
when "Schedule an annual follow-up test":
when "Schedule an annual follow-up test"
then Today + 1 years
when "Schedule quarterly retesting for PrEP users":
when "Schedule quarterly retesting for PrEP users"
then Today + 3 months
else null
end
Expand Down
4 changes: 3 additions & 1 deletion input/cql/HIVConfig.cql
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ library HIVConfig

using FHIR version '4.0.1'

include HIVConcepts called Concepts

/*
* HIV burden of setting
*/
define "HIV burden of setting":
'High HIV burden setting'
Concepts."High HIV burden setting"

define "Testing Interval":
3 months
Expand Down
1 change: 0 additions & 1 deletion input/cql/HIVElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -12493,7 +12493,6 @@ define "Other E.DE70":
@activity: HIV.E1 Capture or update mother's history
@description: The date and time of the client's ANC contact (in the ANC DAK this is called 'Contact date')
*/

define "Antenatal care contact":
["Encounter": type in ConceptsCustom."Antenatal care contact"]

Expand Down
Loading
Loading