Abstract
Over 93 million people get ill with sexually transmitted diseases in sub-Saharan Africa. However, research has shown that people with sexually transmitted diseases find it difficult to share their problem with a physician due to societal discrimination in Africa. Due to this problem, we have implemented a medical expert system for diagnosing sexually transmitted diseases (ESSTD) that maintains the anonymity of the individuals. The patients diagnose themselves by answering questions provided by the system. This paper presents the design and development of the system. Forward chaining rules were used to implement the knowledge base and the system is easily accessible on mobile platforms. The Java Expert System Shell was used for its inference engine and the system was validated by domain experts. It is useful because it helps to maintain anonymity for patients with STD.
Keywords
Introduction
Expert systems have been successfully implemented across different application domains including: finance – for portfolio management and selection of equity securities [9, 19]; transport – for traffic management and traffic light control [24, 30]; music – for assisting in the construction of musical pieces [12]; education – as career advisory experts and student tutors [6, 18] and sports – for talent identification [5].
More specifically expert systems have been applied in the medical sector to mitigate various challenges in health care [6, 29]. In medical informatics, examples of the application of expert systems include: for nutritional diagnosis [3], for thyroid diagnosis [1], for breast cancer diagnosis [2], for coronary heart diagnosis [20], for predicting the pathological stage of prostate cancer [10], for generating therapy plans [27], and to support the consultation process of traditional Chinese medicine practitioners [16]. The advent of mobile phones and their technological evolvement into “smart phones” have made a lot of things possible, including the ability to install and run third party innovative software packages on them including expert systems for various purposes [32]. The proliferation of these smart phones has made them ubiquitous; they are accessible by a great percentage of people, even those in rural communities. They have therefore being used to support health care practitioners and outpatients in rural areas where there is minimal access to medical experts [21]. Mobile technology has been adopted as an avenue to provide affordable health care [13]. Developed a phon1e-based expert system for disease diagnosis to be used by patients, physicians and community health officers in developing nations.
Sexually Transmitted Diseases (STD) also known as Sexually Transmitted Infections (STI) constitute major public health issues and the number of recorded cases increases annually [28]. According to [31], over one million people acquire STI daily, while yearly, about 500 million people become ill with either chlamydia, gonorrhea, or trichomoniasis. Other examples are syphilis, HIV, herpes. They are commonly caused by bacteria, viruses, protozoa, parasites or fungi.
Over the years research has shown that people infected with STD find it difficult to share the problem with a physician or friend [15]. This is because of the fear of societal discrimination and stigma associated with carrying an STD [11]. This expert system would enable each patient to carry out diagnosis themselves and maintain anonymity. The patients get diagnosed themselves by answering questions provided by the system. At the end of the diagnosis the system proposes a recommendation based on the answers to the questions. The expert system is useful because the knowledge embedded in the system is retained for as long as the system engineer wants compared to the human expert that has a short life span where by knowledge can be lost. This report details the design and the implementation of a modifiable expert system to diagnose STDs.
Section 2 discusses the background to the study and literature review, Section 3 discusses methodology and architecture, Section 4 discusses the analysis while the last section ends with discussion, conclusion and future works.
Background and literature survey
Expert systems are a branch of Artificial Intelligence. They are intelligent computer programs that use knowledge and inference procedures to solve problems that are difficult enough to require significant human expertise for their solution.
There are different types of expert systems based on the knowledge representation and reasoning technique applied. They include rule-based expert systems, frame based expert systems, case-based expert systems. The rule-based system which was used in building this system uses sets of rules to derive conclusions from premises. It is the most common knowledge representation technique.
Expert systems consist of five components: the knowledge base, the database, the inference engine, the explanation facilities, and the user interface. The expert system works like a user input system because it accepts user inputs, processes them based on the knowledge embedded in the knowledge base and finally returns a reliable result to the user. A typical expert system operates thus:
Inference Engine + Knowledge Base = Expert System
The four major components of an expert system are the knowledge base, inference engine, working memory and the user interface.
Generally, in a rule-based system, domain knowledge is stored as rules in the knowledge base, and data as facts in the database then the inference engine compares the rules in the knowledge base with the facts in the database. When the rule matches a fact, then the rule is fired and the consequent is executed. The inference engine determines when rules are fired, and then executes the rules. The rules can be executed using either forward chaining or backward chaining reasoning. The forward chaining approach was used in this work, because of its relativity to the nature of the problem being solved. This approach is also known as ‘data driven reasoning’. Reasoning starts from the known data and proceeds with that data to reach a conclusion.
Related works
Previous researches with respect to the application of expert systems to medical informatics are discussed detailing their systems analysis and limitations.
Expert system for diabetes diagnosis (ESDD) was developed at Department of Computer Science, Christ University Bangalore [26]. It was developed to diagnose diabetes mellitus using the CLIPS programming language, version 6.3 and the forward chaining inference method. The system asks questions in plain English language while users respond with either a yes or no. The information gotten from the user is then used to decide the degree of diabetes in the individual. The different degrees used in this system are slight chance, moderate chance, high chance, very high chance, or already diabetic or not. The system was not built to substitute a human physician but will provide a reliable diagnosis to users based on their input. It was tested by using classical test cases. A major limitation is that the system does not allow for the update of the knowledge base.
An adoptive medical diagnosis system was developed using the rule-based expert system methodology. It was built to diagnose general diseases such as malaria and typhoid [7].
An expert system for endocrine diagnosis (ESED) and treatment was also developed using JESS at Al-Azhar University, Gaza, Palestine [22]. The system was built to diagnose and treat cases related to thyroid, pancreas and parathyroid glands’ diseases. The aim of building the system was to assist physicians in diagnosis of endocrine diseases. This system was not built to replace the doctors in taking decisions but to assist or enhance their decision-making capabilities. The expert system also helped in teaching newly graduated doctors on how to investigate an endocrine disease. From the review the expert system, it was clearly seen that new knowledge cannot be fed into the system. This limitation makes the expert system a closed system such that new ideas cannot be proposed.
In [25], the authors used Genetic Algorithm to develop a pattern recognition system to diagnose gonorrhea. The knowledge base used was developed based on collected data on the symptoms of the disease. Users present symptoms as inputs to the system and the system provides the degree of membership of the symptom to one of the gonorrhea symptom sets. The system therefore assists physicians. PHP and Java programming languages were employed for its development.
A rule based expert system was developed using SL5 object ES to diagnose genital problems for men. The system asks the patients series of questions, which are answered as either true or false. Answers to these questions are then used by the system to provide proper diagnosis and recommendation [23].
Proposed system methodology and architecture
The previous section gave a detailed background on the expert system, its components and its development stages. This section describes the systems methodology and design.
ESSTD is a user-friendly system that interacts with users by asking questions in English language and expects user input in form of a yes or no. It acts on behalf of a human expert in making decisions when they are unavailable. This expert system makes decisions based on the knowledge represented in a XML based decision tree and stored as rules in the Java Expert System Shell. The use of decision tree was adopted in this paper to map out the process of reasoning of the expert system. A decision tree is a graph or structured tree that details knowledge received from a human expert. The purpose of using the decision tree is because it captures the questions and the solutions of the expert system and it guides the expert system to know which question or solution to infer. It also helps to display an easy to read algorithm of the system and ensures clarity of the system. The decision tree consists of four major elements: the root, node, branch and leaf. Further details of the decision tree can be found in Section 3. The Java Expert System Shell was used because of its proven efficiency in implementing expert systems and forward chaining rules were used because of their suitability in this context.
A formal UML diagram of the system is also presented here. The UML diagram include: use case diagram and the sequence diagram. The decision tree of this system is also described in this section, as well as the steps that were taken to build the system.
The design of an expert system can be divided in the three major steps [4]: Knowledge acquisition Knowledge analysis and representation Knowledge validation
Knowledge acquisition
For this paper, the method of knowledge acquisition was to interview physicians in hospital. Information was gathered from specialists in the area of sexually transmitted disease. Some of the questions asked were: Types of sexually transmitted diseases Symptoms of sexually transmitted diseases Ways of diagnosing and What drugs to prescribe for patients.
The questions above were asked as part of a questionnaire. These questions were decided on the discussion and recommendation of the doctors. The complete set of questions can be found in Section 4.
Knowledge analysis and representation
In this paper the knowledge gathered from human expert was represented in a decision tree and forward chaining rules. The decision tree helps in displaying an easy to read algorithm of the system, it ensures more clarity and understanding of the expert system. The knowledge was represented as rules in the knowledge base used by the expert system shell.
Knowledge validation
Knowledge validation for this system was carried out by making sure all information gathered from the human expert was represented in the knowledge base. Also, we validated this system by making sure that the doctors in the consulted hospital tested the system. The two major validation processes ensured that the system is efficient and accurate. Finally, during the system testing the system got accurate and consistent solution.
Decision tree
The use of decision trees was adopted to map out the process of reasoning of the expert system. Decision tree structure.
The decision tree structure of this expert system is shown in Fig. 1.

