Abstract
This study involved the development of an expert system for the pre-diagnosis of hypertension, diabetes mellitus type 2 and metabolic syndrome. The expert system has been developed using web technologies, PHP, Apache and MySQL with CLIPS tool; the expert system includes three algorithms designed by the authors, one for each disease. The objective of this study is to provide an expert system capable of performing a pre-diagnosis for early detection of hypertension, diabetes mellitus type 2 and metabolic syndrome. The methodology to build the system consists in associated risk factors, clinical variables diagnosis criteria based on World Health Organization standards in three algorithms and then develop a program that interacts with users, besides the expert system is compared with the existing expert systems in order to show its originality and innovation. The rules of systems are designed using CLIPS systems and the Architecture Apache, MySQL and PHP for the user interface and database. The system was validated by 72 patient(s) and 3 real doctors, the total result over 72 patient(s) is low risk 16.6 percent, moderate risk 30.5 percent, moderate high risk 13.8 percent, high risk 23.6 percent, very high risk 15.2 percent, and the doctors’ feedback was similar to that shown by the system. The number of rules to create the algorithms and the criteria used were adequate and sufficient to obtain the pre-diagnosis of each disease; in addition, the languages used to design and create the web application were stable. All users who used the system obtained similar results to those obtained by doctors.
Introduction
The last World Health Organization (WHO) report on non-communicable diseases (NCDs) 2013–2010 shows that chronic conditions are still a global phenomenon and prominent cause of death among the population. 1 NCD deaths are projected to increase from 38 million in 2012 to 52 million by 2030. These diseases are the leading causes of death worldwide and carry a huge cost that extends beyond health, trapping patient(s) in poverty, denying them a life of dignity, undermining workforce productivity and threatening economic prosperity. NCDs are also becoming an issue by creating enormous disparities of opportunity, wealth and power.
The primary purpose of this study is to develop an expert system based on rules for the pre-diagnosis of hypertension, diabetes mellitus type 2 (DMT2) and metabolic syndrome (MS), diseases that are considered NCD. The expert system offers to patients a tool for self-evaluation and to create awareness of their pathologies; this system is developed as a complementary and supportive tool, and in no case intends to replace the diagnosis of a physician.
The expert systems use human knowledge to solve problems that require a high degree of intelligence. These systems represent expert knowledge as a mathematical model or establishing a series of rules to be followed in order to later solve specific problems within a particular domain, such as in Medicine for the diagnosis of diseases. Artificial intelligence (AI) is a field of computer science that aims to mimic human thought processes, learning capacity and knowledge storage; the expert systems are part of AI, and in recent times, they are being developed to provide health professionals with support tools for fast and effective diagnosis.2 –4
The development of the expert system is carried out through the CLIPS (C Language Integrated Production System); this tool focuses on the development of rules for expert systems. The user interface for data collection is done through a web application which involves the use of Apache, as a Web server, MySQL as a database and PHP as a language for the implementation of the web system.
The expert system included the design of algorithms that uses forward chaining – associating a series of rules and facts to obtain a pre-diagnosis for each disease. Nowadays, there is not an expert system on the Internet that integrates arterial hypertension (AH), DMT2 and the MS in a single system and that this is easily accessible to patient(s) associating risk factors (RF) and clinical variables using the WHO diagnostics criteria. The diagnosis methodology consists of identifying the RF for these three diseases and then looking for points in common between them, associating RF and the clinical variables, blood pressure and glycemic levels.
Theoretical framework
Today, health information technology (HIT) and support systems have been implemented in several hospitals and health centers to enable decision-making regarding treatment of diseases. This technology is promoted with promises to improve patient safety and workflow, to increase efficiency and to advance standardization of clinical practices. The results of the implementation of these systems observed in five hospitals during 2011–2016 indicate that both patients and medical staff have benefited with good results. 5
The clinical decision support systems are one of the first successful applications focusing primarily on the diagnosis of a patient’s condition given his symptoms and demographic information. 6 The accumulation of knowledge about a case under scrutiny allows for solving the problem or helps decide how to complement the information to complete the check-up just as in medical examinations. 2 The MYCIN is one of the earliest rule-based expert system developed by Feigenbaum, Buchanan and Ted Shortliffe in 1970 for the purpose of diagnosis of infectious diseases as support systems for making decisions. A clinical decision support system in healthcare could be based on machine learning for the diagnosis and treatment of respiratory diseases, such as asthma and chronic obstructive pulmonary disease. 7 This system involved the empirical pulmonology study of a representative sample (n = 132) in an attempt to identify the major factors that contribute to the diagnosis of these diseases. Machine learning results show that in the case of chronic obstructive pulmonary disease, Random Forest classifier outperforms other techniques with 97.7 percent precision, while the most prominent attributes for diagnosis are smoking, forced expiratory volume 1, age and forced vital capacity. In the case of asthma, the best precision was at 80.3 percent. The system for the early diagnosis of sleep apnea developed for Android assesses mobility based on three decision rules and diagnosis algorithms. 8 Another system could be based on fuzzy rules to diagnose spinal cord problems which allows for analyzing the patient’s medical history, symptoms and possible diagnosis, which are five: “Red flag,” “Spinal stenosis,” “Scoliosis Lordosis kyphosis,” “Mechanical” and “Spinal disc herniation.” 9 In the study by Osamor et al., 10 a successful expert system for the diagnosis of tuberculosis was presented; its objective was to automate the pre-laboratory screening process against tuberculosis infection to aid diagnosis and make it fast and accessible to the public via the Internet; its architecture consists of a rule base, knowledge base and patient database. These units interact with the inference engine, which receives patients’ data through the Internet via a user interface.
The following expert systems are based on rules – the Type 2 Diabetes: Know your risk 11 and Diabetes risk calculator. 12 Both are free online and available for Android operating system; its main objective is to inform patient(s) about their risk of DMT2. The expert system performs a quick pre-diagnosis using the RF; both systems have seven rules, and at the end of completing the questions, the systems show the result. Although the system is fairly easy to use and the selected rules are RF for DMT2, the system lacks the inclusion of blood glucose levels to obtain a more accurate diagnosis. The MEDSCAPE website offers several expert systems based on rules to help professionals through risk calculators; one of them is Metabolic Syndrome Criteria 13 that is based on the American Heart Association and the National Heart Lung and Blood Institute to perform the pre-diagnosis. The system shows five rules of RF of the MS and through a table performs the diagnosis depending on how many RF a person who is using it has. The system does not allow introducing levels of glycemia and blood pressure to make a more accurate diagnosis. The Android-based application 14 is an expert system based on rules that mix clinical variables such as systolic blood pressure (SBP) with modifiable risk factors (MF) such as total cholesterol (TC) indexes with non-modifiable factors (NMF) such as age and sex. The result of incidence in heart diseases such as coronary heart disease, myocardial infarction, stroke and cardiovascular disease, although it is an interesting expert system, does not indicate information on the diagnostic criteria used by the authors for its development.
The expert system presented in this article is developed using the tool CLIPS (2020). 15 CLIPS allows for handling a broad array of knowledge through rules and facts. A decision-making algorithm that uses forward chaining is created to interlace the different rules of the expert system by means of RF, clinical variables and diagnosis criteria.
Method
The methodology to obtain the pre-diagnosis is based on the construction of three algorithms based on rules: algorithm for hypertension, algorithm for DMT2 and an algorithm for MS. The acquisition of knowledge to build the algorithms and the rules of the expert system is carried out by means of known data on AH, DMT2 and MS; these data are RF, clinical variables and diagnostic criteria based on WHO standards. The algorithms have been developed by the authors, and the rules are implemented using the CLIPS tool; the total rules for the entire system are 63 rules – 28 for hypertension, 19 for DMT2 and 16 for MS. The user interface is developed using the Architecture AMP (Apache, MySQL and PHP); this combination is one of the most used worldwide to build web systems. Patient(s)’s data collection is done through the user interface as a web application and is also available on the Internet for easy access. Patient(s)’s data will be stored in the database and then analyzed by means of the rules designed in the algorithms. The system was evaluated with 72 patient(s) (patients) who completed the information related to their RF and clinical variables. This study was carried over a period of 2 weeks. For the measurement of the clinical variables, patient(s) will need the assistance of devices for measuring their blood pressure and glycemic levels. In addition, patients should know their RF well. The system must show a diagnostic in 100 percent of the cases. In addition, the information of the 72 patients was examined by three doctors, arriving at a diagnosis in each case. The objective of this sample was to verify whether the system could make an early evaluation of the disease with the amount of rules and the criteria used in the algorithms of the expert system and then verify its effectiveness with the opinion of doctors.
RF
RF represent the variables that can trigger each of the diseases. By definition, RF are associated with habits and physiological factors that can cause chronic diseases. RF are divided into two groups: MF and NMF. NMF are related to the metabolic/physiological characteristics of a person, for example, sex and age. MF are patient(s)’s habits or behavior, for example, obesity, physical inactivity (PHY) and stress (ST). Information on the RF is obtained by means of questions to each person and examinations, such as stress level, body mass index (BMI), microalbuminuria (MI) exam, for example, ¿Are you Smoker? Yes or Not ¿What is your BMI? > 30 ¿Is your Microlabuminuria exam altered? Yes or Not
The values “1” and “0” will be assigned to each RF depending on it being affirmative or negative for each disease. Once all RFs have been obtained, they must be added as follows in Equation (1)
Clinical variables
Clinical variables are indicators obtained by means of known medical procedures. For the construction of algorithms, the clinical variables are as follows:
For AH: Blood Pressure Levels For DMT2: Blood sugar levels or glycemia
Diagnosis criteria
In this section, diagnostic criteria are selected by associating RF with clinical variables based on the literature available for hypertension, DMT2 and MS. For hypertension is used the World Health Organization 1 criteria, for DMT2 the criteria of World Health Organization 16 and for MS is used the Alberti and Zimmet 17 and Zimmet et al.; 18 all these criteria are based on WHO standards.1,13,16 –19
Development of the expert system
The expert system is developed by means of three diagnostic algorithms; these algorithms are based on rules, and the rules are built with CLIPS system. Then the expert system uses a user interface based on AMP systems accessible via Internet. The expert system consists of 63 rules – 28 for hypertension, 19 for DMT2 and 16 for MS. The following shows an example of rules syntax developed with CLIPS for obesity:
(defrule determine-FRobesity-state “” (not (working-state salud ?)) => (if (Yes-or-No-p “Central Obesity: Men > 90cm, Women > 85cm (si/no)?”) Then (if (Yes-or-No-p “High BMI > 30 (Yes/No)?”) then (assert (You have 2 risk factors associated with obesity)) (assert (risk-factor common)) else (assert (risk-factor common))) else (assert (risk-factor common))))
Hypertension algorithm design
The construction of the diagnostic algorithm is based on the analysis of RF and clinical variables available in previous stuides 20 where the RF are classified into NMF and MF. The clinical variables for AH are blood pressure levels. Table 1 shows the RF and clinical variables.
Risk factors and clinical variables for AH.
AH: arterial hypertension; FH: family history; SM: smoker; TC: total cholesterol; BMI: body mass index; PHY: physical inactivity; ST: stress; SBP: systolic blood pressure; DBP: diastolic blood pressure.
The RF presented in Table 1 can be detailed by means of the following equations
Non-modifiable factors for AH (NMF)
Modifiable factors for AH (MF)
The result is given by the sum of the RF (NFM+MF). The values “1” and “0” will be assigned to each MF if they are affirmative or negative for the disease, respectively. The rules are created as follows:
If BMI > 30, then = 0;
If BMI < 30, then = 1.
Thereafter, if the total sum results with a value greater than 3, the patient is considered to be at high risk of AH. Once the total number of risk factor is obtained, it is necessary to associate them with the clinical variable for AH.: The criteria for diagnosing blood pressure levels are as follows:
Blood pressure levels (SBP/diastolic blood pressure (DBP)):
Normal: 120/80–129/84 mmHg;
High normal: 130/85–139/89 mmHg;
HT stage 1: 140/90–159/99 mmHg;
HT stage 2: 160/100–179/109 mmHg;
HT stage 3: ⩾ 180/110 mmHg.
Figure 1 shows the algorithm for AH associating risk factor and clinical variables; also the algorithm includes the pre-diagnosis of isolated systolic hypertension. The algorithm for AH has 28 rules, an example of rule gets with pre-diagnosis algorithm is:
If RF > 3 and SBP/DBP = 145/92 then: High Risk of AH in grade 1.

