Knowledge Engineering (CM3016) Coursework A Medical Diagnosis Expert System 1. Administrative Issues
Lecturers/Examiners: Dr. K. Hui & Dr. N. WiratungaCoursework Part:
This coursework examines the students’ ability to construct an expert system using the CLIPS expert system shell. 3. The Problem Domain
The application problem is to build an expert system that performs medical diagnosis on a limited set of diseases from a patient’s symptoms, and suggests a prescription based on previous cases. *** WARNING *** The diagnosis and prescription suggested in this coursework are purely fictitious. It MUST NOT be used to diagnose real medical problems. ***WARNING *** 3.1. The Diseases
Our medical diagnosis expert system has knowledge on four diseases: influenza, chickenpox, tuberculosis and meningitis. 3.2. The Symptoms
The symptoms of the diseases are summarised in the following table:
Knowledge Engineering (CM3016) Coursework
A “” means the symptom must be present. A “” means the symptom must be absent. A “?” means it is an optional symptom. 3.3. The Drug
After the disease is diagnosed, the system proceeds to suggest a prescription. The first step in making a prescription is to choose a drug. Attention is needed as some drugs may not be suitable for young patients and pregnant women. In general, patients are classified into THREE categories: junior, adult, and pregnant female. The following table summarises the drug choices: Patient Category 3.4. The Dosage
Once the drug is chosen, the next step is to decide on the dosage. The system keeps a record of previous prescriptions, which it uses to recommend the appropriate dosage of medication. Currently there are 12 cases covering all drug and patient category combinations without duplication:
Heavier patients need a heavier dose than slimmer patients. For two patients in the same category (see Section 3.3 on “patient categories”), every kilogram of weight difference requires a dosage change of 2% in all drugs.
On the other hand, younger patients are more sensitive to drugs than older patients. Every year of age difference requires a dosage change of 1% in all drugs. Given the details of a patient and the details of a retrieved previous
Knowledge Engineering (CM3016) Coursework
patient case, the recommended dosage is calculated according to the following formulae:
weight difference = patient’s weight – previous case’s weightweight adjustment = case's dosage * weight difference * 0.02age difference = patient’s age – previous case’s ageage adjustment = case's dosage * age difference * 0.01recommended dosage=previous case's dosage + weight adjustment + age adjustment
For example, for a child aged 5 and weighted 20kg prescribed with Oseltamivir, Patient#1 is retrieved as the reference case. So we have:
weight adjustment = 10.0*(20-15)*0.02 = 1.0 mgage adjustment = 10.0*(5-3)*0.01 = 0.2 mgrecommended dosage= 10.0+1.0 + 0.2 = 11.2 mg
For a pregnant female aged 32 and weighted 65 prescribed with Rifampicin, Patient#11 is retrieved as the reference case. We have:
weight adjustment = 50.0*(32-35)*0.02= -3.0 mgage adjustment = 50.0*(65-58)*0.01= -7.5 mgrecommended dosage = 50.0 + (-13.0) + (-7.5) = 39.5 mgweight adjustment = 50.0*(65-85)*0.02= -20.0 mgage adjustment = 50.0*(32-35)*0.01= -1.5 mgrecommended dosage = 50.0 + (-20.0) + (-1.5) = 28.5 mg
Using CLIPS, implement an expert system that: Diagnoses the disease of a patient from his/her symptoms. Suggests a prescription for the diagnosed disease, including the suitable drug
The overall task can be divided into the following sub-tasks: Task #1 – Input of Symptoms
Write rules that ask the user to input all symptoms of the patient (as described in section 3.2). In your rules, assert these input values as facts. Here are some examples:
Task #2 – Diagnosis of Disease Knowledge Engineering (CM3016) Coursework
Based on the knowledge in section 3.2, write rules that find the disease from the patient’s symptoms and assert the diagnosis result as a fact into the working memory. The following is an example:
Note that the fact of diagnosis result should be deduced and asserted by the rules based on the patient's symptoms (as asserted in Task#1). To simplify the problem, you DO NOT need to give any diagnosis if the patient’s symptoms do not meet any disease.
Task #3: Getting the Patient’s Details
Write rules that ask the user for the patient’s details, including the patient’s age, gender, weight and pregnancy status (if applicable). In general, we assume that all men and juniors will not get pregnant.
Store these patient details as facts. Here are some examples:
Task #4: Categorising the Patient
You may have noticed in section 3.3 that the choice of drug depends on the disease and the patient’s category.
According to the patient’s details (i.e. age, gender, etc.), write rules that classify the patient into one of the three categories of: junior, adult and pregnant female. Here are the definitions of the categories:
A patient who is 12 year-old or younger, either male or female. We assume that a child will not get pregnant. Pregnant female: A 13 year-old or older female who is pregnant. Adult:
A male who is 13 year-old or older, or a female who is 13 year-old or older and not pregnant.
Task #5: Choosing a Drug
Write rules that recommend a drug according to the diagnosis result (from Task#2) and the patient’s category (from Task#4). Assert the recommended drug as a fact. For example:
Task #6: Prescription Case Template
Define a CLIPS template that represents a prescription. This template will be used to create facts that represent the previous prescription cases given in section 3.4. Knowledge Engineering (CM3016) Coursework
Apart from the slots/attributes listed in the table, you also need an extra “category” slot that will store the category of the each previous prescription case (see section 3.3 on “patient categories”). This “category” slot is needed when you try to look for a similar prescription case for your new patient.
Task #7: Previous Prescription Cases
Using the template defined in Task #6, represent the prescription cases in section 3.4 as non-ordered facts. You SHOULD NOT fill in the “category” slot by hand. Task#8 below will do the job.
Task #8: Filling in the Missing Category of Prescription Cases
Write rules that find and modify the “category” slot of all previous prescription cases (from Task#7) to reflect the different categories of the patients in these cases.
Task #9: Calculating the Dosage
Write rules that calculate the correct dosage of the prescribed drug (from Task#5) using a previous prescription case (from Task#7 & 8) and the patient’s diagnosis result (from Task#2). Assert the calculated dosage as a fact. For example:
Task #10: Output of Diagnosis Result & Prescription
Write a rule that prints the diagnosis result (from Task#2), the prescribed drug (from Task#5) and dosage (from Task#9) to the screen. Your output must include the diagnosed disease, the prescribed drug and the recommended dosage. For example:
Patient is diagnosed with tuberculosis. Suggest a prescription of pyrazinamide with a dosage of 92.4mg. Knowledge Engineering (CM3016) Coursework5. Hints & Help
General Hints
The ten sub-tasks are designed to guide you through the complex development process so that you can focus at one sub-problem at a time. You are advised NOT to skip any task as later tasks depend on the completion of previous tasks.
Task #1: Input of Symptoms
Consider using the “(initial-fact)” fact to trigger your rule.
Avoid stupid questions like: “Is a male patient pregnant?”, or “Does the patient cough with blood?” when the user already said that the patient does not cough.
Task #6: Prescription Case Template
User a suitable “type” and “default” value for each slot. This will help your Task #8.
Task #7: Prescription Cases
Use default value (as defined in Task #6) if appropriate.
Task #8: Filling in Missing Category of Previous Prescription Cases
Look for cases which have a missing/ unknown category.
Task #9: Calculating the Dosage
You should only retrieve a previous prescription case of the same drug and patient category.
Calculate the “weight adjustment” and “age adjustment”. Then apply these adjustments.
Task #10: Output of Diagnosis Result & Prescription
You DO NOT need to print anything if no disease can be diagnosed. 6. Submission Instructions
You must submit a document that includes the followings:
• A properly completed cover sheet on the front and the marking grid.
• An annotated listing of the knowledge base.
• Annotated test runs. Knowledge Engineering (CM3016) Coursework
You must also submit an electronic copy of your knowledge base on a 3.5-inch floppy diskette or a CDROM. Your disc must be clearly labelled with all of the information listed on the cover sheet and your name and matriculation number. The paper and electronic version of your program must match exactly. Your disc must not contain any additional material.
Coursework should be handed in at the coursework boxes opposite the School Office. The boxes will be clearly labelled. 7. Late Submission
You should observe the School rules concerning late submission of coursework. You are reminded that partial submissions by the due deadline can be made and that this is certainly preferable to a non-submission.*** LAST WARNING *** Make sure that you read the “extract from University Regulations” on page two of the Coursework Cover Sheet before signing the declaration. ANY ACT OF ACADEMIC MISCONDUCT WILL BE DEALT WITH ACCORDINGLY. *** LAST WARNING *** Knowledge Engineering (CM3016) Coursework
Aqua Critox® Phosphorus Recovery From Sewage Sludge Using the Aquacritox Supercritical Water Oxidation Process Keywords: Aquacritox, supercritical water oxidation, sewage sludge, energy, phosphorus, biological phosphorus removal Abstract Sewage sludge is a potential source of energy. A kilogram of dried sewage sludge contains approximately 20,000 BTU’s of energy. The challe
Detecting Network Intrusions via Sampling : A Game Theoretic Approach { muralik, lakshman } @bell-labs.coma more detailed examination of the packet. To prevent packet In this paper, we consider the problem of detecting an in- mis-ordering or reduction of link throughput this examination truding packet in a communication network. Detection is ac- has to be done preferably at line rates. Pa