Online Diagnosis Of Red Eye Diseases Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Abstract-- This paper describes Expert System (ES) for online diagnosis and prescription of red-eye diseases. The types of eye diseases that can be diagnosed with this system are called Red-eye diseases i.e. disease in which red-eye is the common symptom. It is rule based web-supported expert system, assisting ophthalmologists, medical students doing specialization in ophthalmology, researchers as well as eye patients having computer know-how. System was designed and programmed with Java Technology. The expert rules were developed on the symptoms of each type of Red-eye disease, and they were presented using tree-graph and inferred using forward-chaining with depth-first search method. User interaction with system is enhanced with attractive and easy to use user interfaces. The web based expert system described in this paper can detect and give early diagnosis of twenty Red-eye diseases. This WES can be extended to diagnose all types of eye-diseases.

Index Terms-Expert System, Red Eye, Ophthalmologist, Diagnose, Artificial Intelligence, Knowledge, Database.


This is web-based expert system called WES (Web based Expert System) for Diagnoses of Red Eye, to diagnose eye diseases infecting Pakistani population having red eye as common symptom. WES is

an enhanced version of the CADRE expert system [6] ,It contains a revised and extended knowledge base as well as more up-to-date inference mechanism.

The present work describes following improvements over the other similar expert systems in the field.

i) All previous Red Eye ES are non-internet and non-GUI based systems. The present work is development of web based system having easy to use GUI for the user interaction.

ii) Some of the earlier expert systems have grown up only at the prototype stage. There was obvious potential for more practical nature Red Eye based ES in ophthalmology and WES has been developed to achieve that.

iii) Previous systems were able to deal with fewer Red Eye diseases, resultantly

Backward chaining of rules was used.

No. of Red Eye diseases that our

system can diagnose (25) are more than

earlier systems, so we did use forward

chaining with depth first search method.

iv) The most important characteristic of this system is that it doesn't need to have the answers to every input question in order to reach a conclusion. The system will not ask the same question twice, For example, there are multiple red eye diseases that contain one/more common symptoms, so the responses given earlier will automatically be applied to new diagnoses.

An expert system is an Artificial Intelligence based computer program, which acts like a human expert in particular area of knowledge. It has three main components i.e. a knowledge base (KB), an inference engine (IE) and control strategy (CS) [2]. Knowledge structured in the form of IF-THEN rules is stored in KB. This knowledge is processed by inference engine under supervision of control strategy for achieving expert advice. A Web Based Expert System(WES) is a collection of computer software and hardware components that have been properly selected, designed, developed, combined and configured in order to deliver a service that emulates in an effective and reliable manner the reasoning process of domain experts over the Web[3].


In medicine, red eye is a non-specific term to describe an eye that appears red due to illness, injury, or some other condition. "Conjunctival injection" and "bloodshot eyes" are two forms of red eye. Since it is a common affliction, it is unsurprising that primary care doctors often deal with patients with red eyes in their practices. The goal of the primary care doctor when presented with a red eye is to assess whether it is an emergency in need of referral and immediate action, or instead a benign condition that can be managed easily and effectively. Red eye usually refers to hyperemia of the superficial blood vessels of the conjunctiva, sclera or episclera, and may be caused by diseases or disorders of these structures or adjacent structures that may affect them directly or indirectly [1].

2.1 Causes

There are many causes of a red eye including conjunctivitis, blepharitis, acute glaucoma, injury, subconjunctival hemorrhage, inflamed pterygium, inflamed pinguecula, and dry eye syndrome[1].

2.2 Investigation

Some signs and symptoms of red eye represent warnings that the underlying cause is serious and requires immediate attention. The person conducting a thorough eye examination should be attentive to the warning signs and symptoms during the eye exam. There are six danger signs: conjunctival injection, ciliary flush (circumcorneal injection), corneal edema or opacities, corneal staining, abnormal pupil size, and abnormal intraocular pressure[1].

There are approximately one hundred and fourteen (114) possible causes/medical conditions of Red Eye[1]. These causes/symptoms are used as rules in our web based medical expert system for diagnoses of Red Eye.

Due to rising cost of health care, web based medical expert system has proved useful for assisting medical practitioners and helping patients to self manage Red Eye. A few medical expert systems have been reported earlier for Red Eye Diagnosis. Marfina ulduna[4]. Ibrahim, F; Ali, J.B developed expert system for early diagnoses of eye diseases (including some cases of Red Eye) infecting the Malaysian population [5]. CARDRE ES was developed by Zubair et. al.[6] for diagnoses of Red eye diseases(20-diseases) infecting Pakistani population.