Decision tree of the expert system.
In this structure, the tree in Fig. 1 is traversed starting from the root node (Decision) then if the user says yes then it traverse through to the node (Question 1?) else it traverse to Exit the system.
An extract of the well-formed XML document is listed below:
< ?xml version = “1.0” encoding = “UTF-8” standalone = “no”?>
<tree>
<title>Decision Tree< /title>
<description>An expert system to diagnose Sexually Transmitted diseases.
< /description>
<question id = “1”>
Do you have painless vaginal discharge
<rule target = “1.1”>Yes< /rule>
<rule target = “1.2”>No< /rule>
< /question>
<question id = “1.1”>
Do you experience difficulty when urinating?
<rule target = “1.1.1”>Yes< /rule>
<rule target = “1.1.2”>No< /rule>
< /question>
<question id = “1.1.2”>
Visit the hospital for a blood test...
< /question>
<question id = “1.2”>
Do you have Lower abdominal Pain?
<rule target = “1.2.1”>Yes< /rule>
<rule target = “1.2.2”>No< /rule>
< /question>
< /tree>
The decision tree was then represented as forward chaining rules. These rules are shown. They are represented in the JESS rule language.
(deftemplate question
(slot qnumber (default 0))
(slot response))
(deftemplate recommendation
(slot diagnosis))
(defrule diagnosis-one
(question (qnumber 1) (response yes))
(question (qnumber 3) (response yes))
(question (qnumber 5) (response yes))
=>
(assert (recommendation (diagnosis “You have been diagnosed to have Syphilis”))))
(defrule diagnosis-two
(question (qnumber 1) (response yes))
(question (qnumber 3) (response yes))
(question (qnumber 5) (response no))
=>
(assert (recommendation (diagnosis “See the Doctor or Visit the laboratory”))))
(defrule diagnosis-three
(question (qnumber 1) (response yes))
(question (qnumber 3) (response no))
=>
(assert (recommendation (diagnosis “See the Doctor or Visit the laboratory”))))
(defrule diagnosis-four
(question (qnumber 1) (response no))
(question (qnumber 2) (response yes))
(question (qnumber 3) (response yes))
(question (qnumber 7) (response yes))
=>
(assert (recommendation (diagnosis “You have been diagnosed to have Gonorrhea”))))
(defrule diagnosis-five
(question (qnumber 1) (response no))
(question (qnumber 2) (response yes))
(question (qnumber 3) (response yes))
(question (qnumber 7) (response no))
=>
(assert (recommendation (diagnosis “See the Doctor or Visit the laboratory”))))
(defrule diagnosis-six
(question (qnumber 1) (response no))
(question (qnumber 2) (response yes))
(question (qnumber 3) (response no))
(question (qnumber 4) (response yes))
(question (qnumber 7) (response yes))
=>
(assert (recommendation (diagnosis “You have been diagnosed to have Chalmydia”))))
(defrule diagnosis-seven
(question (qnumber 1) (response no))
(question (qnumber 2) (response yes))
(question (qnumber 3) (response no))
(question (qnumber 4) (response yes))
(question (qnumber 7) (response no))
=>
(assert (recommendation (diagnosis “See the Doctor or Visit the laboratory”))))
(defrule diagnosis-eight
(question (qnumber 1) (response no))
(question (qnumber 2) (response yes))
(question (qnumber 3) (response no))
(question (qnumber 4) (response no))
=>
(assert (recommendation (diagnosis “See the Doctor or Visit the laboratory”))))
(defrule diagnosis-nine
(question (qnumber 1) (response no))
(question (qnumber 2) (response no))
(question (qnumber 6) (response yes))
=>
(assert (recommendation (diagnosis “You have been diagnosed to have Herpes Genitals”))))
(defrule diagnosis-ten
(question (qnumber 1) (response no))
(question (qnumber 2) (response no))
(question (qnumber 6) (response no))
(question (qnumber 8) (response no))
=>
(assert (recommendation (diagnosis “See the Doctor or Visit the laboratory”))))
(defrule diagnosis-eleven
(question (qnumber 1) (response no))
(question (qnumber 2) (response no))
(question (qnumber 6) (response no))
(question (qnumber 8) (response yes))
=>
(assert (recommendation (diagnosis “You have been diagnosed to have Genital Warts”))))
;clear all facts, then re-assert fresh facts to test
(assert (question (qnumber 1) (response yes)))
(assert (question (qnumber 3) (response no)));;(assert (question (qnumber 5) (response yes)))
System architecture
The architecture of the implemented system is shown in Fig. 2.