AH algorithm.
In the example case, the system response is as follows:
High risk of AH, the ranges are AH grade 1 and also it has 3 or more risk factors, this could be harmful to your health, please contact your physician for treatment of HTA
DMT2 algorithm design
The algorithm for DMT2 is elaborated in a similar form that the AH algorithm associating RF and clinical variables based on the ALAD Guidelines 21 and standards of medical care for type 2 diabetes in China. 22 The RF and clinical variables are shown in Table 2.
Risk factors and clinical variables for DMT2.
DMT2: diabetes mellitus type 2; FH: family history; TRI: triglyceride levels; TC: total cholesterol; BMI: body mass index; PHY: physical inactivity; CO: central obesity; HDL: high-density lipoprotein; CHO: cholesterol; IFG: impaired fasting glucose; GI: glucose intolerance.
The RF presented in Table 2 can be detailed by means of the following equations
Non-Modifiable Factors for DMT2 (NMF)
Modifiable Factors for DMT2 (MF)
The result is given by the sum of the RF (MFN+MF). The values “1” and “0” will be assigned to each MF if they are affirmative or negative for the disease, respectively. Once the total number of risk factor is obtained, it is necessary to associate them with the clinical variable for DMT2. The criteria for diagnosing glycemic levels are as follows:
Diabetes Diagnosis: Fasting and Postprandial (mg/dL):
Normal: < 110 and/or < 140;
Impaired fasting glucose(IFG): 110–125 and/or N/A;
Glucose intolerance (GI): N/A and/or 140–199;
Diabetes mellitus (DM) < 126 and/or < 200.
In the Figure 2 shows the construction of the algorithm for DMT2 developed by employing 19 rules. An example of rule gets with pre-diagnosis algorithm is:
If RF > 3 and IFG/GI = 127/210 then: Very High Risk of DMT2.