ES can be developed by two ways: i) Shell based approach ii) using some language like prolog, lisp, Java etc:. The requirements of the specific application determine the value of the capabilities and features required. More than 160 ES shells are available commercially for ES development. EXSYS (Schmoldt & Martin, 1989) and JESS (java expert system shell [8], which is java version of CLIPS ES shell, are mostly used for web based expert system development. The JESS source code can be embedded into java programs. JESS provides KB development environment and inference capability. However additional capabilities for GUI, images as well as JAVA Database Connectivity (JDBC) have to be programmed. The same is true for most of other ES shells like CLIPS and EXSYS.


The need for web based decision support and expert systems has been felt world wide as they are capable to provide comprehensive and up-to-date information and consultation in interactive and user friendly manner. Web based system has been developed to fulfill the following objectives:

To develop an online ES that may provide free consultation about Red eye diseases.

To assist ophthalmologists for diagnosing various diseases associated with red eye .

c) All health care professionals including, ophthalmologists, medical students, pharmacists can keep their knowledge up-to-date regarding "Red-eye diagnoses and treatment", as its knowledge base external database is updated on regular basis.


Phases/steps carried out in developing WES do include: 1.Problem definition/Scope identification. 2. Knowledge acquisition. 3. Knowledge representation. 4. Coding. 5. Testing and implementation.

4.1 Problem Definition/Scope Identification.

An expert system needs precise domain. The domain must be well organized and well understood. In diagnosis domain, as number of disorders (diseases) increase linearly, the number of possible diagnoses increase exponentially (i.e. there are more combinations of diagnoses to consider). This type of growth in the total no. of solutions is called combinatorial explosion[10]. Clearly, Red Eye diagnoses are an appropriate domain for expert system development. This WES has a narrow domain of Red eye diseases. Following list shows some sample red eye diseases which can be diagnosed by WESDRE.

1) Blepharitis, (2) Bacterial keratitis,( 3) Endophthalmitis, (4) Episcleritis, (5) Scleritis, (6) Chalazion, (7) Corneal ulcers, (8) Uveitis, (9) Ocular Rosacea, (10) Ectropion, (11) Entropion, (12) Foreign body and Red eye, (13) Viral Conjunctivitis, (14) Orbital Cellulitis, (15) Allergic Conjunctivitis, (16) Iritis, 17) Acute Angle-closure Glaucoma, (18) Bacterial Conjunctivitis, (19) Herpes Zoster, (20) Dry Eye Syndrome, (21) Episcleritis, (22) Vogt-Koyanagi-Harada syndrome (23) Choroidal melanoma.

Knowledge Acquisition.

Knowledge Acquisition includes three activities: choosing what knowledge is needed; obtaining and interpreting the knowledge; and modeling the knowledge. Some commonly used approaches are direct interviews, observations Ishikawa diagrams, case studies [7]. Direct interviews and observations were used for KA. The KA for this system consisted of several interviews with ophthalmologists, making observations and getting historical data from various ophthalmology clinics, depts. and wards in DHQ teaching hospital D.I.Khan, free eye camps and ophthalmology labs of medical college. Knowledge acquisition process lasted for four months.

4.3 Knowledge Representation

There are numerous approaches for knowledge representation depending on nature of problem domain. As this is a rule based system, so IF-THEN style rules are used because they are easy to understand and enhance. The rule has two components: IF<situation THEN<suggestion> The IF-part (antecedent/left hand side) suggests describes a situation under which the rule is applicable. The THEN part (consequent/right hand side) suggests an action to be performed under the situation ( for action rules) or a plausible inference to make under the situation( for inference rules)[7].

For example:

Sample JESS rule taken form WESDRE is given below

