Lab Deliverable 3 (BlackBoard Pattern)

You will implement a medical diagnosis system that has, at its knowledge core 3 different 'specialists'. The user, as the sick patient, logs into the system. The patient is then asked a series of yes/no questions by the different specialists.  Depending on his/her answers, the patient is offered a final diagnosis by the system. There is a limit on the number of questions the diagnostic system can ask. If it fails to reach a solution within the limited number of questions, the patient dies (!) .

Details:  The different specialists each have their own knowledge base and ask questions according to it. Each specialists asks the patient 2 questions. Depending on the answers, the specialist writes down the diagnosis on the patients chart ( the blackboard). The next specialist, refers to the previous diagnosis by the others, and asks 2 questions, and writes down his own diagnosis.
Each diagnosis is accompanied by a confidence factor. If the various specialists converge on a solution before the patient dies, its a success story. A rudimentary knowledge base and logic flow is described later. It is sufficient to use this knowledge base, and course of logic for your system. You are ofcourse welcome to use a more complicated/extended knowledege base, more specialists etc.

What you have to implement:
A blackboard class called Chart, which will contain the different diagnosis made by the different specialists. The Chart is accessible to all the other entities for reading and writing. Atleast three different knowledge source classes (the specialists), say Psychologist, Internist and Neurologist. Each knowledge source has its own knowledge base. A control class called Physician, which decides which specialist gets to query the patient and to access the balckboard. The Physician also decides when a consensus in the diagnosis has been reached and informs the patient.

Example run:



Psy:  Are you feeling suicidal?   no
Psy:  Are you hallucinating?  yes
Psy writes diagnosis on chart

Int reads chart
Int:  Q1?
Int:  Q2?
Int writes on chart

Neu reads chart
Neu: Q1?
Neu: Q2?
Neu writes on chart

Phycisian examines chart
If consensus is reached, informs patient
If not ..
Psy reads chart....and so on



Sample Knowledge Base: (Feel free to make a more realistic knowledgebase and a more involved logic flow )
 
 

Flu-symptoms Migraine-symptoms Allergy-symptoms
Internist Sleepy Headache Watery eyes

Cold Throbbing Red nose
Psychologist Depression Tension Nervousness

Fatigue Irritability Anxiety
Neurologist Headache Pulsating pain Nerve twitching

Lethargy Nausea Dizzyness

Sample Logic Flow:

A specialist asks a patient 2 questions for an illness.
example
Int: Are you sleepy?  yes
Int: Are you cold? no
Int writes on chart : Flu  50%

Psy asks his questions regarding Flu-symptoms
Psy:  Depression? no
Psy: Fatigue? no
Psy writes on chart : Inconclusive

After all three finish, the Physician consults the chart to see if there is a diagnosis.
If there is a majority consensus a solution is reached. If all three have different answers the cycle continues. After 2 cycles, if there is still no consensus, the patient dies.