DMT2 algorithm.
In this case, the system response is as follows:
Very high risk of DMT2, altered glycemia levels and presence of risk factors, all indicators show that you have DMT2, you should consult your physician
MS algorithm design
This algorithm is built based on information from previous studies.1,16,19,21,23 The algorithm associated with the common risk factors (CRF) and mandatory risk factors (MRF) is shown in Table 3 and in Equations (6) and (7)
Risk factors for SM.
SM: smoker; MS: metabolic syndrome; DM: diabetes mellitus; IFG: impaired fasting glucose; GI: glucose intolerance; IR: insulin resistance; AH: arterial hypertension; cHDL: cholesterol high-density lipoprotein; BMI: body mass index; TRI: triglyceride levels; CO: central obesity; MI: microalbuminuria.
The result is given by the sum of the RF (MRF and CRF) with the diagnostic criteria shown in Table 3. The values “1” and “0” will be assigned to each RF if they are affirmative or negative for the disease, respectively. Once the total number of risk factor is obtained, it is necessary to associate them with the criteria of diagnosis.
At least one mandatory RF:
IFG;
GI;
Diabetes and/or insulin resistance (IR).
At least two common RF:
High triglycerides (TRI);
Central obesity (CO);
Cholesterol high-density lipoprotein (cHDL);
BMI;
Blood pressure (even if normal with clinical history of HT);
MI.
With all this information, the diagnostic algorithm for the MS is constructed into the Figure 3; this algorithm has 16 rules.

