Journal of Theoretical and Applied Information Technology © 2005 2008 JATIT. All rights reserved. www.jatit.org 923 AN EXPERT SYSTEM FOR DIAGNOSING EYE DISEASES USING CLIPS 1Associate Prof., Samy S. Abu Naser, 1Abu Zaiter A. Ola 1Faculty of Engineering & Information Technology, Al-Azhar University, Gaza, Palestine E-mail: samy@abunasser.com ABSTRACT This work presents the design of an expert system that aims to provide the patient with background for suitable diagnosis of some of the eye diseases. The eye has always been viewed as a tunnel to the inner workings of the body. There are many disease states that may produce symptoms from the eye. CLIPS language is used as a tool for designing our expert system. An initial evaluation of the expert system was carried out and a positive feedback was received from the users. Keywords: Artificial Intelligence, Expert Systems CLIPS, Eye disease. 1. INTRODUCTION Computer-based methods are increasingly used to improve the quality of medical services. Artificial Intelligence (AI) is the area of computer science focusing on creating machines that can engage on behaviors that humans consider intelligent. The ability to create intelligent machines has intrigued humans since ancient times and today with the advent of the computer and 50 years of research into AI programming techniques, the dream of smart machines is becoming a reality. Researchers are creating systems which can mimic human thought, understand speech, beat the best human chess player, and countless other feats never before possible. Find out how the military is applying AI logic to its hi-tech systems, and how in the near future Artificial Intelligence may impact our lives [1]. Dependence on the human expert can be minimized if his/her expertise can be transferred into a computer system. The proposed system for dealing with the problem of eye disease diagnosis is an expert system. An expert system is a system that employs human knowledge captured in a computer to solve problems that ordinarily require human expertise [2],[13]. Expert system seeks and utilizes relevant information from their human users and from available knowledge bases in order to make recommendations [3]. With the expert system, the user can interact with a computer to solve a certain problem. This can occur because the expert system can store heuristic knowledge. The development of expert system is implemented in CLIPS programming environment (C Language Integrated Production System) [4],[14]. This programming tool is designed to facilitate the development of software to model human knowledge or expertise for medical therapy. CLIPS program is used by reason of the flexibility, the expandability and the low cost. The human eye is the organ which gives us the sense of sight, allowing us to learn more about the surrounding world than we do with any of the other four senses. We use our eyes in almost every activity we perform, whether reading, working, watching television, writing a letter, driving a car, and in countless other ways. Most people probably would agree that sight is the sense they value more than all the rest. The eye allows us to see and interpret the shapes, colors, and dimensions of objects in the world by processing the light they reflect or emit. The eye is able to detect bright light or dim light, but it cannot sense objects when light are absent. Journal of Theoretical and Applied Information Technology © 2005 2008 JATIT. All rights reserved. www.jatit.org 924 Diagnosis of eye disorders is initially based on the symptoms that the person is experiencing, the appearance of the eyes, and the results of an examination. Many cases of eye disease can lead to blindness. However, if detected early enough, eyesight can often be saved. Some of the researchers designed an expert system for search allergy and selection of the skin tests using CLIPS [5]; An expert system for diagnosis of coronary artery disease using Myocardial Perfusion Imaging [6]; And, an intelligent medical system for diagnosis of bone diseases [7]. According to our knowledge no one designed expert systems for diagnosis of eye diseases, so in this work, we will present a design of an expert system for diagnosis of eye diseases using CLIPS. We preset in section 2 Medical Knowledge, section 3 the Function of the System, section 4 Expert System, section 5 User Interface, and in section 6 Conclusions. 2. MEDICAL KNOWLEDGE The medical knowledge of specialized doctor is required for the development of an expert system. This knowledge is collected in two phases. In the first phase, the medical background of eye diseases is recorded through the creation of personal interview with doctors and patients. In the second phase, a set of rules is created where each rule contains in IF part that has the symptoms and in THEN part that has the disease that should be realized. The inference engine (forward reasoning) is a mechanism through which rules are selected to be fired. It is based on a pattern matching algorithm whose main purpose is to associate the facts (input data) with applicable rules from the rule base. Finally, the eye diseases are produced by the inference engine. This expert system defined the symptoms for diseases of the eye. The scope of our expert system is the following eye diseases: Discharge from the Eye, Bulging Eye, Double Vision, and Drooping Eyelid. Discharge from the eye causes at morning your eyes refuse to rise. They are so swollen shut with sticky, crusty discharge; it feels like the sandman pasted your lids with glue. It can be alarming to have to pry open your eye in the morning, but eye discharge is rarely harmful and is simply part of your body's natural defense system [9]. Bulging eyes is the abnormal protrusion (bulging out) of one or both eyeballs. Bulging eyes should receive immediate attention. Bulging of a single eye, especially in a child, is a very serious sign and should be evaluated immediately [10]. If the two eyes are misaligned and aim at different targets, two non-matching images will be sent to the viewer's brain. When the brain accepts and uses two non-matching images at the same time, double vision results. Double vision is dangerous to survival, so, the brain naturally guards against its occurrence. In an attempt to avoid double vision, the brain will eventually disregard one of the mismatching images. That is, the brain will ignore one eye [11]. Drooping eyelid affects only the upper eyelid of one or both eyes. The droop may be barely noticeable, or the lid can descend over the entire pupil. Drooping eyelid can occur in both children and adults, but happens most often due to aging [12]. 3. THE FUNCTION OF THE SYSTEM The proposed system performs many functions. It will conclude the eye disease diagnosis based on answers of the user to specific question that the system asks the user. The questions provide the system for explanation for the symptoms of the patient that helps the expert system for diagnosis the disease by inference engine. It stores the facts and the conclusion of the inference of the system, and the user, for each case, in data base. It processes the data base in order to extract rules, which complete the knowledge base. 4. EXPERT SYSTEM A literature review of the last decade for the recording of development methodologies of expert systems surveys and classifies these methodologies using six categories [8]. This expert system use following categories: Rule-based systems Knowledge-based systems Intelligent agent (IA) Database methodology Inference engine. System-user interaction. The expert system developed in this work consists of the user interface, the explanation facility, the knowledge base, and the inference engine. The structure of the expert system is shown in Figure1. Journal of Theoretical and Applied Information Technology © 2005 2008 JATIT. All rights reserved. www.jatit.org 925 Figure1: The structure of the expert system The methodologies constitute the second generation of expert systems and they have the tendency to be developed to the direction of on one side directed also specialized knowledge (expertise orientation) and on the other hand in the development of applications in specialized problems problem oriented). In the present article the problem of the eye diseases are implemented by methodology of rule based systems. One of the well-know methods of representation of knowledge in the expert systems is the productive representation as the CLIPS (production system). CLIPS keeps in memory a fact list, a rule list, and an agenda with activations of rules. Facts in CLIPS are simple expressions consisting of fields in parentheses. Groups of facts in CLIPS, usually follow a fact-template, so that to be easy to organize them and thus design simple rules that apply to them. Our expert system contains 93 CLIPS rules. Below, we present the rules for Discharge from the Eye disease. (defrule Menu (not (iffoundChoice ?)) => (printout t crlf crlf crlf " Choose one of the problem areas listed below" crlf crlf " 1.) Discharge from the Eye. " crlf crlf " 2.) Bulging Eye." crlf crlf " 3.) Double Vision." crlf crlf " 4.) Drooping Eyelid." crlf crlf " 5.) EXIT OF SYSTEM.." crlf crlf crlf " Enter no. of your choise: " ) (assert (iffoundChoice (read)))) ;; Rules Discharge from the Eye ;;------------------R0------------------ (defrule Discharge_from_the_Eye (iffoundChoice 1) ?retractCh1 <- (iffoundChoice 1) (not (ifYesNochoise ?)) => (retract ?retractCh1) (printout t crlf crlf crlf " Are you suffer from eyes red ? (yes | no) " crlf crlf " Your answer: " ) (assert (ifYesNochoise (read)))) ;;------------------R1------------------ (defrule Discharge_from_the_Eye1 (ifYesNochoise yes) ?retractChy <- (ifYesNochoise yes) (not (ifYesNochoise1 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from eyes swollen eyelids ? (Yes | No) " crlf crlf " Your answer: " ) (assert (ifYesNochoise1 (read)))) ;;------------------R2------------------ (defrule Discharge_from_the_Eye2 (ifYesNochoise1 yes) ?retractChy <- (ifYesNochoise1 yes) (not (ifYesNochoise2 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from pus like discharge and crusting of eyelids on awakening ? (Yes | No) " crlf crlf " Your answer: " ) (assert (ifYesNochoise2 (read)))) ;;------------------R3------------------ (defrule Discharge_from_the_Eye3 (ifYesNochoise2 yes) ?retractChy <- (ifYesNochoise2 yes) => (retract ?retractChy) (printout t crlf crlf crlf" You are suffering from Bacterial Conjunctivitis OR blepharitis.. " crlf crlf " Thank you for using my Program... "crlf crlf )) ;;------------------R4------------------ (defrule Discharge_from_the_Eye4 (ifYesNochoise2 no) ?retractChy <- (ifYesNochoise2 no) (not (ifYesNochoise3 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from sticky, crusty eyelids" crlf " red, itchy eyelids" crlf " loss of eyelashes ? (Yes | No) " crlf crlf " Your answer: " ) (assert (ifYesNochoise3 (read)))) ;;------------------R5------------------ Journal of Theoretical and Applied Information Technology © 2005 2008 JATIT. All rights reserved. www.jatit.org 926 (defrule Discharge_from_the_Eye5 (ifYesNochoise3 yes) ?retractChy <- (ifYesNochoise3 yes) => (retract ?retractChy) (printout t crlf crlf crlf " You are suffering from Blepharitis OR Conjunctivitis OR Stye .. " crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R6------------------ (defrule Discharge_from_the_Eye6 (ifYesNochoise3 no) ?retractChy <- (ifYesNochoise3 no) (not (ifYesNochoise4 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from watery discharge" crlf " fever and sore throat" crlf " swollen glands in neck ? (Yes | No) " crlf crlf " Your answer: " ) (assert (ifYesNochoise4 (read))) ) ;;------------------R7------------------ (defrule Discharge_from_the_Eye7 (ifYesNochoise4 yes) ?retractChy <- (ifYesNochoise4 yes) => (retract ?retractChy) (printout t crlf crlf crlf " You are suffering from Viral Conjunctivitis OR allergic conjunctivitis... " crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R8------------------ (defrule Discharge_from_the_Eye8 (ifYesNochoise4 no) ?retractChy <- (ifYesNochoise4 no) => (retract ?retractChy) (printout t crlf crlf crlf " You should be sure for your symptoms.. Try again..." crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R9------------------ (defrule Discharge_from_the_Eye9 (ifYesNochoise1 no) ?retractChy <- (ifYesNochoise1 no) (not (ifYesNochoise5 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from watery discharge" crlf " seasonal allergies" crlf " itching eyes ? (Yes | No) " crlf crlf " Your answer: " ) (assert (ifYesNochoise5 (read))) ) ;;------------------R10------------------ (defrule Discharge_from_the_Eye10 (ifYesNochoise5 yes) ?retractChy <- (ifYesNochoise5 yes) => (retract ?retractChy) (printout t crlf crlf crlf "You are suffering from Allergic Conjunctivitis OR viral conjunctivitis ... " crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R11------------------ (defrule Discharge_from_the_Eye11 (ifYesNochoise5 no) ?retractChy <- (ifYesNochoise5 no) (not (ifYesNochoise6 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from fever and sore throat " crlf " red rash, begins on face then body " crlf " clear discharge from eye ? (Yes | No) " crlf crlf " Your answer: " ) (assert (ifYesNochoise6 (read))) ) ;;------------------R12------------------ (defrule Discharge_from_the_Eye12 (ifYesNochoise6 yes) ?retractChy <- (ifYesNochoise6 yes) => (retract ?retractChy) (printout t crlf crlf crlf " You are suffering from Measles OR Viral Conjunctivitis ... " crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R13------------------ (defrule Discharge_from_the_Eye13 (ifYesNochoise6 no) ?retractChy <- (ifYesNochoise6 no) => (retract ?retractChy) (printout t crlf crlf crlf " You should be sure for your symptoms.. Try again..." crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R14------------------ (defrule Discharge_from_the_Eye14 Journal of Theoretical and Applied Information Technology © 2005 2008 JATIT. All rights reserved. www.jatit.org 927 ( ifYesNochoise no) ?retractChy <- (ifYesNochoise no) (not (ifYesNochoise7 ?)) => (retract ?retractChy) (printout t crlf crlf crlf "Are you suffer from swelling of eyelids, tongue and face ? (yes | no) " crlf crlf " Your answer: " ) (assert (ifYesNochoise7 (read))) ) ;;------------------R15------------------ (defrule Discharge_from_the_Eye15 ( ifYesNochoise7 yes) ?retractChy <- (ifYesNochoise7 yes) (not (ifYesNochoise8 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from sweating " crlf " use of new medication, insect bite, new foods" crlf " rapid heart beat ? (yes | no) " crlf crlf " Your answer: " ) (assert (ifYesNochoise8 (read))) ) ;;------------------R16------------------ (defrule Discharge_from_the_Eye16 ( ifYesNochoise8 yes) ?retractChy <- (ifYesNochoise8 yes) => (retract ?retractChy) (printout t crlf crlf crlf " You are suffering from Allergy OR Anaphylaxis ... " crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R17------------------ (defrule Discharge_from_the_Eye17 ( ifYesNochoise8 no) ?retractChy <- (ifYesNochoise8 no) => (retract ?retractChy) (printout t crlf crlf crlf " You should be sure for your symptoms.. Try again..." crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R18------------------ (defrule Discharge_from_the_Eye18 ( ifYesNochoise7 no) ?retractChy <- (ifYesNochoise7 no) (not (ifYesNochoise9 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from eyes red with watery discharge ? (yes | no) " crlf crlf " Your answer: " ) (assert (ifYesNochoise9 (read))) ) ;;------------------R19------------------ (defrule Discharge_from_the_Eye19 ( ifYesNochoise9 yes) ?retractChy <- (ifYesNochoise9 yes) (not (ifYesNochoise10 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from headache centered around eye "crlf " headaches usually lasting 15-30 minutes "crlf " more common in men "crlf " nasal discharge ? (yes | no) " crlf crlf " Your answer: " ) (assert (ifYesNochoise10 (read))) ) ;;------------------R20------------------ (defrule Discharge_from_the_Eye20 ( ifYesNochoise10 yes) ?retractChy <- (ifYesNochoise10 yes) => (retract ?retractChy) (printout t crlf crlf crlf " You are suffering from Cluster Headache OR Migraine Headache OR Allergic Rhinitis ... " crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R21------------------ (defrule Discharge_from_the_Eye21 ( ifYesNochoise10 no) ?retractChy <- (ifYesNochoise10 no) (not (ifYesNochoise11 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from more common in elderly people "crlf " may develop pus like drainage from eye ? (yes | no) " crlf crlf " Your answer: " ) (assert (ifYesNochoise11 (read))) ) ;;------------------R22------------------ (defrule Discharge_from_the_Eye22 ( ifYesNochoise11 yes) ?retractChy <- (ifYesNochoise11 yes) => (retract ?retractChy) (printout t crlf crlf crlf " You are suffering from Dacryocystitis OR Stye OR Conjunctivitis..." Journal of Theoretical and Applied Information Technology © 2005 2008 JATIT. All rights reserved. www.jatit.org 928 crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R23------------------ (defrule Discharge_from_the_Eye23 ( ifYesNochoise11 no) ?retractChy <- (ifYesNochoise11 no) => (retract ?retractChy) (printout t crlf crlf crlf " You should be sure for your symptoms.." crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R24------------------ (defrule Discharge_from_the_Eye24 ( ifYesNochoise9 no) ?retractChy <- (ifYesNochoise9 no) (not (ifYesNochoise12 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from blurred vision ? (yes | no) " crlf crlf " Your answer: " ) (assert (ifYesNochoise12 (read))) ) ;;------------------R25------------------ (defrule Discharge_from_the_Eye25 ( ifYesNochoise12 yes) ?retractChy <- (ifYesNochoise12 yes) (not (ifYesNochoise13 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from pain and redness "crlf " excessive tearing " crlf " sensitivity to light" crlf " feeling of foreign body in eye ? (yes | no) " crlf crlf " Your answer: " ) (assert (ifYesNochoise13 (read))) ) ;;------------------R26------------------ (defrule Discharge_from_the_Eye26 ( ifYesNochoise13 yes) ?retractChy <- (ifYesNochoise13 yes) => (retract ?retractChy) (printout t crlf crlf crlf "You are suffering from Corneal Abrasion OR Corneal Ulcer... " crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R27------------------ (defrule Discharge_from_the_Eye27 ( ifYesNochoise13 no) ?retractChy <- (ifYesNochoise13 no) (not (ifYesNochoise14 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from eyes red lump on the edge of eyelid "crlf " lump may drain pus " crlf " painful lump ? (yes | no) " crlf crlf " Your answer: " ) (assert (ifYesNochoise14 (read))) ) ;;------------------R28------------------ (defrule Discharge_from_the_Eye28 ( ifYesNochoise14 yes) ?retractChy <- (ifYesNochoise14 yes) => (retract ?retractChy) (printout t crlf crlf crlf "You are suffering from Stye OR Chalazion... " crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R29------------------ (defrule Discharge_from_the_Eye29 ( ifYesNochoise12 no) ?retractChy <- (ifYesNochoise12 no) (not (ifYesNochoise15 ?)) => (retract ?retractChy) (printout t crlf crlf crlf " Are you suffer from weakness of one side of the face "crlf " recent viral illness " crlf " drooping of lower eyelid " crlf " difficulty closing eyelid " crlf " discharge from the eye ? (yes| no) " crlf crlf " Your answer: " ) (assert (ifYesNochoise15 (read))) ) ;;------------------R30------------------ (defrule Discharge_from_the_Eye30 ( ifYesNochoise15 yes) ?retractChy <- (ifYesNochoise15 yes) => (retract ?retractChy) (printout t crlf crlf crlf "You are suffering from Bell's Palsy OR Multiple Sclerosis OR Stroke OR Acoustic Neuroma..." crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R31------------------ (defrule Discharge_from_the_Eye31 ( ifYesNochoise15 no) ?retractChy <- (ifYesNochoise15 no) => Journal of Theoretical and Applied Information Technology © 2005 2008 JATIT. All rights reserved. www.jatit.org 929 (retract ?retractChy) (printout t crlf crlf crlf " You should be sure for your symptoms.. Try again..." crlf crlf " Thank you for using my Program... "crlf crlf ) ) ;;------------------R32------------------ (defrule Discharge_from_the_Eye32 ( ifYesNochoise14 no) ?retractChy <- (ifYesNochoise14 no) => (retract ?retractChy) (printout t crlf crlf crlf " You should be sure for your symptoms.. Try again..." crlf crlf " Thank you for using my Program... "crlf crlf ) ) 5. USER INTERFACE Communication between the user and the system is done through the user interface which was implemented in English language. The user interface is represented as a menu which displays the eye diseases to the user. When the system is started a main menu is displayed on the screen which asks the user to choose one of the diseases that suffered from, see Fig. 2 for details. When the patient suffered from discharge from the eye, he/she will choose number one from the menu. Then the expert system asks the patient for his/her symptoms. The user answers with a simple yes or no. Finally, the system informs the patient that he/she suffered from Bacterial Fig. 2 Start up menu of the system Figure2 Start up menu of the system Conjunctivitis or blepharitis. See that system result in Figure3. Figure3: A sample of the system result 6. CONCLUSION The application of expert systems in medicine is very interesting and has created considerable importance systems of diagnosis. The proposed system can help doctors and patients in providing decision support system, interactive training tool and expert advice. The system constitutes part of intelligent system of diagnosis of eye diseases. The article presented an expert system for medical cases. An initial evaluation of the expert system was done by doctors and patients. A number of doctors and patients tested the system and gave us a positive feedback and asked us to expand the expert system to cover more eye diseases. As future work we will constitute the expert system to cover all eye diseases. 7. REFERENCES [1] Russell, S. and P. Norvig, 2002. Artificial Intelligence: A Modern Approach, Prentice Hall, Second Edition. [2] Beverly G. Hope, Rosewary H. Wild, « An Expert Support System for Service Quality Improvement», Proceedings of the TwentySeventh Annual Hawaii International Conference on System Science, 1994. [3] Turban E., 1992. Expert System and Applied Artificial Intelligence, Macmillan Publishing Company, New York. Journal of Theoretical and Applied Information Technology © 2005 2008 JATIT. All rights reserved. www.jatit.org 930 [4] Giarranto J. C., 1998. CLIPS User's Guide, Version 6.22, 1998. [5] Karagiannis S., Dounis A., Chalastras T., Tiropanis P., and Papachristos D.,2006. Design of Expert System for Search Allergy and Selection of the Skin Tests using CLIPS, International Journal Of Information Technology, 3(1). [6] Rashid J. Q. and, Syed A. H.,2004. Design of an Expert System for Diagnosis of Coronary Artery Disease Using Myocardial Perfusion Imaging, National Conference on Emerging Technologies 2004. [7] Hatzilygeroudis P., Vassilakos J., and Tsakalidis A.,1994. An Intelligent Medical System for Diagnosis of Bone Diseases, Proceedings of the International Conference on Medical Physics and Biomedical Engineering (MPBE'94), Nicosia, Cyprus, May 1994, Vol. I, pp.148-152. [8] Shu-Hsien L., 2005. Expert system methodologies and applications a decade review from 1995 to 2004, Expert Systems with Applications, 28: 93-103. [9] http://www.mothernature.com/Library/ Bookshelf/Books/16/69.cfm [10] http://www.umm.edu/ency/article/ 003033.htm [11] http://www.strabismus.org/double_vision .html [12] http://www.allaboutvision.com/conditions / droopinglids.htm [13] Azaab S., Abu Naser S., and Sulisel O.,2000. A proposed expert system for selecting exploratory factor analysis procedures, Journal of the college of education, 4(2):9-26. [14] Jackson, P., 1999. Introduction to Expert Systems, Harlow, England: Addison Wesley Longman. Third Edition