Jess>(defrule red-eye-rule-1

(symptom (name ? blapheritis) (upp_lid_pain true) (eye_red true) (sandy_feeling true)(fever yes) =>(max cahnces of blaphiritis, with CF ?too_high). This particular If-rule shows nested and conditions for red-eye disease called blepharitis.

For present application, appropriate option is JESS, Java Servlets/JSP based , JDBC-ODBC bridge for database access, image composing tools like image composer, Segate Crystal reports as reporting tool. WESDRE Web based model is shown in Fig.1



Web based user interface

External D.B(MySQL)

Java servlets/JSP



Inference Engine



WESDRE Core Components

Fig.1 WES Model

4.4 Testing and implementation

System is tested to ensure that it provides good quality decisions. Reasoning technique is tested for

correctness i.e. whether it attains the desired accuracy rate. During testing omitted rules, incorrect rules, overlooked special cases are checked. Association of rules and missing relationships are also checked. Thorough testing verifies that all paths in the knowledge base are covered. ES was tested by two Eye Specialists/ophthalmologists. The prototyping approach was used to implement WES. A small domain of the knowledge acquired was implemented in JESS and presented to the ophthalmologists. They tested the prototype using different scenarios. They recommended additions, deletions or changes from the conclusions given by WES. Once the Ophthalmologists agreed with the recommendations given by the ES, new prototype with more knowledge was developed and presented again to experts for testing. The procedure continued until all the acquired knowledge was included in WES knowledge base. WES is planned to be launched on the web using Apache server.


The WES knowledge base includes over 300 facts and 400 rules for diagnosing all types Red Eye diseases. Proposed system strictly incorporates the diagnostic criteria followed by human experts. There are twenty five diseases associated with "Red Eye" with each disease having average of 15 to 20 symptoms. System is able to diagnose all twenty five diseases of Red eye. WES working model is comprised of following modules: symptom analysis phase-I, symptom analysis phase-II, disease selection with appropriate percentage, medicine selection for disease diagnosed, knowledge base, user interface design.

5.1 Phase-I

When system is turned on and option "consultation" is selected from the main menu then all consultation begins in question answer format. User answers "yes" or "no" when "yes" is clicked/checked then risk factor retains its previous value. e.g. Do you feel that your eyelashes are turning inwards?

If user checks "yes", then following action takes place

Assign bleph_fact:=bleph_fact+10

If "No" or "Unknown" is checked then bleph_fact retains its previous value. In this Question answer session if certainty factor of one/more diseases gets increased from 40 then their follow-up question are asked. This is beginning of phase-II[6].

5.2 Phase-II

In this phase, detailed/remaining/follow-up questions of only those diseases are asked whose certainty factors are greater than 40. Thus no. of questions (symptoms) in this phase are less than phase-I. User again answers yes/no/unknown to follow up questions. At the end of this follow up session disease(s) is/are diagnosed in the form of percentage i.e. possible disease(s) is/are listed along with percentage(s) that a patient can suffer from[6]. One of the Graphical diagnostic reports is shown in Fig. 3.

Fig. 3 Graphical Diagnostic Report of WES.

5.3 Knowledge Base Design

A web based knowledge base is designed that assists knowledge engineer for representing facts and rules. JESS knowledge acquisition and representation editor (DRAMA 2.0) with object oriented graphic tools makes it very easy. Facts and rules regarding disease symptoms, CF values, treatment, prevention methods/actions can entered online by the experts who are authorized to access it. Disease Tree diagram taken from WESDRE KB is shown in Fig: 2

Fig. 2. Disease Tree Diagram of WES KB.

It shows that WES's scope

5.4 External Data Base

External Database is created in MySql for storage and retrieval of symptoms, diseases, treatment, prevention information, and rules associated with WES knowledge base.

5.5 User Interface

The acceptability of an expert system

depends to a great extent on the quality

of user interface. The Web based user interface is supported by java servlets, where user can respond to questions asked by the system. Java servlet technology provides a simple, consistent mechanism for extending the functionality of web server. A servlet can almost be thought of as an applet

that runs on the server side. Servltes provide a component based, platform-independent method for building Web-based applications, without the performance limitations of CGI programs [9].


When the Doctor/patient visits WES, series of questions appear on computer screen. This is phase-I of "symptoms analysis". After this system asks follow-up questions, this is phase_II of symptom analysis. The end result of this phase is a "diagnostic report" about the patient under examination, suggesting a possible disease. It also suggests proper management and treatment for that particular disease. Learned Patients can get benefits from this system without assistance of Ophthalmologist. Table-1 shows a sample session with WES[6]. This ES is capable of giving answers to questions like "EXPLAIN" and "WHY" at each and every step during interaction with system. After detailed dialogue system comes with following suggestion.

You have chances of suffering from a red-eye disease "Blephratis" Certainty

factor (CF)= 80%.

Table-1: Sample session with WES

WES Do you feel eye-pain, especially with eye movement?

Patient Yes.

WES: Is there any painful swelling of the upper eyelid?

Patient Yes.

WES: Eyes red or not?

Patient Yes.

WES: Is there any irritation, gritty or sandy feeling?

Patient No.

WES: Do you feel fever, malaise or headache?

Patient Yes

WES: Is there any light sensitivity?

Patient No

WES: The eye movement is restricted or not?

Patient Yes.

WES: Eye lids appear shiny and appear red or purple in color?

Patient Yes.

WES: Do you feel partial loss of vision?

Patient Yes.


WES is an extension its previous version CADRE, which was developed by ICIT, GU,D.I.KHAN students under the supervision of Zubair Asghar[6].

It benefits common man (eye patient in this case) through the use internet based ES consultation. It also assists all ophthalmologists/medical students for diagnosing Red eye diseases. Adding new facts and rules to WES is very easy for other diseases of eye is very easy through JESS knowledge acquisition editor.


In future this system will be extended to diagnose all Eye diseases. WES

will be made ready for next stage, where national/regional languages like urdu

can be used for interaction with it on the web. This will make available to the patients without language barrier.