MS algorithm.
User interface implementation
The user interface is implemented in a web environment for easy access by users through computers, mobile phones and tablets. The web environment selected for implementation is AMP (Apache, MySQL and PHP); where AMP represents the fusion of PHP, Apache and MySQL, and the development of expert system rules are designed and implemented using CLIPS and based on the algorithms for AM, DMT2 and MS.
Currently, a website typically consists of three equally crucial components; a web server, a database and a programming language well suited for web programming. The original expansion of the acronym and version are as follows:
Apache, the web server: 2.2.15 version;
MySQL, the database management system (or database server): 5.1.73 version;
PHP, the programming Language: 5.3.3 version.
The patient can select three options: AH, DMT2 or MS. Once the disease is selected, the system starts to collect the information through different questions about RF; then the system asks to enter clinical variables such as blood pressure or blood glucose levels, and once all these information are obtained, it will be stored into the database (see Table 4), and the system is capable of making the diagnosis based on all the data submitted (see Figure 4).
Database.
IFG: impaired fasting glucose; GI: glucose intolerance.

User interface.
Results
This section analyses the results of the dataset run through algorithmic models. The sample contains 72 entries corresponding to patients, and 62 rules of expert system are verified.
Each time a person uses the system, he is able to show a result based on the algorithms designed in this study. The system was used by 72 patient(s) for 2 weeks through the web application on the Internet; most of these patient(s) know their RF well and through devices for the measurement of blood glucose and blood pressure, they know their clinical variables. On the total of 72 patient(s), 30 performed data entry for hypertension, 30 for DMT2 and 12 for MS. The system in each case showed a result. Each of the results was validated by three doctors obtaining similar diagnoses. Table 5 shows the comparison of the diagnosis of the system with that of the doctor on 10 cases.
Expert system validation.
MS: metabolic syndrome; DMT2: diabetes mellitus type 2; IFG: impaired fasting glucose; GI: glucose intolerance; AH: arterial hypertension; OGTT: oral glucose tolerance test.
For hypertension, the results were: Low Risk, 20%; Moderate Risk, 33.3%; Moderate High Risk, 26.6%; High Risk, 13.3%; and Very High Risk, 6.6%. In the case of DMT2, the results were: Low Risk, 10%; Moderate Risk, 26.6%; Moderate High Risk, 6.6%; High Risk, 33.3%; and Very High Risk, 23.3%. For the MS, the results were: Low Risk, 25%; Moderate Risk, 33.3%; High Risk, 25%; and Very High Risk, 16.6%. The results when contrasted with the doctors were very similar, but all indicate that in cases where there are no RF, but blood pressure or blood glucose levels are above normal, more analysis should be done on patients. However, it is proved that based on the results, the expert system proved to be a good consultative tool for the patient(s) who tested it. The total result over 72 patients is: Low Risk, 16.6%; Moderate Risk, 30.5%; Moderate High Risk, 13.8%; High Risk, 23.6%; and Very High Risk, 15.2%.”.
Discussion
The medical expert systems based on the rules reviewed in this research only use RF and symptoms of the diseases, none of these systems have used clinical variables such as glycemia for DMT2 or blood pressure levels in the case of hypertension; therefore, the diagnosis is only partial. To properly conclude the clinical diagnosis, it is necessary to include the clinical variables. Neither the systems consulted have grouped three diseases such as hypertension, DMT2 and the MS in a single system of diagnosis. In addition, the expert system has been compared against four existing applications available on the Internet: Cardiac Risk Calculator (Pre-Diagnosis Diabetes), Know You Risk (Pre-Diagnosis Diabetes), Diabetes Risk Calculator (Pre-Diagnosis of Cardiac Diseases) and Metabolic Syndrome Criteria ( Pre-diagnosis for MS). Of all the expert systems reviewed, these expert systems are most closely resemble the development of the expert system carried out in this research; however, only three of them offer the possibility of making a diagnosis using RF and clinical variables, and only one incorporates clinical variables but partially. In addition, only one of all the systems indicates which were the diagnostic criteria used. The methodology for the development of the rules of the expert system consists of identifying and then associating the RF with clinical variables. Once all these variables are obtained, they are compared against the WHO diagnostic criteria. With all these variables, three algorithms are constructed to achieve the pre-diagnosis of the diseases. These algorithms are programmed based on CLIPS; this language was used since it is very easy to perform the programming of expert systems with it. The number of rules in each of the algorithms depends on the number of RF for each disease, in this case, they were sufficient to obtain a pre-diagnosis very close to that of a physician.
Conclusion
In this study, an expert system for the pre-diagnosis of AH, DTM2 and MS was developed successfully. The purpose of this system was to inform patient(s) their health status by means of a quick assessment, so they could contact their physicians and start treatment at the right time.
The expert system was conceived as a support tool for growing awareness of AH, DMT2 and MS, but not as a substitute to physicians and health professionals in any case. To create this system, associations between RF and clinical variables were established. To select and correlate risk factor, clinical variables and diagnosis criteria, a literature review was conducted and criteria established by WHO was also taken into account.
The rules were sufficient to reach pre-diagnosis, which were validated using the criteria established by WHO. The development tool CLIPS was useful to relate the rules and diagnoses of the expert system, but forward chaining has its limitations and does not show the programming errors, which can be challenging for the programmer. It is confirmed that the consulted literature only considers symptoms to establish a diagnosis, which are very imprecise for asymptomatic conditions. In addition, there are not studies about expert systems that group three chronic diseases or propose a diagnosis method based on patient(s)’s RF. The RF used are sufficient to obtain a precise diagnosis; some RF such as alcohol intake, ethnic group and social risk have not been taken into account in this study.
Overall, the expert systems available on the Internet for free for the diagnosis of AH, DMT2 and MS use few RF only and make a partial diagnoses because they do not include clinical variables such as glycemic values and blood pressure levels in the analysis.
Finally, the validation of the expert system for these three chronic diseases was completely successful. All the patient(s) who testing the expert system obtained a result, besides these results when being evaluated by three doctors, similar diagnoses were reached they only indicate that in the case of patient(s) with high glucose levels and high blood pressure that do not have factors of risk should be reassessed and should be monitored on them because they may have other diseases. In all cases, doctors conclude that it is a good tool to raise awareness of chronic diseases such as hypertension and diabetes. The patient(s) who used the system also said that the user interface was easy to use and intuitive. The AMP-based web application was easy to implement since there is a lot of information about this technology. The WHO diagnostic criteria were used because of its exhaustive information and they being most widely accepted; however, this expert system can be implemented for other diagnostic criteria such as National Cholesterol Education Program Third Adult Treatment Panel (ATP III) or the International Diabetes Federation (IDF)
In future, it is expected that this application will be available for Android and IOS (Apple) in order to reach a larger number of patient(s). Furthermore, this expert system could become scalable, that is, to modify the diagnosis algorithm so it covers other non-communicable diseases such as chronic kidney conditions, hyperthyroidism and hypothyroidism, among others.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship and/or publication of this article: This work was supported by Proyecto Fortalecimiento USACH USA1799_UC123012 and Vicerrectoría de Investigación, Desarrollo e Innovación of the Universidad de Santiago de Chile, Chile.