System architecture.
The expert system we implement is composed of: User Interface Knowledge Base Program Algorithm Modify decision tree
The user interface is a graphical interface that allows the users to communicate with the expert system. The purpose of using the user interface is to ease the use of the system so that users find the system interesting to interact with. The user interface was developed using HTML5 and CSS3.
Knowledge base
The knowledge base comprises of the decision tree and the rules. The decision tree is created at the knowledge representation stage of the expert system. It is used to represent the information from human experts in a clear and understandable structure. The rules represented the knowledge stored in the decision trees in an efficient way for the JESS inference engine.
Use case diagram
The use case diagram of this system is shown in Fig. 3 showing the different scenarios or interactions between the system and the user.

Use case diagram of expert system.
The sequence diagram below shows the communication process between the user and the expert system. The communication process is initialized by the user. The user starts the application and communicates information with the expert system by the use of the user interface. The sequence diagram of the expert system is shown in Fig. 4.

Sequence diagram for the expert system.
The questions used in this paper were finalized and validated by medical practitioners. Our first stage of interaction was to interview the doctors and, based on these discussions we redesigned our questions and sent them for validation through e-mails. After their validation, the following set of the questions were summarized below: How many years have you been in the medical profession? What is your area of expertise in the medical felid? What is the percentage of patients that get diagnosed of sexually transmitted diseases in a month in your hospital? How is sexually transmitted diseases transmitted? What are the possible complications of sexually transmitted diseases? What are the symptoms of gonorrhea (in men)? What are the symptoms of gonorrhea (in female)? What are the symptoms of Chlamydia (in men)? What are the symptoms of Chlamydia (in women)? What are the symptoms of syphilis (in men)? What are the symptoms of syphilis (in women)? What are the symptoms of Genital warts (in men)? What are the symptoms of Genital warts (in women)? What are the symptoms of Herpes genitals (in men)? What are the symptoms of Herpes genitals (in women)?
After the validation of the questionnaire, the questionnaire was dispensed to other medical expertise who gave their views. We considered 5 and 10 doctors in major medical companies.
Analysis of data
Table 1 summarizes the questions asked in the expert system while Table 2 shows how the questions were analyzed. At the point of entry in to the expert system the users are asked part of these questions and are expected to answer by inputting yes or no. After asking all the relevant questions and inputting the correct answers the system displays the result of the diagnosis.
Analysis of data
Analysis of data
Evaluation of diagnosis in the expert
As summarized above, we prepared our interview questions and analyzed these questions. The decision tree based knowledge base was populated. For example the first rule states that a female user is asked Question 1 (Do you have painless vagina discharge?) As showed in the analysis of data table (Table 1). If the user inputs Yes then the next question would be Question 2 (Do you have lower abdominal pain) by the help of the decision tree which traverses to the next mapped question. The user is expected to input yes or no. However, if yes input was answered then the female user is asked the final question that is Question 3 (Do you experience difficulty when urinating?). Based on the above three questions, the system diagnosis Syphilis. The other questions are detailed below.
Implementation
The system was implemented using Java, JESS, HTML 5 and CSS. Screenshots are shown in Figs. 5–7.

