Ministry of higher education
& scientific research
University of qadisiyah
College of computer science
& information technology
Computer section
Expert system for disease diagnosis
A report submitted to the department computer science of the
requirements for Obtaining a bachelor’s degree in computer science and
information technology / computer department
Howrah salim sagub , hadeel Edweer Khashan , hajar kareem Abd alradha &
baneen kareem hamzia
2019
By Dr. Mohammed Abbas kadim
ميحرلا نمحرلا هللا بسم
يم)) ِ كأ َ ِ ْم لَنَا إِاَل َما َعلا ْمتَ نَا ۖ إِنا َ ((قَالُوا سبحانَ َ ِ
يم ا ْْلَك ُ
َنت ال َْعل ُ ك ََل عل َ ُْ َ
صدق هللا العظيم
سورة البقرة (اية )23
Acknowledgement
I would like to acknowledge and express my deep gratitude to all who
supported me in encouragement and support in the completion of this project and
all my appreciation and respect to supervisor would also like to thank all the
professors of and all the people who supported me to complete my project, I also
like the oldest this my success to my parents Most special thanks to my parents for
the constant reminders and much needed motivation., also I love this oldest of my
success to them. And foremost to God, who makes all things possible.
zz
Contents
Chapter One: Introduction to Artificial Intelligence and Expert Systems
1-1 Introduction 1
Chapter two: expert system and components
2-1 expert system 4
2-2 components of an expert system 4
2-2-1 User Interface 5
2-2-2 Knowledge Base 6
2-2-3 Inference Engine 6
2-2-4 Development Engine 7
Chapter three: diseases diagnosis
3-1 introduction
9
3-2 common cold 9
3-2-1 Symptoms of common cold 01
3-2-2 Treatments of common cold
00
3-3 Mumps
01
3-3-1 Symptoms of mumps
01
3-3-2 Treatment of mumps
03
3-4 Chickenpox
02
3-4-1 Symptoms of chickenpox
03
3-4-2 Treatment of chickenpox
03
3-5 Measles 01
04
3-5-1 symptoms of measles
3-5-2 Treatment of measles 05
3-6 Influenza 05
3-6-1 Symptoms of influenza
05
3-6-2 Treatment of influenza 06
3-7 German Measles
07
3-7-1 Symptoms of German measles 07
3-7-2 Treatment of German measles 08
3-8 Programming in prolog 19
3-9 Steps of algorithem 19
4-1Convert the algorithm into programming
code using the language of the prolog 20
References 23
ABSTRACT
Diseases should be treated well and on time. If they are not treated on
time, they can lead to many health problems and these problems may
become the cause of death. These problems are becoming worse due to
the scarcity of specialists, practitioners and health facilities. In an effort to
address such problems, studies made attempts to design and develop
expert systems which can provide advice for physicians and patients to
facilitate the diagnosis and recommend treatment of patients. This review
presents a comprehensive study of medical expert systems for diagnosis
of various diseases. It provides a brief overview of medical diagnostic
expert systems
Chapter One: Introduction to Artificial
Intelligence and Expert Systems
1-1 Introduction
Artificial intelligence (AI) is an area of computer science that emphasizes the
creation of intelligent machines that work and react like humans. Some of the
activities computers with artificial intelligence are designed for include:[1]
Speech recognition
Learning
Planning
Problem solving
Knowledge engineering is a core part of AI research. Machines can often act and
react like humans only if they have abundant information relating to the world.
Artificial intelligence must have access to objects, categories, properties and
relations between all of them to implement knowledge engineering. Initiating
common sense, reasoning and problem-solving power in machines is a difficult
and tedious task.
Machine learning is also a core part of AI. Learning without any kind of
supervision requires an ability to identify patterns in streams of inputs, whereas
learning with adequate supervision involves classification and numerical
regressions. Classification determines the category an object belongs to and
regression deals with obtaining a set of numerical input or output examples,
thereby discovering functions enabling the generation of suitable outputs from
respective inputs. Mathematical analysis of machine learning algorithms and their
performance is a well-defined branch of theoretical computer science often referred
to as computational learning theory [2].
machine perception deals with the capability to use sensory inputs to deduce the
different aspects of the world, while computer vision is the power to analyze visual
inputs with a few sub-problems such as facial, object and gesture recognition.
Expert Systems are computer programs that are derived from a branch of
computer science research called Artificial Intelligence (AI). AI's scientific goal is
to understand intelligence by building computer programs that exhibit intelligent
behavior. It is concerned with the concepts and methods of symbolic inference, or
reasoning, by a computer, and how the knowledge used to make those inferences
will be represented inside the machine [3].
Of course, the term intelligence covers many cognitive skills, including the ability
to solve problems, learn, and understand language; AI addresses all of those. But
most progress to date in AI has been made in the area of problem solving --
concepts and methods for building programs that reason about problems rather
than calculate a solution.
AI programs that achieve expert-level competence in solving problems in task
areas by bringing to bear a body of knowledge about specific tasks are called
knowledge-based or expert systems. Often, the term expert systems is reserved for
programs whose knowledge base contains the knowledge used by human experts,
in contrast to knowledge gathered from textbooks or non-experts. More often than
not, the two terms, expert systems (ES) and knowledge-based systems (KBS), are
used synonymously. Taken together, they represent the most widespread type of AI
application. The area of human intellectual endeavor to be captured in an expert
system is called the task domain. Task refers to some goal-oriented, problem-
solving activity. Domain refers to the area within which the task is being
performed. Typical tasks are diagnosis, planning, scheduling, configuration and
design. An example of a task domain is aircraft crew scheduling [4].
Building an expert system is known as knowledge engineering and its practitioners
are called knowledge engineers. The knowledge engineer must make sure that the
computer has all the knowledge needed to solve a problem. The knowledge
engineer must choose one or more forms in which to represent the required
knowledge as symbol patterns in the memory of the computer -- that is, he (or she)
must choose a knowledge representation. He must also ensure that the computer
can use the knowledge efficiently by selecting from a handful of reasoning
methods [2].
Chapter two: expert system and components
2-1 expert system
An expert system is a computer program or we can say an application that can
solve complex of the complex problem in a particular domain. It is designed using
the concept of Artificial Intelligence and was first introduced in the Department
of Computer Science, Stanford University. The expert system can perform at the
extraordinary level of human intelligence or human experts.
Basically, the expert system represents the knowledge of the human expert in the
form of heuristic. It can be also considered as an instance of a decision support
system. The knowledge base and decision rule are the most unique and
distinguishing features of an expert system [3].
The concept of the expert system is normally based on assumption that an expert’s
knowledge can be stored in computer memory and then applied by other when
needed. An expert system shares knowledge of a human expert in a specific area of
study such as production engineering, genetic engineering and so on. It is found
that the problem-solving capabilities of an expert system are as good as that of
human experts or sometimes even better than the human experts now [1].
2-2 components of an expert system
. The components of the expert system consist of four major parts. They are – User
Interface, Inference Engine, Development Engine & Knowledge Base [6].
Figure(2-1): Components of an expert system
2-2-1 User Interface :
It enables the users to enter instruction and information into the expert system and
to receive information from it. The information is in the form of values assigned to
certain variables. The user interface has two parts: [7]
1. Expert System Input: A user can use method for input command, natural
language and customize the interface.
2. Expert System Output: Expert systems are designed to provide output or
solution for a specific domain.
2-2-2 Knowledge Base :
It contains the fact that describes the problem area and knowledge representation
technique that describes manner. That means the knowledge base contains a really
high-quality and extraordinary knowledge in that particular domain. The term
problem domain is used to describe the problem. Or basically, we can say that the
knowledge base is the set of rules. The rules in the knowledge base are usually
coded in the form- if x, then y where x is a condition, y is an action to be taken if
the condition is true.
These kinds of rules are got from experience of human experts. The knowledge of
human experts is translated into the ―if-then‖ statements. It is a kind of job i.e.
taking the knowledge from the experts and converting them into such statements.
A person who does this job is known as Knowledge Engineer.
An exceptionally remarkable knowledge is required to model the intelligence
system. Since the whole success of an expert system depends upon the knowledge
that is so accurate and also the bug-free, that is why it is considered as one of the
important components of an expert system. [8]
2-2-3 Inference Engine:
The inference engine is one of the most important components of an expert system.
The inference engine of the expert system is the rule that defines how the expert
process interprets the knowledge in an appropriate manner. The inference engine
work in either forward chaining or backward chaining.
In simple, the inference engine takes the knowledge base and then it applies
processing to it. The inference engine processes a massive amount of data in some
kind of consistent way and it comes out with a conclusion. It works as a brain in an
expert system.
Backward chaining process faster than the forward chaining because it doesn’t
make multiple passes through the rule set. Backward chaining is especially
appropriate when-
1. There are multiple goal variables.
2. There are many rules.
3. All or most of the rules don’t have examined in the process of reaching the
solution.
Forward chaining is performed when the goal is to draw some conclusion from a
given set of fact. [9]
2-2-4 Development Engine:
Development engine is used to create the expert system. This process usually
involved building the rule set. There are two basic approaches-
1. Programming Language
2. Expert system shell
Programming Language: An expert system can be created using any
programming language. However, two especially suited to the symbolical
representation of knowledge is LISP and Prolog.
Expert System Shell: Expert system shell is a readymade processor that can be
tailored to specific problem domain through the addition of the appropriate
knowledge base. In most cases, the shell can be produced an expert system quicker
and easier than by programming language. The first commercial shell was for
knowledge engineering environment (K.E.E.). It was designed for the use of a
computer design, especially for LISP language for a LISP machine. [5]
Chapter three: diseases diagnosis
3-1 introduction
For decades, the delivery of health care has proceeded with a blind spot: Diagnostic
errors—inaccurate or delayed diagnoses—persist throughout all care settings and harm
an unacceptable number of patients. Getting the right diagnosis is a key aspect of health
care, as it provides an explanation of a patient’s health problem and informs subsequent
health care decisions (Holmboe and Durning, 2014). Diagnostic errors can lead to
negative health outcomes, psychological distress, and financial costs. If a diagnostic
error occurs, inappropriate or unnecessary treatment may be given to a patient, or
appropriate—and potentially lifesaving—treatment may be withheld or delayed.
However, efforts to identify and mitigate diagnostic errors have so far been quite
limited. Absent a spotlight to illuminate this critical challenge, diagnostic errors have
been largely unappreciated within the quality and patient safety movements. The result
of this inattention is significant: It is likely that most people will experience at least one
diagnostic error in their lifetime, sometimes with devastating consequences. [3]
3-2 common cold
The term ―common cold‖ refers to a mild upper respiratory viral illness. It is self-
limited therefore it will go away without treatment. It is the most frequent acute illness
in the United States. It is separate and a distinctly different illness than influenza, throat
infection, bronchitis, sinusitis, pertussis, and allergic rhinitis. The average person has
two or three colds a year. Colds are caused by many viruses, which cause similar
symptoms. The same virus can cause another cold after re-exposure. However, the
second illness is usually milder and lasts for a shorter period of time. Seasonal patterns
may be seen for some of the viruses. [10]
3-2-1 Symptoms
Symptoms of the common cold are mostly due to the response of the individual to the
infection, rather than to direct damage to the respiratory tract from the virus. Symptoms
vary from person to person and include: [11]
• Rhinitis (runny nose) and congestion are the most common symptoms.
• Sore throat, sneezing, cough, malaise (feeling ill) • Fever is uncommon in adults but
may be present in children
• Purulent (colored, thick drainage containing pus) drainage may be seen with the
common cold. The presence of purulence does not distinguish between a cold or sinus
infection. Incubation period/symptom duration
• From the time of contact until onset of symptoms is generally 24 to 72 hours but can
be as early as 10 to 12 hours after exposure.
• Symptoms usually last 3 to 10 days, but can last up to two weeks in some people.
3-2-2 Treatments
Try treating your cold at home first. Call your provider right away, or go to the
emergency room, if you have: [10]
Difficulty breathing
Sudden chest pain or abdominal pain
Sudden dizziness
Acting strangely
Severe vomiting that does not go away
Also call your provider if:
You start acting strangely
Your symptoms get worse or do not improve after 7 to 10 days
3-3 Mumps
Mumps is a viral infection that primarily affects saliva-producing (salivary) glands that
are located near your ears. Mumps can cause swelling in one or both of these glands.
Mumps was common in the United States until mumps vaccination became routine.
Since then, the number of cases has dropped dramatically.
However, mumps outbreaks still occur in the United States, and the number of cases has
crept up in recent years. These outbreaks generally affect people who aren't vaccinated,
and occur in close-contact settings such as schools or college campuses.
Complications of mumps, such as hearing loss, are potentially serious but rare. There's
no specific treatment for mumps.[12]
3-3-1 Symptoms
Some people infected with the mumps virus have either no signs or symptoms or very
mild ones. When signs and symptoms do develop, they usually appear about two to
three weeks after exposure to the virus.
The primary sign of mumps is swollen salivary glands that cause the cheeks to puff out.
Other signs and symptoms may include: [13]
Pain in the swollen salivary glands on one or both sides of your face
Pain while chewing or swallowing
Fever
Headache
Muscle aches
Weakness and fatigue
Loss of appetite
3-3-2 Treatment
Mumps is caused by a virus, so antibiotics aren't effective. But most children and adults
recover from an uncomplicated case of mumps within a few weeks.
People with mumps are generally no longer contagious and can safely return to work or
school about five days after the appearance of signs and symptoms. [13]
3-4 Chickenpox
Chickenpox is an infection caused by the varicella-zoster virus. It causes an itchy rash
with small, fluid-filled blisters. Chickenpox is highly contagious to people who haven't
had the disease or been vaccinated against it. Today, a vaccine is available that protects
children against chickenpox. Routine vaccination is recommended by the Centers for
Disease Control and Prevention (CDC).
The chickenpox vaccine is a safe, effective way to prevent chickenpox and its possible
complications. [14]
3-4-1 Symptoms
The itchy blister rash caused by chickenpox infection appears 10 to 21 days after
exposure to the virus and usually lasts about five to 10 days. Other signs and symptoms,
which may appear one to two days before the rash, include: [15]
Fever
Loss of appetite
Headache
Tiredness and a general feeling of being unwell (malaise)
Once the chickenpox rash appears, it goes through three phases:
Raised pink or red bumps (papules), which break out over several days
Small fluid-filled blisters (vesicles), which form in about one day and then break and
leak
Crusts and scabs, which cover the broken blisters and take several more days to heal
3-4-2 Treatment
In otherwise healthy children, chickenpox typically needs no medical treatment. Your
doctor may prescribe an antihistamine to relieve itching. But for the most part, the
disease is allowed to run its course. [14]
3-5 Measles
Measles is a highly infectious viral illness that can be very unpleasant and sometimes
lead to serious complications. It's now uncommon in the UK because of the
effectiveness of vaccination.
Anyone can get measles if they haven't been vaccinated or haven't had it before,
although it's most common in young children.
The infection usually clears in around 7 to 10 days. [16]
3-5-1 symptoms
The initial symptoms of measles can include: [17]
a runny or blocked nose
sneezing
watery eyes
swollen eyelids
sore, red eyes that may be sensitive to light
a high temperature (fever), which may reach around 40C (104F)
small greyish-white spots in the mouth
aches and pains
a cough
loss of appetite
tiredness, irritability and a general lack of energy
3-5-2 Treatment
There are several things you can do to help relieve your symptoms and reduce the risk
of spreading the infection. [16]
These include:
taking paracetamol or ibuprofen to relieve fever, aches and pains (aspirin should not be
given to children under 16 years old)
drinking plenty of water to avoid dehydration
closing the curtains to help reduce light sensitivity
using damp cotton wool to clean the eyes
staying off school or work for at least 4 days from when the rash first appears
In severe cases, especially if there are complications, you or your child may need to be
admitted to hospital for treatment.
3-6 Influenza
Influenza is a viral infection that attacks your respiratory system — your nose, throat
and lungs. Influenza is commonly called the flu, but it's not the same as stomach "flu"
viruses that cause diarrhea and vomiting. [18]
3-6-1 Symptoms
Initially, the flu may seem like a common cold with a runny nose, sneezing and sore
throat. But colds usually develop slowly, whereas the flu tends to come on suddenly.
And although a cold can be a nuisance, you usually feel much worse with the flu.
Common signs and symptoms of the flu include: [19]
Fever over 100.4 F (38 C)
Aching muscles
Chills and sweats
Headache
Dry, persistent cough
Fatigue and weakness
Nasal congestion
Sore throat
3-6-2 Treatment
Usually, you'll need nothing more than bed rest and plenty of fluids to treat the flu. But
in some cases, your doctor may prescribe an antiviral medication, such as oseltamivir
(Tamiflu) or zanamivir (Relenza). If taken soon after you notice symptoms, these drugs
may shorten your illness by a day or so and help prevent serious complications.
Oseltamivir is an oral medication. Zanamivir is inhaled through a device similar to an
asthma inhaler and shouldn't be used by anyone with respiratory problems, such as
asthma and lung disease.
Antiviral medication side effects may include nausea and vomiting. These side effects
may be lessened if the drug is taken with food. Oseltamivir has also been associated
with delirium and self-harm behaviors in teenagers. [18]
Some strains of influenza have become resistant to amantadine and rimantadine
(Flumadine), which are older antiviral drugs.
3-7 German Measles
is a very contagious (easily spread) illness caused by the rubella virus. It is usually a
mild illness. But in rare cases, it may cause more serious problems.
If you are pregnant and get infected with the rubella virus, your baby (fetus) could
become infected too. This can cause birth defects, including serious defects known as
congenital rubella syndrome (CRS). CRS can cause hearing loss, eye problems, heart
problems, and other complications.
Rubella also is called German measles or 3-day measles. [20]
3-7-1 Symptoms
German Measles "little red" and the disease features a red rash, "rubella" is Latin for
"little red."
Symptoms normally appear 14 to 21 days after infection.
The rash often starts on the face and moves to the trunk and limbs. After 3 to 5 days, it
fades and disappears. It can be itchy.
Other symptoms include: [21]
headache
a mild fever a stuffy or runny nose
red, inflamed eyes
nerve inflammation
enlarged and tender lymph nodes
aching joints
Though infection can happen at any age, Rubella rarely affects young infants or people
over 40 years. A person who is infected with rubella at an older age will normally have
more severe symptoms.
3-7-2 Treatment
No medications can shorten the rubella infection, and symptoms are usually mild
enough that no treatment is necessary.
Bed rest and acetaminophen may help relieve any symptoms.
If a woman contracts the virus during pregnancy, hyperimmune globulin may be
prescribed to help fight off the virus and reduce the chance of congenital rubella
syndrome.
A person with a rubella infection should avoid coming into contact with anyone who
may be pregnant and anyone who has a weakened immune system until 1 week after the
rash appears.
If a child has rubella, their school should be informed. [20]
3-8 Programming in Prolog
declare facts describing explicit relationships between objects and properties
objects might have (e.g. Mary likes pizza, grass has_colour green, Fido
is_a_dog, Mizuki taught Paul Japanese )
define rules defining implicit relationships between objects (e.g. the sister rule
above) and/or rules defining implicit object properties (e.g. X is a parent if there
is a Y such that Y is a child of X).
One then uses the system by:
asking questions above relationships between objects, and/or about object
properties (e.g. does Mary like pizza? is Joe a parent?)
3-9 Steps of algorithem:-
1-Enter the patients' name .
2- Ask the patient about symptoms.
3- If yes ,continue with symptoms of the same disease ,if the answer doesn’t go to
the symptoms of another disease.
4-If all symptoms of the disease match , we will diagnose the disease .
5- In the absence of any matte , he says the disease is unknow
Chapter four : Convert the algorithm into
programming code using the language of the
prolog
In short , the program is a set of questions, these questions are symptomatic of diseases
and according to your answer to questions ,yes or no ,it diagnoses the disease
in this step of implementing the program we enter the name of the patient,
As shown in figure below :
Figure(4-1)
in this step of implementation on the program will ask some questions to
the patient As shown in figure below :
Figure(4-2)
in this step the program makes a decision and diagnoses the disease according to
the patients’ answer to the questions posed As shown in figure below:
Figure(4-3)
the first part of the program is the classification of
variables only
Domains
Disease, indication =symbol
Patient, name=string
in this part of the program the decision and diagnosis of the disease is taken
according to the patients’ answer to the question
response(reply):-
readchar (reply),
write(reply),
(Programming in Logic) or Prolog is a high-level programming language that has its roots
in first-order logic or first-order predicate calculus. The language was conceived in
Marseilles, France in the early 1970s by a group led by Alain Colmerauer. It is one of the
first logic programming languages and it remains popular today. It is a programming
language commonly associated with computational linguistics and artificial intelligence and
is used in expert systems, theorem proving and pattern matching over natural language
parse trees and natural language processing.
The first Prolog system was developed in 1972 by Colmerauer together with Philippe
Roussel and was based on Robert Kowalski’s procedural interpretation of Horn clauses. It
was also partly motivated by the desire to reconcile the use of logic as a declarative
knowledge representation language with procedural representation of knowledge. Prolog
was purposely developed for natural language processing – concerned with computer and
human (natural) language interactions.
Prolog differs from other programming languages as it is declarative rather than sequences
of commands. It is sometimes called a rule-based or declarative language since it is
expressed in terms of relationships among objects' properties, presented as facts and rules.
A computation is initiated by running a query over these relations.
Applications include:
Machine learning
Robot planning
Automated reasoning
Problem solving
Intelligent database retrieval
Natural language understanding
Specification language
Prolog is a logic programming language associated with artificial
intelligence and computational linguistics.
Prolog has its roots in first-order logic, a formal logic, and unlike many other programming
languages, Prolog is intended primarily as a declarative programming language: the
program logic is expressed in terms of relations, represented as facts and rules. A
computation is initiated by running a query over these relations.
The language was first conceived by Alain Colmerauerand his group in Marseille, France,
in the early 1970s and the first Prolog system was developed in 1972 by Colmerauer with
Philippe Roussel.
Prolog was one of the first logic programming languages, and remains the most popular
among such languages today, with several free and commercial implementations available.
The language has been used for theorem proving, expert systems,] term rewriting,]type
systems, and automated planning,] as well as its original intended field of use, natural
language processing. Modern Prolog environments support the creation of graphical user
interfaces and networked applications, as well , PROLOG is particularly strong in solving
problems characterized by requiring complex symbolic computations. As conventional
imperative programs for solving this type of problems tend to be large and impenetrable,
equivalent PROLOG programs are often much shorter and easier to grasp. The language in
principle enables a programmer to give a formal specification of a program; the result is
then almost directly suitable for execution on the computer. Moreover, PROLOG supports
stepwise refinement in developing programs because of its modular nature. These
characteristics render PROLOG a suitable language for the development of prototype
systems. There are several dialects of PROLOG in use, such as for example, C-PROLOG,
SWIPROLOG, Sicstus-PROLOG, LPA-PROLOG. C-PROLOG, also called Edinburgh
PROLOG, was taken as a basis for the ISO standard. C-PROLOG itself is now no longer in
use. The language definition of C-PROLOG is derived from an interpreter developed by
D.H.D. Warren, D.L. Bowen, L. Byrd, F.C.N. Pereira, and L.M. Pereira, written in the C
programming language for the UNIX operating system. Most dialects only have minor
syntactical and semantical differences with the standard language. However, there are a
small number of dialects which change the character of the language in a significant way,
for example by the necessity of adding data-type information to a program. A typical
example is offered by the version of the PROLOG language supported by Visual PROLOG.
In recent versions of PROLOG, several features have been added to the ISO standard.
Modern PROLOG versions provide a module concept and extensive interfaces to the
operating system, as well as tools for the development of graphical user interfaces.
Applications of Prolog
Some applications of Prolog are:
intelligent data base retrieval
natural language understanding
expert systems
specification language
machine learning
robot planning
automated reasoning
problem solving
References
[1] Jimmy Singla , Dinesh Grover and Abhinav Bhandar , ―Medical Expert Systems for
Diagnosis of Various Diseases‖ , International Journal of Computer Applications (0975 –
8887) Volume 93 – No.7, May 2014.
[2] Jimmy Singla, ―The Diagnosis of Some Lung Diseases in a PROLOG Expert System‖,
International Journal of Computer Applications, vol. 78, no. 15, pp. 37-40, September 2013.
[3] Samy S. Abu Naser, Abu Zaiter A. Ola, ―An Expert System for Diagnosing Eye Diseases
Using CLIPS‖, Journal of Theoretical and Applied Information Technology, pp. 923-930,
2005-2008 JATIT.
[4] Jules Stein, ―Clinical findings and common symptoms in retinitis pigmentosa‖ ,
National Center for Biotechnology Information, U.S. National Library of Medicine, 1988.
[5] Michael P. Vrabec, George J. Florakis. Ophthalmic Essenals. 1992.
[6] Eye Trauma and Emergencies. A slide-script program. American Academy of
Ophthalmology. 1996.
[7] Eye Trauma and Emergencies. A slide-script program. American Academy of
[8] Managing the Red Eye. A slide-script program. American Academy of Ophthalmology.
1991.
[9] Eye Exam. The Essenals. American Academy of Ophthalmology. 2004
[10] "The Cost of the Common Cold and Influenza". Imperial War Museum: Posters of
Conflict. vads. Archived from the original on 27 July 2011.
[11] "Hot drinks ease cold and flu". National Health Service. 10 December 2008. Retrieved 17
February2019.
[12] Mumps. Centers for Disease Control and Prevention.
https://www.cdc.gov/mumps/. Accessed July 14, 2018.
[13] AskMayoExpert. Mumps. Rochester, Minn.: Mayo Foundation for Medical
Education and Research; 2018. Accessed July 13, 2018
[14] Chickenpox (Varicella) Signs & Symptoms". Centers for Disease Control and
Prevention (cdc.gov). 16 November 2011. Archived from the original on 4 February
2015. Retrieved 4 February 2015
[15] Pincus, Matthew R.; McPherson, Richard A.; Henry, John Bernard (2007). "Ch.
54". Henry's clinical diagnosis and management by laboratory methods (21st ed.).
Saunders Elsevier. ISBN 978-1-4160-0287-1
[16] Drutz JE. Measles, mumps, and rubella immunization in infants, children, and
adolescents. https://uptodate.com/contents/search. Accessed July 13, 2018.
[17] "Rubella (German Measles, Three-Day Measles)". cdc.gov. December 17,
2014. Archived from the original on 2 April 2015. Retrieved 30 March 2015.
[18] Live attenuated influenza vaccine [LAIV] (The nasal spray flu vaccine). Centers
for Disease Control and Prevention. https://www.cdc.gov/flu/about/qa/nasalspray.htm.
Accessed July 13, 2018.
[19] AskMayoExpert. Influenza vaccination. Rochester, Minn.: Mayo Foundation for
Medical Education and Research; 2017.
[20] "Measles (Red Measles, Rubeola)". Dept of Health, Saskatchewan. Archived from the
original on 10 February2015
[21] Caserta, MT, ed. (September 2013). "Measles". Merck Manual Professional. Merck Sharp & Dohme
Corp. Archived from the original on 23 March 2014. Retrieved 23 March 2014.
Program
domains
disease,indication = symbol
Patient,name = string
predicates
hypothesis(string,disease)
symptom(name,indication)
response(char)
go
clauses
go :-
write("What is the patient's name? "),
readln(Patient),
hypothesis(Patient,Disease),
write(Patient,"probably has ",Disease,"."),nl.
go :-
write("Sorry, I don't seem to be able to"),nl,
write("diagnose the disease."),nl.
symptom(Patient,fever) :-
write("Does ",Patient," have a fever (y/n) ?"),
response(Reply),
Reply='y'.
symptom(Patient,rash) :-
write("Does ",Patient," have a rash (y/n) ?"),
response(Reply),
Reply='y'.
symptom(Patient,headache) :-
write("Does ",Patient," have a headache (y/n) ?"),
response(Reply),
Reply='y'.
symptom(Patient,runny_nose) :-
write("Does ",Patient," have a runny_nose (y/n) ?"),
response(Reply),
Reply='y'.
symptom(Patient,conjunctivitis) :-
write("Does ",Patient," have a conjunctivitis (y/n) ?"),
response(Reply),
Reply='y'.
symptom(Patient,cough) :-
write("Does ",Patient," have a cough (y/n) ?"),
response(Reply),
Reply='y'.
symptom(Patient,body_ache) :-
write("Does ",Patient," have a body_ache (y/n) ?"),
response(Reply),
Reply='y'.
symptom(Patient,chills) :-
write("Does ",Patient," have a chills (y/n) ?"),
response(Reply),
Reply='y'.
symptom(Patient,sore_throat) :-
write("Does ",Patient," have a sore_throat (y/n) ?"),
response(Reply),
Reply='y'.
symptom(Patient,sneezing) :-
write("Does ",Patient," have a sneezing (y/n) ?"),
response(Reply),
Reply='y'.
symptom(Patient,swollen_glands) :-
write("Does ",Patient," have a swollen_glands (y/n) ?"),
response(Reply),
Reply='y'.
hypothesis(Patient,measles) :-
symptom(Patient,fever),
symptom(Patient,cough),
symptom(Patient,conjunctivitis),
symptom(Patient,runny_nose),
symptom(Patient,rash).
hypothesis(Patient,german_measles) :-
symptom(Patient,fever),
symptom(Patient,headache),
symptom(Patient,runny_nose),
symptom(Patient,rash).
hypothesis(Patient,flu) :-
symptom(Patient,fever),
symptom(Patient,headache),
symptom(Patient,body_ache),
symptom(Patient,conjunctivitis),
symptom(Patient,chills),
symptom(Patient,sore_throat),
symptom(Patient,runny_nose),
symptom(Patient,cough).
hypothesis(Patient,common_cold) :-
symptom(Patient,headache),
symptom(Patient,sneezing),
symptom(Patient,sore_throat),
symptom(Patient,runny_nose),
symptom(Patient,chills).
hypothesis(Patient,mumps) :-
symptom(Patient,fever),
symptom(Patient,swollen_glands).
hypothesis(Patient,chicken_pox) :-
symptom(Patient,fever),
symptom(Patient,chills),
symptom(Patient,body_ache),
symptom(Patient,rash).
hypothesis(Patient,measles) :-
symptom(Patient,cough),
symptom(Patient,sneezing),
symptom(Patient,runny_nose).
response(Reply) :-
readchar(Reply),
write(Reply),nl.