An expert system that helps beginner doctors to diagnose digestive diseases.
This project is built with java and jess for building knowledge base.
github repository can be found here: https://github.com/Ammar-Shiekh/digestive-diagnosis-system
2. Gathering knowledge
First step was gathering knowledge from expert doctors in the field of diagnosing digestive
diseases.
Meetings with the experts were hard because of the experts’ time limits.
Gathered knowledge was un-ordered (natural-language knowledge).
Some diseases are very hard to diagnose without laboratory tests, they share the same
symptoms (Hepatitis A, B and C).
3. Ordering knowledge
Ordering knowledge is the process of transforming un-ordered knowledge (written in natural
language) to ordered knowledge (as rules and facts).
Some words were hard to implement as a rule or fact (i.e. usually, often, sometimes …etc.).
Certainty factor was the solution, giving a fact a certainty makes it uncertain (not absolutely true
and not absolutely false).
4. Writing rules in Jess
Diagnosing partitioned into four steps:
◦ Getting observations from patient.
◦ Asking patient to get more information for diagnosing.
◦ Asking patient for a laboratory test to make sure of the diagnosed disease.
◦ Giving the appropriate treatment or recommendation.
5. Getting observations step
In this step, we get:
◦ Basic information about patient (name, age).
◦ Information from patient about what he suffers (anorexia, nausea, fatigue, malaise, vomiting ...etc.).
We use forward chaining for this step.
Then the rules of this step will fire, and it will give a certainty-factor value for each disease.
(defrule acute-hepatitis-A
(control (phase 1))
(private-classification (class-name acute_hepatitis) (certainty-factor ?cf))
=>
(bind ?fcf (* 0.9 ?cf))
(assert (classification (class-name acute_hepatitis_A) (certainty-factor ?fcf)))
)
6. Asking step
In this step we ask the patient about the disease that has the highest probability (highest
certainty-factor value).
Backward chaining method is used in this step.
Our questions will be aimed to lower the certainty factor of the expected disease.
(defrule hepatitis-A-1
(control (phase 2))
?classification <- (classification (class-name acute_hepatitis_A) (certainty-factor ?cf1))
(askable (name "area_infected_hepatitis_A") (value ?value))
=>
(bind ?cf2 (if (= ?value TRUE) then 0.6 else -0.3))
(modify ?classification (certainty-factor (calculate-combined-uncertainty (list ?cf1 ?cf2))))
(identify-expected-class)
(undefrule hepatitis-A-1)
)
7. Requesting laboratory tests step
Here we will be asking patient to do a laboratory test, and give the results.
Requested tests will test the most expected disease (get an absolute decision).
Backward chaining method is used in this step.
(defrule lab-hepatitis-A
(control (phase 3))
?classification <- (classification (class-name acute_hepatitis_A))
(testable (name "positive_igm") (value ?value))
=>
(bind ?cf (if (= ?value FALSE) then -1 else 1))
(modify ?classification (certainty-factor ?cf))
(identify-expected-class)
(undefrule lab-hepatitis-A)
)
8. Recommending treatment/Diet step
In this step we will recommend the appropriate treatment/diet.
The recommended treatment/diet is based on the severity of the diagnosed disease and the
patients state.
In some cases, backward chaining method is used to question about the state of patient, or to
recommend doing some tests.
(defrule treat-H-pylori-peptic-ulcer
(control (phase 4))
(expected-classification (class-name "H_pylori_peptic_ulcer"))
=>
(printout t (?*strings* getString "treat_hpylori_peptic_ulcer") crlf)
)
9. Starting a new diagnosis
Below is the interface of starting a new diagnosis. Doctor should give the patient’s name and age
and some symptoms that are observed on the patient.
10. Test acute hepatitis A
Given observations: Dark urine, yellow skin, liver pain, weight loss and nausea.
11. Test chronic hepatitis B
Given observations: Dark urine, yellow skin, fever, weight loss, liver pain and fatigue.
12. Test chronic hepatitis C
Given observations: Yellow skin, acholic stool, liver pain, weight loss and vomiting.
13. Test peptic ulcer
Given observations: Upper abdominal pain, vomiting, headache, hematemesis and bloating.
15. Test unknown state
Given observations: Lower abdominal pain, fatigue, bloody diarrhea, headache and melena.
16. Reviewing diagnoses
Below is the interface that helps doctor reviewing diagnoses. Doctor can select a patient to
review his diagnoses or continue his last un-finished diagnosis.
17. Future work
System can be improved by support diagnosing more digestive diseases.
It can also help doctor examining the tests (i.e. endoscopy, colonoscopy or testing biopsies and
more).
More support of giving treatments depending on the whole state of the patient.