Riss et al, Expert systems 283 J. Perinat. Med. 16 (1988) 283 Development and application of simple expert systems in obstetrics and gynecology Paul A. Riss, Heinz Koelbl, Alexander Reinthaller, and Josef Deutinger 2nd Department of Obstetrics and Gynecology, University Hospital, A-1090 Vienna, Austria 1 Introduction In recent years the accepted roles of computers have expanded from the traditional ones of data retrieval, storage and processing into the area of what is often called "artificial intelligence"; that is into areas which would have been called "intelli- gent" if they had been performed by man. Any field of medicine, in which the number of answers to a particular question is limited — e.g. the number of possible diagnoses — and in which it is possible to contruct a line of reasoning is well suited for computers using intelligent programs [4]. We have developed simple rule-based expert sys- tems for 2 clearly defined applications in obstetrics and gynecology: cycle stimulation and assessment of urinary incontinence. In the present paper we describe the development and clinical application of these 2 expert systems, and discuss the advan- tages and limitations of computer, in assisting medical decision making. 2 Hardware and software We used an IBM-PC with 2 disk drives and 256k RAM. The expert system was developed using the expert system shell EXSYS (Exsys Inc, Albuquer- que, New Mexico, U. S. A.), a rule based system consisting of an editor to develop and edit the knowledge base (the rules), and a RUNTIME program to run the expert system. The expert has to define and write the rules. The structure of the rules is in the form of "IF...THEN..." (table I), in which "THEN" is Curriculum vitae PAUL A. RISS was born in Vienna, Austria, in 1948. He studied medicine in Vienna and Lausanne, and began his residency in ob- stretrics and gynecology at the University Hospital of Vienna in 1977. In addition to clinical work, he did re- search on questions related to beta-endorphin, and be- came assistant professor in 1985. Since 1982 he has been involved with hospital in- formation systems, artificial intelligence and decision ana- lysis. His other area of interest is that of gynecological urology. either one of the solutions, or a statement which is used in a subsequent rule. All possible solutions — called "choices" — have to be defined at the outset and must be found in the "THEN" part of at least on rule. The expert can assign probabilities to the different rules. Notes and references can be added to every rule to provide additional infor- mation concerning each rule and to explain how the expert arrived at the solution (table I). When in use, the system asks specific questions of the user and they are answered either by giving one of a group of several responses (multiple choice form) or by entering numeric data. After having prompted the user for the required infor- mation the system uses backward chaining to cal- culate the most likely solutions, which are then displayed in decreasing order of probability. 1988 by Walter de Gruyter & Co. Berlin · New York 284 Riss et al, Expert systems Table I. Example of rule for cycle day 9 to 12 suggesting continued cycle stimulation Rule number: 12 IF: and and and and THEN: [CD] > 8 [CD] < 13 [E2] < 1000 [DIFFE2] > = 0 [DIFFP] < = 50 CONTINUE STIMULATION - Probability = 10/10 Reference: Rule for continuation of cycle stimulation from cycle day 9-12 if E2 is still below 1000 and in the absence of luteinization 3 Development of a rule-base expert system In building an expert system — and in particular a rule based expert system — one has to follow certain steps [1]. After defining the application the first step consists in identifying the possible out- comes (choices, solutions, diagnoses, suggested ac- tions, etc). The next step is the selection of the variables which will be used in the expert system: the variables should be easily and consistently available, reliable, and actually used in clinical work. Then the rules have to be written, before the expert system can be tested and modified. A very important point, which will not be addressed in the present paper, is the maintenance and reg- ular updating of the expert system (table II). Before starting with an expert system, however, one has to decide which strategy to adopt. In the present paper we describe two possible approaches — statistical and heuristic — in the construction of rule based expert systems for limited applica- tions in clinical medicine. 4 Expert system for cycle stimulation In the first application we developed an expert system for stimulation of the menstrual cycle in our in vitro fertilization program. The menstrual cycle was stimulated with clomiphene and human menopausal gonadotropin (HMG), and ovulation was induced with human chorionic gonadotropin (HCG). Beginning on cycle day 8 the patient is Table Π. Steps in the development of an expert system 1. Definition of the problem and of possible solutions 2. Selection of the variables to be used 3. Development of the rules 4. Preliminary testing and modification of the rules 5. Evaluation of the expert system (Prospective testing) [6. Maintenance and updating] monitored by daily serum hormone level deter- minations and ultrasound examinations [5], Seven variables were used for the expert system, the end point was one of 3 possible lines of action: 1) continue stimulation, 2) induce ovulation, and 3) cancel the treatment cycle. These solutions are mutually exclusive, we did not add probabilities (or certainty factors) to the solutions. We now wrote a total of 27 rules, trying to cover every possibility applying to the cycle days 8 to 14. The rules as well as the order in which the rules were placed in the knowledge base, i. e. the expert system, were decided by the developers and based entirely on experience and intuition. After preliminiary testing and modification of the rules we tested the expert system on 62 consecutive patients of our in vitro fertilization program (244 cycle days). The misclassification rate was 5% for continuation of stimulation and 10% for induc- tion of ovulation. 5 Expert system for diagnosis of female urinary incontinence Urodynamic examination is done preoperatively to make a differential diagnosis of urinary incon- tinence in incontinent women. All urodynamic investigations performed in our department in the' years 1984 and 1985 were used for the develop- ment of the expert system. The only conditions needing to be satisfied were that the patient com- plained of involuntary loss of urine and that the urodynamic examination was complete (N = 465). The prevalence of the 5 possible di- agnoses was as follows: stress incontinence 50.5%, motor urge incontinence 1.7%, sensory urge 2.6%, mixed incontinence 18.3%, and no incontinence demonstrable 26.9%. The variables obtained at urodynamic examination were used for the con- struction of the expert system. J. Perinat. Med. 16 (1988) Riss et al, Expert systems 285 In contrast to the first application we used a twofold approach for the development of the ex- pert system for the diagnosis of incontinence [6]: firstly, we calculated the predictive value of each vailable variable for each of the five urodynamic diagnoses. For every diagnosis we selected the 4 variables with the highest predictive values and designed a tree diagram, using the variables in the order of their predictive values [7, 9]. This process of building an empirical tree diagram by repeti- tively splitting the patient population into smaller and smaller categories is called "recursive parti- tioning analysis" [3]. For each diagnosis we thus obtained several sub- sets of patients, and for each subset we calculated the predictive values of the combination of uro- dynamic variables characterizing the subset. We used the combinations of variables for each subset to develop of rule (IF... AND... AND... THEN DIAGNOSIS X PROBABILITY Y) and assigned to the diagnosis the probability calculated as the predictive value for the given subset. We then developed a number of rules to either exclude or establish a diagnosis on the basis of our experience. Finally, after preliminary testing of the expert system we either modified some rules or the assigned probability. The expert system consists of 44 rules. Table III shows the result of prospective testing of the expert system on 54 consecutive patients complaining of incontinence. 6 Comment Expert systems have become very popular, ranging from simple programs consisting of a few rules to large systems requiring years of development. We present 2 simple applicatins which we were able to develop in the course of a few weeks, using commercial software and a standard personal computer. However, we feel that the development of an ex- pert system is a major intellectual task: the prob- lems have to be clearly defined, variables must be available and reliable, and the right approach to the development of the knowledge base has to be chosen. While in theory this seems simple, in prac- tice it can be very time-consuming and difficult to dissect medical knowledge and experience into the small pieces required for the knowledge base. The statistical approach described here offers the advantage of yielding probabilities for the differ- ent solutions, and these probabilities can be com- bined. On the other hand, the major drawback of the purely statistical approach is that every com- bination of variables not only has to be found in the study group but has to exist with sufficient prevalence in order to permit the calculation of meaningful predictive values [8]. The purely heuristic approach — as used in the expert system for cycle stimulation — does not permit the assignment of calculated probabilities. In addition, it is almost impossible for an expert to think of all possibilities and to cover every aspect of a solution. Both expert systems presented here are in actual use in our department. In summary, we can draw several conclusions with regard to the develop- ment and the use of expert systems: It is very difficult to cover every aspect of a prob- lem with an expert system. While the statistical approach chosen in the second application assigns certainty factors to every combination of variables seen in the last 2 years, the heuristic approach to cycle stimulation can only be refined through con- tinued testing; even then the developer can never be sure that he has thought of all possibilities. We doubt that an expert system for diagnosis or treatment can be better than a human expert [2]. An expert system might give a more complete list of solutions, or might suggest solutions the phy- sician may not have thought of, or might do Table ΙΠ. Results of prospective testing of the expert system for assessment of urinary incontinence on 54 patients (PV = predictive value) Sensitivity Specificity PVpos PVneg Genuine stress incontinence Motor urge incontinence Mixed incontinence No incontinence demonstrable 96.7 50.0 50.0 100.0 91.7 100.0 95.5 97.6 93.6 100.0 71.4 92.9 95.7 98.1 89.4 100.0 J. Perinat. Med. 16 (1988) 286 Riss et al, Expert systems calculations which are difficult or time consuming to do by hand. However, the essential aspect of an expert is his (or her) ability to learn from experience and to evaluate a situation on the basis of a year long and constantly updated experience. In contrast, most expert systems — and certainly simple rule-based systems — are not able to learn. On the other hand, expert system are very valuable in teaching situations: the different steps in the development of a diagnosis can be clearly shown and explained. Last not least, expert systems can be very helpful when a "true" expert is not readily available. Abstract Expert systems have become increasingly popular in medicine for the support of medical decisions, e. g. di- agnosis or treatment. We describe the development and application of 2 simple rule-based expert systems, one used for cycle stimulation in our in vitro fertilization program and the other for preoperative assessment of urinary incontinence. The programs were written using a commercially available expert system shell, are run on a standard personal computer, and are in actual use in our department. Though it is doubtful that simple expert systems can be superior to a human expert we feel that expert systems are very useful in the standardization of protocols and are a valuable teaching instrument. Keywords: Artificial intelligence, cycle stimulation, expert system, urinary incontinence. Zusammenfassung Entwicklung und Anwendung yon einfachen Expertensy- stemen in der Gynäkologie und Geburtshilfe Wir beschreiben die einzelnen Schritte in der Konstruk- tion von 2 einfachen Expertensystemen: Definition des Problems, Identifizierung der möglichen Endpunkte (Diagnosen, Therapien, Handlungsstrategien, etc), Aus- wahl der zu verwendenden Variablen, Schreiben der Re- geln, Testen und Modifizieren des Expertensystems. Die Programme wurden mittels des Expertensystem-Umge- bung EXSYS geschrieben und laufen auf Personal Com- putern. Als erste Anwendung entwickelten wir ein Expertensy- stem für die Stimulierung des Menstruationszyklus mit- tels clompiphen und humanem menopausalen Goando- tropinen (HMG) für unser in vitro Fertilisierungs (IVF) Programm. 7 Variable wurden für das Expertensystem verwendet, die Endpunkte waren 3 mögliche Handlungs- stragegien: 1) Stimulation weiterführen, 2) Ovulation induzieren, und 3) Behandlungszyklus abbrechen. Wir schrieben insgesamt 27 Regeln, basierend auf Erfahrung und Intuition. Wir testeten das Expertensystem an 62 aufeinanderfolgenden Patientinnen unseres IVF-Pro- gramms (244 Behandlungstage). Die Rate an falschen Klassifizierungen durch das Expertensystem betrug 5% bei der Diagnose: Stimulation weiterführen und 10% in Bezug auf Auslösung der Ovulation. Im Gegensatz zur ersten Anwendung benutzten wir bei der Entwicklung des zweiten Expertensystems zur Un- terstützung der Diagnose der weiblichen Harninkonti- nenz durch die urodynamische Untersuchung eine zwei- fache Strategie: zunächst berechneten wir den Vorher- sagewert in Bezug auf 5 mögliche urodynamische Dia- gnosen für verschiedene Untergruppen von Patientin- nen. Wir verwendeten diese Vorhersagewerte bei der Entwicklung der Regeln für das Expertensystem, indem wir die Vorhersagewerte den einzelnen Diagnosen als Wahrscheinlichkeiten zuordneten. Dann schrieben wir aufgrund unserer Erfahrung zusätzlich einige Regeln zur definitiven Bestätigung einzelner Diagnosen. Das Ex- pertensystem besteht aus 44 Regeln und wurde an 54 Patientinnen getestet. Die Vorhersagewerte des Exper- tensystems lagen zwischen 70 und 100%. Zusammenfassend konnten wir die Möglichkeit der Konstruktion von einfachen Expertensystemen mit einer Kombination von statistischen und heuristischen Ver- fahren zeigen. Obwohl wir bezweifeln, daß einfache Ex- pertensysteme besser als menschliche Experten sein kön- nen sehen wir den Nutzen von Expertensystemen unter anderem in der Standardisierung von Protokollen und im Einsatz im Unterricht. Schlüsselwörter: Expertensystem, Harninkontinenz, künstliche Intelligenz (KI), Zyklusstimulation. J. Perinat. Med. 16 (1988) Riss et al, Expert systems 287 Resume Developpement et application de systemes experts simples en obstetrique et gynecologic Nous decrivons les etapes du developpement de systemes experts a regies simples: definition de Fapplication, iden- tification des points terminaux possibles (diagnostics, evolutions, choix), selection de variables, ecritures des regies, test et modification du Systeme expert. Les pro- grammes ont etc rediges ä l'aide d'un Systeme expert du commerce (EXSYS) et utilises sur un ordinateur person- nel standard. Comme premiere application nous avons mis au point un Systeme expert pour l'induction du cycle menstruel par clomiphene et gonadodrophines humaines en pro- venance de femmes menopausees (HMG) dans notre programme de fecondation in vitro (FIV). On a utilise 7 variables pour le Systeme expert, le point terminal etait Tune des 3 actions possibles: 1) poursuite de la stimu- lation, 2) induction de Fovulation, et 3) abandon du cycle de traitement. Au total, nous avons redige 27 regies fondees sur Fexperience et l'intuition du realisateur. Nous avons teste le Systeme expert chez 62 patientes consecutives de FIV (244 jours de cycle). Le pourcentage d'erreur de classification a etc de 5% pour la poursuite de la stimulation et de 10% pour Tinduction de Fovu- lation. Nous avons utilise une approche double pour le deve- loppement d'un Systeme expert pour le diagnostic d'in- continence urinaire feminine par exploration urodyna- mique, ce qui contraste avec la premiere application: dans un premier temps nous avons calcule les valeurs predictives de 5 diagnostics urodynamiques possibles pour differents groupes de patientes. Ensuite nous avons utilise les valeurs predictives pour mettre en ceuvre les regies et nous avons attribue au dignostic la probabilite calculee comme valeur predictive pour le groupe donne. Nous avons ensuite developpe un certain nombre de regies soit pour exclure soit pour etablir un diagnostic sur la base de notre experience. Le Systeme expert comporte 44 regies et a ete teste chez 54 patientes conse- cutives. Les valeurs predictives positives vont de 70 a 100%. En resume, nous avons demontre la faisabilite du de- veloppement de systemes experts simples par la combi- naison de principes heuristiques et statistiques. Bien que puisse douter que des systemes experts simples puissent etre superieurs ä un expert humain, nous res- sentons que les systemes experts sont tres utiles pour la standardisation de protocoles et qu'ils representent un instrument d'enseignement de valeur. Mots-cles: Incontinence urinaire, intelligence artificielle, stimulation de cycle, Systeme expert. References [1] ADLASSNIG KP, G KOLARZ, W SCHEITHAUER, H EFFENBERGER, G GRABNER: CADIAG: Approaches to computer-assisted medical diagnosis. Comp Biol Med 15 (1985) 315 [2] CHARD T: Human versus machine: a comparison of a computer "expert system" with human experts in the diagnosis of vaginal discharge. Int J Biomed Comp 20 (1987) 71 [3] FRIEDMAN JH: A recursive partitioning decision rule for nonparametric classification. IEEE Trans Corn- put 16 (1977) 404 [4] REGGIA JA, S THURIM: An introduction to com- puter-assisted medical decision making II. MD- Computing 2 (1985) 40 [5] REINTHALLER A, P RISS, J DEUTINGER, E MUELLER- TYL: Factors influencing successful in vitro fertil- ization and embryo transfer: a matched pair study. Fertil Steril 46 (1986) 511 [6] RISS P, H KOELBL: Strategien zur Entwicklung eines Expertensystems am Beispiel der urodynamischen Untersuchung. In: RAPPELSBERGER P, P PFUNDNER, G GELL: Medizin-Technik Medizinische Informatik '86, pp 351. R. Oldenbourg, Wien-München 1986 [7] RISS P, H KOELBL: The predictive values of single and combined urodynamic parameters. Acta obstet gynecol scand (in print) [8] STEMPEL LE: Eenie, meenie, minie, mo ... What do the data really show? Am J Obstet Gynecol 144 (1982) 745 [9] WASSON JH, HC Sox, RK NEFF, L GOLDMAN: Clin- ical prediction rules. Applications and methodolog- ical standards. N Engl J Med 313 (1985) 793 Dr. Paul A. Riss 2. Univ. Frauenklinik Spitalgasse 23 A-1090 Vienna, Austria J. Perinat. Med. 16 (1988)