nil02.tif A Simple Expert System Shell for Microcomputer-Aided Radiographic Diagnosis M o r g a n G. D u n n e a n d S e a n B. D u n n e A simple microcomputer-basod e x p e r t system shell for radiographic diagnosis is described. T h e system interrogates t h e user by means o f a simple question- a n d - a n s w e r approach on t h e radiographic f i n d i n g s in a given case and proffers a differential diagnosis f r o m a database. T h e system a l s o a l l o w s l i s t i n g o f both t h e radiographic findings p e r t i n e n t t o a specific diagnosis and all diagnoses in w h i c h a particular f i n d i n g of combination of findings occur. T h e system database can be easily updated or modified by t h e user. T h e demonstration application for t h e e x p e r t system shell is t h e plain film diagnosis of osseous dysplasia. �9 1990 by W.B. Saunders Company. KEY W O R D S : computers, software, e x p e r t systems, radiology, artificial intelligence, osseous dysplasia, b o n o diseases. T H E USE O F personal computers (PC) and expert systems as an aid in radiographic diagnosis is being reported with increasing frequency.l-4 Many of these systems are complex, memory-expensive, and require mainframe or minicomputer power. The system described here was developed to acquire an introductory level understanding of expert system programming on a microcomputer (PC) and apply such program- ming to a specific problem in diagnostic radiol- ogy. Differential diagnosis of the osseous dysplasias remains a problem for the general radiologist, as many of these conditions are rare and the diagnos- tic criteria are both numerous and nonspecific. It was felt that the interpretation of radiographs on these patients would be facilitated by the applica- tion of a simple user-friendly expert system running on a typical microcomputer (PC), which would pose a series of questions regarding spe- cific radiographic findings to be answered by using only three k e y s - - " y " for "yes," "n" for "no," or "d" for "don't know." From the Department of Radiology, Baptist Memorial Hospital System, San Antonio, TX. Address reprint requests to Morgan G. Dunne, MA, MB, BCh, BAO, 15301 Winter Mist, San Antonio, TX 78247. �9 1990 by W.B. Saunders Company. 0897-1889/90/0301-0004503.00/0 PROGRAMMING LANGUAGE The programming language selected for the system development was T U R B O P R O L O G version 1.1 (Borland International, Scotts Val- ley, CA), which is a compiler-based implementa- tion of PROLOG, a fifth-generation artificial intelligence language ideally suited to expert system and database design. 5'6 The programming environment offered by T U R B O P R O L O G is quite easy to use with a word-processing style text editor, and provides extensive debugging aids that quickly locate and display errors in the source cede for correction. Once compiled, the program runs at interactive speeds on an IBM PC-XT (IBM Corporation, Boca Raton, FL) even during extensive database analysis, in con- trast to other relational database programs. The P R O L O G language is a declarative rather than procedural language, meaning that it attempts to solve a problem by deductive reasoning given a set of facts and rules. Thus, the programmer has only to provide a description of the problem and general set of rules for solving it and the PRO- LOG system will do the rest. E X P E R T S Y S T E M The expert system consists of two parts, the knowledge base (KB) and the inferenee origine (IE). 7'8 The KB is a database that holds a list of objects (eg, osseous dysplasia diagnoses) and their associated rules (lists of incompatible radio- graphie findings) and attributes (radiographic findings pertaining to a particular diagnosis). The KB may reside on a disk and be accessed as needed by the program, or it may be incorporated into the program cede as was done in this case to allow the program to run faster without the need for pauses while the disk is read. The KB predicates and clauses c o n t a i n a descriptor that indicates to which application they belong ( " O D " in this case for osseous dysplasia). Thus, the IE is designed to operate with other user-selected data- bases, which may be either maintained on a disk or embedded within the program. 8 Each radio- graphie finding clause in the KB is numbered and the diagnosis clauses contain a list of integers designating the associated radiographie findings. 10 JournalofDigitallmaging, Vol 3, No 1 (February), 1990: pp 10-14 COMPUTER-AIDED RADIOGRAPHIC DIAGNOSIS 1 1 The data on the t 06 diagnoses of osseous dyspla- sia for the demonstration KB were obtained from standard s o u r c e s . 9 q 2 The l E is the part of the program that at- tempts to find a matching diagnosis given the radiographic findings which are determined to be present or absent based on the user's responses to the questions generated by the system. The l E used in this application is deterministic. 7 This means that it will only proffer a diagnosis if the radiographic findings associated with that diagno- sis are either confirmed by the user or the user indicates that he or she does not know whether or not some or all of the findings associated with that diagnosis are present. The l E in this system uses the backward-chaining or object-driven method. 7'8 In this method, the program assumes a hypothesis which ir attempts to prove by taking the first object (diagnosis) in the database and asking the user if each of the findings associated with that diagnosis are present. I f any of the findings are indicated by the user not to be present (signified by pressing the " n " key), then the IE will reject the diagnosis and move on to the next diagnosis and repeat the process. If a given finding is given a " d o n ' t know" answer by the user (signified by pressing the " d " key), then the IE assumes that finding is present and re- mains with the diagnosis in question and contin- ues to ask questions about the other findings associated with the diagnosis. The l E maintains two memory resident data- bases (MRDs) which keep track of the " y e s " and " n o " responses so that the user is not asked the same question twice. " D o n ' t know" answers are stored as " y e s " responses. Thus, when each diagnostic hypothesis is picked up by the IE, the associated radiographic findings are checked in turn against the M R D s to determine if a " y e s " or " n o " response has already been elicited for that finding. I f a given finding is found in the " n o " M R D , then the diagnostic hypothesis in question is rejected and the next diagnosis in the database is placed under consideration. If the finding is found in the " y e s " M R D , then the l E moves on to the next finding associated with that diagnosis and repeats the process. I f the finding is not found in either of the " y c s " or " n o " MRDs, then the user is questioned as to whether or not the finding is present. The IE contains three rule-based subroutines, each with an associated database written into the program which contains a specific subset of radiographic findings. The purpose of these sub- routines is to reduce the number of questions that the user must answer in order to obtain a complete differential diagnosis. The first of these deals with normalcy in a specific anatomic area. For example, if the user's response is " y e s " to the question "normal skull and facial bones?", then all radiographic findings relating to the skull and facial bones are appended to the " n o " M R D . Thus, if the skull and facial bones are normal in a given case, the user is not asked any further questions regarding this anatomic area. The second subroutine deals with specific interrelated and incompatible radiographic findings. For ex- ample, if the user confirms the presence of micrognathism, then the finding of prognathism is appended to the " n o " M R D . The third subrou- tine deals with opposite and incompatible radio- graphic findings. For example, if the user enters " n " to the question " h e m a n g i o m a t a present?", then the finding " h e m a n g i o m a t a absent" is ap- pended to the " y e s " MRD. USER INTERFACE The user interface consists of several menu- containing windows that are called to the screen according to keyboard input. The main menu (Table 1) consists of five choices, the first of which activates the interactive expert system and l E leading to a differential diagnosis based on a ',thorough interrogation of the user through a "diagnostic findings" window. Each question is displayed on the screen and the user enters " y , " " n , " or " d . " The user's response is displayed in full after each question (Table 2). Each time the lE establishes a diagnosis the screen switches to a "differential diagnosis" window and the diagno- Table 1. System Main Menu ODLOG.PRO: Osseous Dysplasia Logic-Based Expert System Welcome to ODLOG.PRO ! 1. Consult Expert System 2. List AII Diagnoses on Knowledge Base 3. List Findings for Specific Diagnosis 4. List Diagnoses with Specific Finding(s) 5. Exit Expert Systern Please enter your choice: 1-5 12 Tabla 2. Typical Dialogue With the Expert Syatem ODLOG.PRO: Osseous Dysplasia Expert System Consultation 8/8/89 14:5:17 normal skull and facial bones?: no normal spine?: no normal pelvis?: no normal humeri, scapulae and clavicles?: no normal radii and ulnae?: no normal hands, wrists and feet?: don't know normal femora and patellae?: no normal tibiae and fibulae?: no normal sternum?: don't know normal ribs?: no stippled epiphyses prior to four years of age?: no normal bone maturation?: yes generalized metaphyseal flaring?: no brachycephaly?: no sclerosis of skull?: no short skull base?: yes small facial bones?: yes intrinsically normal epiphyses?: yes short femora?: yes posterior scalloping of vertebral bodies?: yes short pedicles?: yes narrow interpedicular distance in lumbar region?: yes increased lumbar Iordosis Tn late childhood?: yes marked backward angulation of the sacrum?: yes lumbar kyphosis in infancy?: don't know short ribs in infnancy?: don't know generalized shortening of tubular bones?: yes flat acetabular roofs?: yes spur at medial edge of triradiate cartilage in pelvis?: yes tibia vara?: yes y ACHONDROPLASlA �87 hypertelorism?: no scaphocephaly?: no etc . . . . Data run complete, consultation terminated. sis or diagnoses are displayed. The user returns to the diagnostic findings window by pressing the spacebar and the interrogation resumes as the IE searches for additional diagnoses. The second choice from the main menu simply lists all the diagnoses contained in the database (106 at the time of this writing), one screenful at a time. The third menu choice allows the user to s e l e c t a specific diagnosis from a submenu and view all the radiographic findings associated with that diagnosis (Table 3). The fourth menu choice allows the user to select one or more radiographic findings from a submenu and have the system display all diagnoses on the database that are associated with those findings (Table 4). Thus, for example, the system could list all diagnoses DUNNE AND DUNNE Tabla 3. List of Findings for Specific Diagnosis ODLOG.PRO: Osseous Dysplasia Expert System Consultation 8/8/89 14:8:23 Metatropic Dwarfism Normal skull and facial bones Platyspondyly Dysplastic odontoid process Coronal cleft vertebra Isolated irregularity of vertebral endplates Scoliosis Flat acetabular roofs Sharp lateral beak on acetabular roofs in childhood Short ribs in infancy Delayed bone maturation Generalized shortening of tubular bones Generalized metaphyseal flaring Generalized irregular and fragmented epiphyses Wide femoral necks Data run complete, consultation terminated. associated with platyspondyly and generalized tubular bone shortening (Table 4). The fifth choice on the main menu exits the system. HARD COPY Printed hard copy can be obtained from any of the first four main menu choices. The system accomplishes this by opening a diskfile when one of the first four choices is selected. Everything that is displayed on the screen (except menus) is also written in this file and at the end of each consultation the user is offered the option of printing this file or simply returning to the main menu. An example of a printout of a typical dialogue with the expert system is shown in Table 2. At the end of each consultation the diskfile is Table 4. List of Diagnoses W i t h Specific Finding(s) ODLOG.PRO: Osseous Dysplasia Expert System Consultation 8/8/89 14:11:12 platyspondyly generalized shortening of tubular bones SPONDYLOMETAPHYSEAL DYSPLASlS--TYPE KOZLOWSKI/SUTCLIFFE ACHROMESOMELIC DWARFISM--TYPES MAROTEAUX/CAMPAILLA-MARTINELLI PSEUDOACHONDROPLASIA METATROPIC DWARFISM PARASTREMMATIC DWARFISM THANATOPHORIC DWARFISM MORQUIO SYNDROME (MPS IV) OCULOMANDIBULOFACIAL SYNDROME (HELLER- MAN N-STREIFF-FRANCOIS) Data run complete, consultation terminated. COMPUTER-AIDED RADIOGRAPHIC DIAGNOSIS 13 erased. Each printout is stamped with the date and time of the consultation. KNOWLEDGE ENGINEERING Perhaps the most difficult aspect of expert system development is the organization of the knowledge database for optimum efficiency. Ide- ally, one would like the system to provide a list of differential diagnoses in descending order of probability, asking the user as few questions as possible. In order to develop this ideal system a probabilistic rather than deterministic lE would be required and the knowledge base would need to contain hard data regarding the prevalence and incidence of the various diagnoses, discrimi- nant criteria for the radiographic findings associ- ated with a given diagnosis, and positivity crite- ria for each of the various radiographic findings. The sensitivity and specificity of the radiographic test (plain film in this case) also would need to be included in the database. 13 Because such hard data is rarely if ever available in those problems relating to diagnostic radiology, one is forced to settle for a deterministic system as described previously or to develop one's own scoring system to indicate the likelihood of each of the diagnoses in the differential. ~4 The diagnoses in the system described previously can be arranged in the database in descending order of likelihood accord- ing to the user's practice. By this means the lE will attempt to confirm or reject the more com- mon diagnoses first and the least likely diagnoses last. The inclusion or deletion of specific radio- graphic findings from the database is a poten- tially subjective undertaking because the positiv- ity criterion for a particular finding may vary from one radiologist to another. Thus, a given radiologist user may either find that a particular finding either does not cross his or her threshold sufficiently often to allow reasonable sensitivity in making a diagnosis or may feel that the finding is not particularly specific. 13 Because the absence of a particular finding is crucial in the rejection of a diagnosis in the system described previously, it was felt necessary to include the "don't know" option to allow the user a way of handling uncertainty regarding a particular finding in a given case. Until more experience is gathered in the clinical setting with the system described and similar systems, we must await the establishment of an "official" set of radiographic findings for application to a particular radiologic problem. The approach used in the system described was to include initially a large number of findings (250 at time of this writing) and hopefully whittle these down to a smaller, more discrimi- nant number as experience with the system is acquired. For example, the finding of scoliosis, while a prominent feature of many osseous dyspla- sias, is not particularly useful in their differentia- tion as it may occur in isolation or be associated with almost any spinal anomaly. On the other hand, and hypothetically, if scoliosis never oc- curred in a specific dysplasia, then its inclusion in the database would be of value as its absence in a given case may help confirma diagnosis. SYSTEM REQUIREMENTS The T U R B O P R O L O G environment requires at least 384K of R A M and the stack size should be set to 2,400 paragraphs. The program source code takes up 14K, and 26K was required for the KB at time of writing. Thus, the entire system takes 40K with the KB embedded in the pro- gram. An option programmed into the user interface, but not yet added to the KB, is the ability of the system to display an explanation of the radiographic finding while being questioned by the lE. The finding explanation window is accessed by pressing the "e" key in response to a question by the system and the interrogation is resumed by pressing the spacebar after the expla- nation has been read by the user. The addition of explanations for all radiographic findings proba- bly will not be required, as many are self expian- atory. Nevertheless the memory requirements for the KB is expected to increase to approxi- mately 50K with the addition of these data. The expert system shell described offers a fast, inexpensive approach to computer-aided diagno- sis of certain specific radiologic problems. It may be used a s a simple database manager without activating the lE. The powerful word processing ability of the T U R B O P R O L O G editor allows rapid deletion or addition of diagnoses and radio- graphic findings to the database by the user. With increasing introduction of computer tech- nology to the radiology department it may be- hoove the practicing radiologist to become more familiar with medical expert systems and termi- nology. It is hoped that with increased input from such individuals systems with enhanced practical clinical usefulness will be developed. 14 DUNNE AND DUNNE REFERENCES 1. Greenes RA: Computer-aided diagnostic strategy selec- tion. Radiol Clin North Am 24:105-120, 1986 2. Kahn CE, Messersmith RN, Jokich MD: PHOENIX: An expert system for selecting diagnostic imaging proce- dures. Invest Radio122:978-980, 1987 3. Swett HA, Miller PL: ICON: A computer-based ap- proach to differential diagnosis in radiology. Radiology 163:555-558, 1987 4. Swett HA, Fisher PR, Cohn Al, et al: Expert system- controlled image display. Radiology 172:487-493, 1989 5. Schildt H: Artificial inteUigence: A quick overview, in Schildt H: Advanced Turbo Prolog a. Berkley, CA, Osborne/ McGraw-Hill, 1987, pp 1-12 6. Yin KM, Solomon D: Introduction, in Yin KM, So- lomon H (eds): Using Turbo Prolog a. Indianapolis, IN, Que~ Corporation, 1987, pp 1-6 7. Schildt H: Artificial intelligence: Expert systems, in Schildt H: Advanced Turbo Prolog a. Berkley, CA, Osborne/ McGraw-Hill, 1987, pp 57-90 8. Yin KM, Solomon D: Creating expert systems, in Yin KM, Solomon D: Using Turbo Prolog a. Indianapolis, IN, Que ~ Corporation, 1987, pp 387-434 9. Wynne-Davies R, Hall CM, Apley AG: Atlas of Skele- tal Dysplasias. Edinburgh, Scotland, Churchill Livingstone, 1985 10. Taybi H: Radiology of Syndromes and Metabolic Disorders (ed 2). Chicago, Year Book Medical, 1983 I 1. Goldman AB: Collagen diseases, epiphyseal dyspla- sias, and related conditions, in Resnik D, Niwayama G (eds): Diagnosis of Bone and Joint Disorders, vol 5. Philadelphia, PA, Saunders, 1988, pp 3374-3441 12. McAlister WH: Osteochondrodysplasias, dysostoses, chromosomal aberrations, mucopolysaccharidoses, and mu- colipidoses, in Resnik D, Niwayama G (eds): Diagnosis of Bone and Joint Disorders, vol 5. Philadelphia, PA, Saunders, 1988, pp 3442-3515 13. Chang P: Bayesian analysis revisited: A radiologist's survival guide. AJR 152:721-727, 1989 14. Getty D J, Pickett RM, D'Orsi C J, et al: Enhanced interpretation of diagnostic images. Invest Radiol 23:240- 252, 1988