Home page of the expert system.

Question page.

Diagnosis page.
This section covers discussion on this research work, conclusion and future works.
Discussion
In this paper we have implemented a modifiable expert system for diagnosing sexually transmitted diseases. Our contribution is in terms of the usage of decision tree approach instead of only the traditional IF THEN ELSE statements to perform its decision and the reusability of the system since it can be used for any decision that can be made with the strings of yes or no. In addition, the system can be modified and used to diagnose another disease or even detect the fault in a car etc. Finally, the system is implemented in an easily accessible manner, even across mobile platforms.
Comparison
From the literature review, it was observed that various techniques have been applied in building expert systems, one of which is the rule-based technique was used in building the system because it fits the nature of the problem.
While the studies handled independently, some STDs, our system ESSTD is quite encompassing [7, 22, 26]. Were built for diseases other than STDs [26] was built for diabetes mellitus, [22] for endocrine diseases and [23] for general diseases such as malaria and typhoid. Even the ones built for STDs are not all encompassing; [23] handles only male genital problems while [25] handles only gonorrhea. Our system ESSTD was built to diagnose several STDs including syphilis, gonorrhea, chlamydia, herpes genitals and genital warts.
The system can be used by both patients and physicians unlike [25] which is only for physicians. Moreover, it can be used to diagnose both male and female sexually transmitted diseases unlike [23] which is for diagnosing only male genital disorders.
The expert system is also web-based and accessible from anywhere rather than being desktop based. This helps to provide firsthand information to patients before visiting the hospital.
Conclusion
This report documents implementation of a modifiable expert system which is used to diagnose STD. It is an XML and rule based system that uses the decision tree structure and forward chaining rules to choosing relevant knowledge in the knowledge base. The use of the decision tree assisted the expert system to infer for the relevant questions and solutions. It is therefore suggested that, system developers that wish to create an expert system should make use of the decision tree structure approach. This is because it structures the knowledge used in the expert system.
In using this system, the system asks users questions in plain English language and users are expected to answer by clicking either yes or no. At the end of the systems questioning, it recommends a solution to the user from the knowledge base by the help of the decision tree structure. This expert system allows users to modify the knowledge in the knowledge base by add, deleting or updating its knowledge. The system implemented provides a consistent solution to the user as the knowledge in the system is valid as tested in the evaluation section. This expert system does not need users to be tutored before it can be used because it has a simple and user friendly interface.
Future works
We propose the following as future works that can be done to improve on this research:
To develop an expert system that uses other languages other than English language to diagnose patients. To develop an expert system that prescribes treatments to patients. To develop an expert system that explains the symptoms of patients in an explanation sub-system. To develop an expert system that adds new knowledge to any node in the XML document.
