Beruflich Dokumente
Kultur Dokumente
Abstract. We created a program, written in the CLIPS language for expert systems, to
distinguish migraines from headaches. The system can be web-based, takes seconds to input
data and quickly converges to the correct diagnosis. Over time such an application can
result in enormous savings to doctors, patients, and health care institutions.
1. Introduction
Headaches in a variety of forms are one of the most common areas of complaint presented to
the clinician. The International Headache Society has proposed a classification scheme for
headaches; but the rules to diagnose migraines seem to be oversimplified [1, 2]. A web-
enabled application to distinguish between migraines and headaches, using more
sophisticated rules, could provide physicians and patients with a powerful diagnostic tool.
Access to a well-established knowledge base could help to reduce potential errors in migraine
diagnoses.
The CLIPS expert system shell provides a cohesive tool for handling a wide variety of
knowledge with support for three different programming paradigms: rule-based, object-
oriented and procedural. Rule-based programming allows knowledge to be represented as
heuristics, or "rules of thumb," which specify a set of actions to be performed for a given
situation. CLIPS can be embedded within procedural code, called as a subroutine, and
integrated with languages such as C and Java. CLIPS can easily be extended by a user
through the use of several well-defined protocols, and it can be implemented in web-based
applications using the Common Gateway Interface (CGI) bin or Java servlets.
1.3 Hypothesis
This application involves the design and development of an expert system to aid physicians in
the diagnosis of migraine headaches. This study will explore the potential of such a system
to reduce the incidence of diagnostic errors that can occur in this domain.
1.4 Programming
The research application prototypes were developed on both UNIX and Windows platforms
using the following techniques: data mining, on-line transaction and analytical processing.
Open source and freeware tools such as Java, MySQL database, Apache Web server, C
Language Integrated Production System (CLIPS) Expert System shell were used in the
development process.
The Migraines / Headaches Application: We created the program, written in the
CLIPS language for expert systems, and studied the execution time depending on the number
of questions and migraine types. A Java extraction transformation loading (ETL) procedure
was used to transform the source text file into an XML file. It was then utilized to build the
XML representation of the original International Classification of Diseases, 9th Revision,
Clinical Modification (ICD-9-CM). The Migraines and Headaches Application Form
Revision 1.1.3 was developed and published on the Web. The Perl script simple-form.cgi
takes the input from a form, sends it to a specified email address, appends information to the
XML file and returns a confirmation page. An example of CLIPS-to-HTML connection
written in the C language was developed and published on the Web. An example of the
interaction between Java and CLIPS that utilizes Java Native Interface (JNI) is presented in
Appendix B.
The prototype application for classification should be web-enabled, and designed separately
for physicians and patients. These were identified as fundamental requirements. It was also
decided that users should be able to insert and retrieve information in a simple way. The
future integration of this application to another system, such as a medical errors database or
another expert system, was also identified in the requirements discovery phase.
3. Methodology
We designed and developed a prototype expert system to aid physicians in the diagnosis of a
migraine. The web-enabled XML files were created as a repository of International
Classification of Diseases, 9th Revision, Clinical Modification (ICD-9-CM). A fragment of
the ICD-9-CM for the disease category 346 (Migraine) classifications is available in
Appendix B, Figure B.2. The complete ICD-9-CM List of Three Digit Categories (Financial
Year 2004) is also available on the Web (http://acc4.its.brooklyn.cuny.edu/~gshagas/).
CLIPS is a productive development and delivery expert system tool that provides a
complete environment for the construction of rule and/or object-based expert systems [3]. We
started from a simple rules implementation in the CLIPS language (see Appendix B, Section
1(a)). However, the strategic goal is to create a self-learning program, based on an expert
system, which can collect and analyze all patient data.
The application is intended primarily for physicians, but patients could use a modified
version. This could be both an online and stand-alone application. Once the point of a "self-
learning program" is achieved, the online approach is better for new data collection and
updating rules. The program itself can dynamically generate the forms. The graphic user
interface (GUI) and presentation layer are written in HTML and JavaScript, while the
Application and data manipulation layers are written in Common Gateway Interface (CGI)
Perl script (see Appendix B, Figure B.1.) In our present implementation, data is collected in
the XML format as a file for future analysis and sent by e-mail (see Appendix B, Figures B.1,
B.3 and B.4).
Paper forms are not required, but this could be an option for people without access to
a computer. First, data should be validated and corrected, if necessary.
We identified a total of 23 questions (see Appendix B) for the Migraines form. We
dealt with a total of 20 types of migraines, identified by ICD-9-CM classification. The
answers from six patients, diagnosed with migraines, were obtained by interviewing. The
data was entered directly using an existing CLIPS interface (see Appendix B).
4. Findings
The Migraines Applications latest form, revision 1.1.5, is available in Appendix B (Figures
B.2, B.3). The Perl script simple-form.cgi takes the input from a form, formats it and sends it
to a specified email address, appending information to the XML file and returning a
confirmation page.
We would expect to deal with a total of 20 types of migraines, identified by ICD-9-
CM classification. Part of our research was performed on a subset of questions and types of
migraines. These simplifications are necessary to create a prototype of the expert system for
migraines, test the rules and performance, and extend it later. We also introduced additional
complexity into the CLIPS rules to increase accuracy of migraine diagnosis. By increasing
the number of questions to 50 (expected in the future) we can further check the performance
of a web-based application.
We selected only 10 of these questions for our research, and created the appropriate
program. From the 20 known types of migraines we randomly selected 14 types. The rules
we created are based on existing criteria [1, 2]; however, we introduced additional artificial
dependencies for the purpose of testing system performance. The certainty of each diagnosis
is calculated by three parameters; these parameters are chosen by the program according to
certain rules related to the answers given (see Appendix B, Section 1(a)).
Some of the questions could be omitted according to the rules. The questions and the
patients’ answers are presented in Table 1. For example, question 3 will appear only if the
answers to question 1 “Age (in years)?” is “0-29” and to question 2 “Your gender?” is
“female.” Question 3 “Does your headache occur during menstruation, ovulation, menopause
or oral contraceptives?” is relevant for certain age and gender only. In the same way, question
8 “Does nausea accompany your headache?” will not be asked if the answer to Question 7
“Does vomiting accompany your headache?” is “yes.” According to the IHCC rules, the
presence of “either vomiting or nausea,” which may accompany headache, is essential for
diagnosis [4]. That is to say, if the answer to Question 7 is “yes” (there is vomiting) then
there’s no need to ask question 8 “Does nausea accompany your headache?” These rules are
not comprehensive, but comprise a minimal set with which we hope will illustrate the
prototype’s functionality. For example, question 6 “Pain interferes significantly with school
activity” is unlikely to be answered “yes” by patient number 4, who is at least 70 years old.
The user’s dialog with the CLIPS application is presented in Appendix B, Section 3. Here we
presented only ten questions, and we are currently working on the comprehensive program
containing the set of all available questions and rules. For example, the question “Does your
headache BEGIN on left side?” does not appear.
Another example of this is patient number 1, who is diagnosed with three types of
migraines (see Table 2). The certainty of Horton's neuralgia is highest (88%), and for the
atypical migraine is lowest (40%). Missing values for the other 11 types of migraines indicate
that the certainty of such types is negligible. We narrowed 14 * 6 = 84 possible diagnoses for
six patients down to 3+11+8+13+7+4 = 48 possible diagnoses, for a reduction of (84-48) / 84
= 43%.
The results from the CLIPS system are presented below:
Another aspect of our research was related to the performance of the application.
We identified 23 questions necessary to build the expert system. We expect to improve the
precision of the system by adding finer questions, leading to a total for about 50. We also
analyzed the execution time as a function of the number of additional questions and migraine
types. Additional complexity was added to the CLIPS rules, by increasing the number of
questions to 25 (close to the current number 23) and 50 (the expected number in the future).
The number of migraine types also varied from 5 (the most common migraine cases) to 20
(the comprehensive migraine classification). These questions and rules were randomly
chosen from existing ones and were included in the artificial rules file. We learned that the
execution time depends on the number of Migraine types embedded into the expert system,
and ranges from 3 to 17 seconds (see Figure 1).
30
25
20
Time, sec
25 questions
15
50 questions
10
0
0 5 10 15 20
Number of migraine types
We designed and developed a prototype expert system to aid physicians in the diagnosis of a
migraine. Our research in the area shows that the data can be analyzed using Perl, C, or Java
methods and procedures. However, once rules become complicated, an Expert System Shell
should be considered.
Physician could select multiple symptoms and then narrow down by 50 % (see Table
4.4) the possible diagnoses made by the expert system according to the symptoms selected.
This procedure required 1 minute to enter the data and execute. We estimate, that such
improvements in efficiency could save (a) 5 minutes for the doctor, (b) more than 5 minutes
for the patient, and (c) reduce time spent on physical exam and laboratory tests. The
execution time could be decreased by using other expert shells, such as Gensym
Corporation's G2 expert system, GENESYS, EXSYS, XpertRule from Attar Software
Limited, Fair Isaac Blaze Decision System etc.
The German Migraine and Headache Society (DMKG) estimated, that a headache
could be caused by more than 110 diseases [5]. This fact indicates the inherent complexity of
the comprehensive Migraines / Headaches Application.
5. Summary
We created a program, written in the CLIPS language for expert systems, to distinguish
migraines from headaches. We have identified 23 essential questions that are necessary for
building an expert system that distinguishes migraines from headaches. The execution time
depends on the number of migraine types embedded in the expert system. The time varies
from 3 seconds for the five most common migraine cases to 17 seconds for the entire set of
20 types of migraine according to the ICD-9-CM classification. We also created an XML
representation of the International Classification of Diseases, 9th Revision Clinical
Modification (ICD-9-CM), including disease category 346 (Migraines), and published it on
the Web.
References
[1] Olesen, J. Classification and diagnostic criteria for headache disorders, cranial
neuralgia, and facial pain. Cephalalgia Headache Classification Committee of the
International Headache Society. (1988); 8 (suppl 7):1-96.
Available: http://www.i-h-s.org.
[2] Troost, T. M.D. Migraine and other Headaches, Wake Forest University School of
Medicine (2002). Available: http://imigraine.net/migraine/intro.html
[3] GHG Internet Services, CLIPS, A Tool for Building Expert Systems, Available:
http://www.ghg.net/clips/CLIPS.html [June 2003].
[4] International Headache Classification Committee (IHCC). ICD-10 guide for headaches.
International Headache Classification Committee. Cephalalgia 1997; 17(suppl 19): 1-82 .
]5] Deutsche Migräne- und Kopfschmerz-Gesellschaft e.V. / DMKG. ICD 10 Liste aller
klassifizierten Kopfschmerzsyndrome. (February 2002). Available:
http://www.dmkg.de/fortbild/icd.htm.
Appendices
Note 1. Most of the questions are based on the identification of headache syndromes in accordance with the
International Headache Society (HIS) or the World Health Organization's International Classification of
Diseases (ICD-10).
Note 2. School would apply to an adolescent or young adult in graduate school.
Section 3. Patients’ interaction with CLIPS system
"Age (in years)?” (0-29 30-49 50-69 70-up)) /* valid answers, see Figure B.5 */
Age (in years)? 0-29
Does your headache occur during menstruation, ovulation, menopause or oral contraceptives?
(yes no)
Does your headache occur during menstruation, ovulation, menopause or oral contraceptives?
yes
How does your headache feel? (throbbing dull aching other unknown)
How does your headache feel? dull
The number of headaches per month? (0-2 3-5 6-9 10-19 20-up)
The number of headaches per month? 0-2
Can your headache be triggered by certain foods, odors, stress or weather changes? (yes no)
Can your headache be triggered by certain foods, odors, stress or weather changes? yes
Patient # 2:
Age (in years)? 30-49
Gender? male
Does your headache BEGIN on right side? yes
How does your headache feel? aching
Does pain interfere significantly with school activity? no
Does vomiting accompany your headache? yes
The number of headaches per month? 6-9
Can your headache be triggered by certain foods, odors, stress or weather changes? no
Patient # 3:
Age (in years)? 50-69
Gender? female
Does your headache BEGIN on right side? no
How does your headache feel? throbbing
Does pain interfere significantly with school activity? no
Does vomiting accompany your headache? no
Does nausea accompany your headache? no
The number of headaches per month? 10-19
Can your headache be triggered by certain foods, odors, stress or weather changes? yes
Patient # 4:
Age (in years)? 70-up
Gender? male
Does your headache BEGIN on right side? yes
How does your headache feel? unknown
Does pain interfere significantly with school activity? no
Does vomiting accompany your headache? yes
The number of headaches per month? 0-2
Can your headache be triggered by certain foods, odors, stress or weather changes? no
Patient # 5:
Age (in years)? 0-29
Gender? male
Does your headache BEGIN on right side? no
How does your headache feel? aching
Does pain interfere significantly with school activity? no
Does vomiting accompany your headache? yes
The number of headaches per month? 3-5
Can your headache be triggered by certain foods, odors, stress or weather changes? no
Patient # 6:
Age (in years)? 50-69
Gender? female
Does your headache BEGIN on right side? no
How does your headache feel? dull
Does pain interfere significantly with school activity? no
Does vomiting accompany your headache? no
Does nausea accompany your headache? no
The number of headaches per month? 6-9
Can your headache be triggered by certain foods, odors, stress or weather changes? yes