Sie sind auf Seite 1von 13

Development of an Expert System for

Distinguishing Headaches from Migraines


By D. KOPEC*, G. SHAGAS*, J. SELMAN**, D. REINHARTH**, S. TAMANG*

* Department of Computer and Information Science, Brooklyn College


** MD, Professor of Medicine, Albert Einstein School of Medicine, Bronx, New York.

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

1.1 Purpose of the Study


We design and develop a prototype expert system to aid physicians in the diagnosis of
migraine headaches. We have included the essential questions and rules that are necessary for
building an expert system for distinguishing migraines from other types of headaches. The
knowledge acquisition process was facilitated by a physician who served as our domain
expert to identify the application’s key elements. This application utilizes a data collection
form, the C Language Integrated Production System (CLIPS), and a program with the
appropriate rules, which are written in the CLIPS language. The front end and middle tier is
built, and the connection between the HTML front end and the expert system shell CLIPS is
established. We also create an XML representation of the International Classification of
Diseases, 9th Revision Clinical Modification (ICD-9-CM), including the disease category
346 (Migraine), and publish it on the Web.
In addition, we make recommendations for a specific configuration based upon the
prototype’s capabilities and performance, summarize our findings, and identify opportunities
for future work.

1.2 Background and Significance/Justification

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.

2. Requirements Analysis and System Design

2.1 Introduction and Preliminary Investigation Phase

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.

2.2 Software Requirements Analysis Phase

An expert system can be considered as an environment for the construction of the


application’s middle tier and back end. The system should be able to handle a wide variety of
knowledge, preferably, with support for different programming paradigms: rule-based,
object-oriented and procedural. Rule-based programming allows knowledge to be represented
as heuristics, which specify a set of actions to be performed for a given situation. Object-
oriented programming allows complex systems to be modeled as modular components, which
can be easily reused later. The procedural programming capabilities are similar to capabilities
found in languages such as C.
An Expert System Shell should include a number of features to support the
verification and validation of expert systems, including support for modular design and
partitioning of a knowledge base, static and dynamic constraint checking of slot values and
function arguments, and semantic analysis of rule patterns to determine if inconsistencies
could prevent a rule from firing or generate an error. The application should have an option to
be embedded within procedural code, called as a subroutine, and integrated with languages
such as C or Java.
The software should provide an interactive, text oriented development environment,
including debugging aids, on-line help, and an integrated editor. The tool should provide a
short response time even for robust pattern matching capabilities.
We prefer the software to be portable, i.e., having the ability to be installed on many
different operating systems without code changes. Low maintenance cost, availability of
training classes and companies providing consulting services, should also be considered for
the long-term project.

2.3 Decision Analysis Phase

We decided to create an application to distinguish between migraines and other headaches


using more sophisticated rules. These rules were represented in the CLIPS expert system
shell. CLIPS is a product development and delivery expert system tool which provides a
complete environment for the construction of rule and/or object based expert systems [3].

3. Methodology

3.1 Migraines / Headaches Application

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

4.1 Results: The Migraines / Headaches Application

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.

Table 1 Migraine Expert System Questions and Answers (cases 1… 6)


Answers for case
# Question #1 #2 #3 #4 #5 #6
1 Age (in years)? 0-29 30-49 50-69 70-up 0-29 50-69
2 Gender? female male female male male female
3 Does your headache occur during
menstruation, ovulation, menopause or yes - - - - -
oral contraceptives?
4 Does your headache BEGIN on right
yes yes no yes no no
side?
5 How does your headache feel? dull aching throbbing unknown aching dull
6 Does pain interfere significantly with
yes no no no no no
school activity*
7 Does vomiting accompany the
no yes no yes yes no
headache?
8 Does nausea accompany the headache? yes - no - - no
9 The number of headaches per month? 0-2 6-9 10-19 0-2 3-5 6-9
10 Can your headache be triggered by
certain foods, odors, stress or weather yes no yes no no yes
changes?
*Note: School would apply to an adolescent or young adult in graduate school.

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:

Table 2 Certainty of a Specific Diagnosis for Various Cases


# ICD-9 Code Migraine description Certainty for each Case Number (%)
#1 #2 #3 #4 #5 #6
1 346.0.1 Migraine preceded by ... - 40 92 36 - 40
2 346.0.2 Migraine with aura - - - 20 20 -
3 346.1.1 Atypical migraine 40 - - 20 20 -
4 346.1.2 Sick Headache - 36 36 59 20 -
5 346.2.1 Cluster headache 64 20 - 36 - -
6 346.2.2 Histamine cephardia - 36 36 59 - 40
7 346.2.3 Horton's neuralgia 88 20 20 20 - 80
8 346.2.4.1 Migraine abdominal - 20 - 36 - -
9 346.2.4.2 Migraine basilar - 76 - 76 76 -
10 346.2.4.3 Migraine lower half - 40 40 68 40 -
11 346.2.4.4 Migraine retinal - 40 - 68 40 -
12 346.2.5 Neuralgia - 40 40 20 - -
13 346.2.8.1 Migraine hemiplegics - - 97 - - 80
14 346.9 Migraine, unspecified - 40 40 68 40 -

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

Figure 1 Time of CLIPS procedure

We could evaluate the benefits of the Migraine application by the following


estimation. Let’s consider that the typical physician can perform one patient assessment over
30 minutes. A physician could select multiple symptoms and then reduce by 43 % (see Table
2) the possible number of diagnoses generated by the expert system according to the
symptoms selected. This procedure would require about 1 minute entering the data and
executing the expert system. We estimate that such procedure could save (a) 5 minutes for the
doctor, (b) more than 5 minutes for the patient, and (c) reduce the time spent on physical
exam and laboratory tests. We can then estimate that such procedures, given today’s medical
cost and given the liklihood that this approach can help to reduce medical errors, the savings,
when cumulated over time and millions of patients, could be enormous.

4.2 Discussion and Recommendations: The Migraines / Headaches Application

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

Appendix B. Migraines and Headaches Application.

Section 1. Migraine Application Schema and GUI


Figure B.1. The Migraine / Headaches Application Schema

Figure B.2. International Classification of Diseases (ICD-9-CM) (Fragment)


Figure B.3. Migraine Application HTML Form (Fragment – upper part)
Figure B.4. Migraine Application HTML Form (Fragment – lower part)

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

Figure B.5. User’s dialog with CLIPS application (fragment)


The answers from six patients, diagnosed with migraine, were obtained by interviewing. The
data was entered directly using an existing CLIPS interface. Patients’ potential diagnoses are
presented in Chapter 4.1.2, Table 4.4.

Patient # 1 dialog 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

Gender? (male female)


Gender? female

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

Does your headache BEGIN on right side? (yes no)


Does your headache BEGIN on right side? yes

How does your headache feel? (throbbing dull aching other unknown)
How does your headache feel? dull

Does pain interfere significantly with school activity? (yes no)


Does pain interfere significantly with school activity? yes

Does vomiting accompany your headache? (yes no)


Does vomiting accompany your headache? no

Does nausea accompany your headache? (yes no)


Does nausea accompany your headache? yes

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

Das könnte Ihnen auch gefallen