Abstract
Objectives
Maternal complications are health challenges linked to pregnancy, encompassing conditions like gestational diabetes, maternal sepsis, sexually transmitted diseases, obesity, anemia, urinary tract infections, hypertension, and heart disease. The diagnosis of common pregnancy complications is challenging due to the similarity in signs and symptoms with general pregnancy indicators, especially in settings with scarce resources where access to healthcare professionals, diagnostic tools, and patient record management is limited. This paper presents a rule-based expert system tailored for diagnosing three prevalent maternal complications: preeclampsia, gestational diabetes mellitus (GDM), and maternal sepsis.
Methods
The risk factors associated with each disease were identified from various sources, including local health facilities and literature reviews. Attributes and rules were then formulated for diagnosing the disease, with a Mamdani-style fuzzy inference system serving as the inference engine. To enhance usability and accessibility, a web-based user interface has been also developed for the expert system. This interface allows users to interact with the system seamlessly, making it easy for them to input relevant information and obtain accurate disease diagnose.
Results
The proposed expert system demonstrated a 94% accuracy rate in identifying the three maternal complications (preeclampsia, GDM, and maternal sepsis) using a set of risk factors. The system was deployed to a custom-designed web-based user interface to improve ease of use.
Conclusions
With the potential to support health services provided during antenatal care visits and improve pregnant women's health outcomes, this system can be a significant advancement in low-resource setting maternal healthcare.
Keywords
Introduction
Complications during pregnancy may include physical and mental situations that distress the health of the mother or the baby. The pregnancy-related morbidities include gestational diabetes, maternal sepsis, sexually transmitted diseases (STDs), obesity, anemia, urinary tract infections, hypertension, and heart disease.1–3 Hypertension commonly occurs in the course of pregnancy and requires prompt recognition and treatment. There are three types of hypertensive disorders during pregnancy. These include eclampsia and preeclampsia, chronic hypertension, and preeclampsia superimposed on chronic hypertension. Globally, preeclampsia affects 2–8% of all pregnancies, and it is also the cause of maternal death for about 10% to 15% of maternal mortality due to complications. Eclampsia is defined as a severe complication of preeclampsia. 1 Gestational diabetes mellitus (GDM) is common in pregnancy; brings to bear damage on both mothers and newborns. It is a situation of glucose intolerance with first recognition during pregnancy that is not clearly overt diabetes. 4 GDM arises when the pancreas does not produce enough insulin or the produced insulin cannot be used efficiently by the body. 5 It is identified during the second or third trimester of pregnancy as a result of the placental hormone playing an important role in the adverse effect on glucose metabolism. 6 In the world, around 21.3 million pregnancies are related to hyperglycemia, and out of such prominence; around 18.4 million pregnancies are attributed to GDM. 7 The pooled prevalence of GDM was 13.61%, and it was 14.28% in the sub-Saharan African region. 8 In Ethiopia, diabetes mellitus is recognized as one of the major non-communicable diseases, and the magnitude of GDM among pregnant mothers is not well studied. 9 Sepsis results from a dysregulated host response to infection resulting in organ damage, and virtually any organ system can be affected. 10 Maternal sepsis is when infection and organ dysfunction occur. 11 Maternal sepsis is the main cause of maternal mortality accounting for 11% of maternal deaths worldwide, and it is the third most common direct cause of maternal death. 12 STDs are other diseases that are highly prevalent among pregnant women in developing countries and cause significant maternal and perinatal morbidity. There are more than 30 different sexually transmissible bacteria, viruses, and parasites. 3
Maternal mortality is attributed to low quality of care, lack of well-trained healthcare professionals, insecurity, and scarce resources. It is estimated that about 15% of women in the world develop a potentially severe complication during pregnancy. 13 Pregnancy-related complications distress around 50 million women in low- and middle-income countries (LMICs) and are allied with severe maternal morbidity and mortality. 14 Obstetric complications during pregnancy include15–22: hypertension and heart disease, 23 GDM, 16 maternal sepsis, STDs, 17 obesity, and anemia which occurs when a low number of red blood cells are circulating in the body and urinary tract infection.16,17
Antenatal care is a care directed towards the maintenance of healthy pregnancy outcomes through the accurate and consistent observation of the principles which are important in maternal and child health. 24 High-quality care in the course of pregnancy is an indispensable section of the reproductive, maternal, newborn, and child health range of care. Most health problems in pregnant women can be prevented, discovered, and treated by healthcare professionals during antenatal care visits (ANC). 25 The World Health Organization offers evidence-informed recommendations for routine antenatal care, emphasizing a person-centered approach to health and well-being, encompassing the diverse aspects of ANC healthcare practices. 26 The guideline applies universally to pregnant women and adolescent girls in any healthcare or community setting, along with their unborn fetuses and newborns, aligning with a human rights-based perspective.
Over two-thirds (around 69%) of pregnant women in Africa have at least one ANC contact. 27 Pregnant women in developing countries are less likely to receive adequate healthcare due to the lack of skilled health workers and other related factors. Postponements in recognition of risk factors, escalation of care, delays in considering clinical cautions, providing correct diagnoses and employing optimal treatment are highly related to preventable maternal morbidity and mortality. 28
Maternal disease diagnostic error is a common life-threatening condition and the cause of maternal mortality, especially in resource-limited areas. Since most of the signs and symptoms of pregnancy are similar to the signs and symptoms of complications associated with pregnancy including maternal sepsis and gestational diabetes, proper diagnosis is challenging in resource-limited areas healthcare professionals are in short supply in developing countries. The available healthcare professionals typically deal with a large number of patients, and some of the patients’ conditions are frequently difficult to diagnose due to potentially difficult clinical presentations. Patients may also miss the diagnosis, which means they have a history of missing follow-ups to receive any form of diagnosis, or the patient may lack early diagnosis, which can be represented as a delayed diagnosis. They may also experience incorrect diagnosis, which results in a lack of access to correct diagnosis at the appropriate time.
Misdiagnosis may also occur due to various factors such as inadequate access to skilled healthcare professionals and limited diagnostic resources. Broader health system constraints, such as shortages in human resources, further exacerbate the challenges, hindering timely and accurate maternal health assessments. Additionally, issues related to the distribution of essential commodities, including diagnostic supplies, pose significant hurdles in ensuring comprehensive and accessible maternal healthcare, particularly in resource-constrained settings.29,30
Computerized expert systems have been proposed in the literature to reduce the cognitive burden on physicians while also decreasing diagnostic errors for a variety of health problems. Maternal disease diagnosis expert systems can also help reduce maternal complications and DEs. The purpose of this study was to develop a rule-based expert system for the diagnosis of maternal complications during pregnancy.
Methods
In this study, first the three prior maternal complications during pregnancy in Ethiopia were identified. The three prevalent obstetric complications were selected based on the frequency of incidence and difficulty in diagnosis. Identification of risk factors, symptoms, clinical findings, and treatment procedures was then evaluated from resources including books, literature, and disease guidelines. Each of the risk factors (signs and symptoms) was checked for the Ethiopian population based on previous research works. Then conceptualizing of the acquired knowledge to make the relation between each disease and their corresponding features definitely explicable was performed followed by formalization of the concepts into if-then rules. Finally, the implementation of the rules into a computer program and testing the designed expert system was conducted. This paper is based on the thesis 31 which has been published on the Jimma University institutional website.
The selection of risk factors
To identify the major risk factors of preeclampsia for the Ethiopian population, a thorough review of previous literature on the prevalence of risk factors in different regions of Ethiopia was conducted. The adjusted odds ratio (AOR) was first determined for each factor and then then mean was calculated to determine the most significant risk factor. Risk factors with an AOR less than one were deemed to have no effect on preeclampsia. This approach allowed to identify the most impactful risk factors specific to the Ethiopian population, providing valuable insights for improving maternal healthcare in the region.
Similar procedures were followed to identify risk factors for GDM for the population of Ethiopia. The three major risk factors were found to be obesity, family history of diabetes, and previous cesarean section.
Identification of attributes of each diseases
The study utilized two distinct approaches for developing input and output parameters. The first approach involved determining the ranges of input variables, such as blood pressure, inter-pregnancy interval, age, and body mass index, for the fuzzy set by reviewing literature and calculating the AOR specific to the Ethiopian population. The second approach involved obtaining input variable ranges from clinical practice guidelines and experts. Table 1 outlines the four risk criteria, their clinical ranges, and the defined fuzzy sets. Through these two approaches, the researchers were able to establish comprehensive and accurate input and output parameters for the fuzzy inference system, contributing to the system's overall effectiveness in diagnosing maternal complications during pregnancy.
Risk criteria and their corresponding ranges and fuzzy sets.
BMI: body mass index.
To determine the number of fuzzy rules required for the expert system, a universal formula was utilized (Equation (1)). This approach ensured that the expert system had an appropriate number of rules to accurately diagnose maternal complications during pregnancy, contributing to its overall efficacy and reliability.
In the above formula “R” is the total number of fuzzy rules required, “m” is the total input linguistic words (i.e. high, normal, and low), and “n” is the total input variables. The total number of fuzzy rules for classifying pregnancy complications is 27. Table 2 demonstrates the fuzzy rules employed for assessing complications.
Fuzzy rules for assessing complications.
BMI: body mass index.
A total of 17 attributes or input variables were used in order to diagnose preeclampsia. The variables were classified into two categories namely related and unrelated symptoms; the unrelated symptoms were also sub-grouped into two assessment types (i.e. risk and prescreening) the related symptoms are laboratory investigations. Table 3 illustrates the input variables to effectively diagnose preeclampsia and the type of data of each input variable was classified as nominal data (yes, no) and discrete data (numerical).
Attributes of diagnosing preeclampsia.
A total of 12 attributes or input variables were used in order to diagnose GDM. The variables were classified into two categories namely related and unrelated symptoms; the unrelated symptoms were also sub-grouped into two assessment types (i.e. risk and prescreening) and the related symptoms were laboratory investigations. Table 4 illustrates the input variables to effectively diagnose GDM, and the type of data of each input variable was classified as nominal data (yes, no) and discrete data (numerical).
Attributes of diagnosing GDM.
GDM: gestational diabetes mellitus.
A total of 14 attributes or input variables were used in order to diagnose maternal sepsis. The variables were classified into two categories namely related and unrelated symptoms; the unrelated symptoms were also sub-grouped into two assessment types (i.e. risk and prescreening) and the related symptoms are laboratory investigations. Table 5 illustrates the input variables to effectively diagnose maternal sepsis, and the type of data of each input variable was classified as nominal data (yes, no) and discrete data (numerical).
Attributes of diagnosing maternal sepsis.
A total number of 81 rules were implemented in this study. Conflict resolution method was used to decide on which rule to fire when more than one rule can be fired in a given cycle. The selected conflict resolution method was to fire the rule that uses the data most recently entered in the database. The method relies on time tags involved in each fact in the database. In the conflict set, the expert system first fires the rule whose antecedent uses the data most recently added to the database.
Rule-based expert system
A rule-based expert system is a type of artificial intelligence that uses a knowledge base and a specified set of rules to mimic human decision-making skill. By using an inference engine to apply these principles to the facts at hand, the system is able to make decisions and draw conclusions that are comparable to those of human experts. This approach works especially well in fields like medical diagnosis or troubleshooting where expert knowledge can be clearly defined through rules. This allows the system to offer recommendations or solutions based on the body of acquired experience.
Rule-based expert systems can employ different inference engines, including fuzzy logic and Bayesian inference. Fuzzy inference was used in this paper over a Bayesian counterpart because of the difficulties in quantifying expert knowledge, particularly in situations involving imprecise or ambiguous data. A fuzzy inference engine performs well when dealing with ambiguity and imprecision, whereas Bayesian inference depends on precise prior probability distributions, which might be challenging to create in some circumstances. Fuzzy logic enables the management of ambiguous or unclear data using fuzzy sets and linguistic variables, as well as the representation of knowledge in linguistic terms. The flexibility of a fuzzy inference engine allows for more effective interpretation and reasoning with uncertain data in the specific context of diagnosing maternal complications during pregnancy, where factors are complex and difficult to precisely quantify. This leads to valuable insights and improved diagnostic accuracy compared to a rigid Bayesian approach.32,33
The inference engine was designed using fuzzy sets and crisp inputs to determine input membership degrees in a Mamdani-style fuzzy inference system. This system involves fuzzification, rule evaluation, aggregation, and defuzzification. The Mamdani-style approach was chosen for its human-like intuitive representation of expertise.
34
A triangular membership function with three values (a, b, c) characterized the fuzzy set, providing efficient memory usage and response time. In this function, “x” denotes the input variable, “a” and “c” are endpoints, and “b” is the peak point. The function is expressed in Equation (2)

Steps of the proposed rule-based expert system development.
User interface (Mom Care app)
The developed “Mom Care” application is a web-based platform developed using the Django web framework. The framework is a high-level Python web framework that supports the “asgiref” standard for Python asynchronous web applications, enabling communication between the browser and the server. Users are required to log in to access the Mom Care app, and input their signs and symptoms in the “patient registration” input provided. This list is then sent to the backend server via the http service. In the backend, a fuzzy logic algorithm and rule-based system have been designed to predict the risk of three diseases through the “risk evaluation” input, and to diagnose the incidence of diseases based on a large rule of symptoms-diseases through the “diagnosis” input. The algorithm outputs the prediction as a list of risks and diseases, along with corresponding recommendations. This output is then sent back to the Mom Care app, which presents the user with a text file containing a list of diseases with their corresponding risks and recommendations. Users can also click on the disease name (preeclampsia, GDM, and Sepsis) on the web app to access further details on each disease.
The working principle of the developed system is represented as follows. The user logs in to the mom care app. Patient registration, signs, and symptoms are entered and submitted on the homepage of the web app. History is taken and a list of signs and symptoms is sent to the backend server using the http service. In the backend, the list is fed to a fuzzy logic algorithm and the rule-based system that has been designed to predict the risk of the three diseases and predict the incidence of them based on a large rule of symptoms-diseases. The algorithm outputs the prediction as a list of risks and diseases with their corresponding recommendations. This output of prediction is then sent back to the web app. The app reads the response and presents it to the user as a text file that combined a list of diseases with the corresponding risk and treatment recommendations. Figure 2 presents the general working principle of the designed system.

Working principle of the developed system.
Results
Results of the expert system
The results of output membership activity and aggregated membership function of high-risk, moderate-risk, and low-risk pregnancy complications are demonstrated in Figure 3. This function represents the combination of rules used to make a decision. The blue colors represent an area of the aggregated membership function, red indicates a high risk, yellow indicates a moderate risk, and green represents a lower risk. The x-axis of each graph shows the range of the universal variables (inputs), while the y-axis depicts the fuzzy membership values.

Result of output and aggregated membership function of (a) high-risk pregnancy, (b) moderate-risk pregnancy, and (c) low-risk pregnancy.
Figure 4 illustrates the results of the output membership activity and aggregated membership functions for high-risk, moderate-risk, and low-risk hypertension (red color indicates a high risk, yellow a moderate risk, and green a low-risk).

Result of output and aggregated membership function of (a) high-risk hypertension, (b) moderate-risk hypertension, and (c) low-risk hypertension.
Various performance metrics were employed to evaluate the model's effectiveness, including classification accuracy, precision, and recall. A confusion matrix (Table 6) was utilized to assess the system's performance across various classes. The results indicated that an accuracy rate of 94% was achieved.
Confusion matrix results.
GDM: gestational diabetes mellitus
Results of the developed web-based user interface system
To utilize the features offered by the system, the user is prompted to enter a valid username and password. As illustrated in Figure 5, upon successful authentication, the registration interface displayed in Figure 6 appears. This interface is intended to gather all relevant patient data. Upon successful login, the physician can proceed to register the patient by providing relevant signs and symptoms through the patient registration interface as depicted in Figure 7. Then reports including decisions made can be generated as demonstrated in Figure 8. Figure 9 presents the interface that can be used to generate risk information based on previously registered data. Figure 10 presents the interface that can be used to generate diagnosis results based on previously registered data and assessed risks.

The log in page of the system.

The home screen of the designed system.

The history taking section of the system.

The patient record section.

The risk analyzer section of the system.

The diagnosis maker section of the system.
Discussion
Developing countries are currently facing the challenge of insufficient numbers of qualified healthcare professionals and limited patient record-keeping systems. This leads to a lack of quality and a limited range of medical services available to patients, resulting in a higher rate of diagnostic errors. A study published in the journal BMJ Quality & Safety found that the rate of diagnostic errors in LMICs is 10 times higher than in high-income countries. 35 The study also found that the most common types of diagnostic errors in LMICs are missed diagnoses, delayed diagnoses, and wrong diagnoses.
There are a number of factors that contribute to the high rate of diagnostic errors in LMICs. These factors include: limited access to diagnostic testing resources, a paucity of qualified primary care providers and specialists, lack of training and education for healthcare workers, etc. The problem of misdiagnosis is particularly significant in maternal health. 36 The most common cause of maternal death in LMICs is misdiagnosis or delayed diagnosis of pregnancy complications. Ensuring timely and quality healthcare remains a significant challenge for the health system in LMICs. This challenge is exacerbated by the increasing demand for routine healthcare services.
Maternal expert systems (MESs), computer-based decision support tools, serve as valuable aids for healthcare providers in diagnosing and managing pregnancy complications, providing counseling and education to pregnant women, and monitoring maternal health outcomes. The integration of MESs stands as a promising technological solution to enhance maternal health in LMICs.34,35 However, there are a number of challenges that need to be addressed before MESs can be widely adopted in these settings. These challenges include the cost of developing and implementing MESs, the need for training and support for healthcare providers who use MESs, the need to ensure that MESs are culturally appropriate and linguistically accessible, despite these challenges, MESs have the potential to make a significant contribution to improving maternal health in LMICs.37–39
This paper presents a rule-based expert system for the diagnosis of maternal complications during pregnancy. The study involved researching risk factors, symptoms, clinical findings, and treatment procedures from various local healthcare facilities, books, literature, and disease guidelines. These were then integrated into a rule-based expert system using an “if-then” approach, which was combined with fuzzy logic.
The study employed two approaches to design the input and output parameters of the expert system. The first approach involved reviewing the literature on the Ethiopian population to determine the ranges of input variables based on the AOR. The second approach involved consulting with experts and referring to clinical practice guidelines. It also used triangular fuzzy sets, the Mamdani fuzzy inference technique, and the center of gravity method of defuzzification and forward chaining. The developed web-based application integrated with the database system was designed using SQLite. Different performance metrics such as classification accuracy, precision, and recall were used to evaluate the model's performance. The model achieved an accuracy of 94%.
The expert system designed in this study can play a significant role in reducing the occurrence of diagnostic errors by creating awareness about pregnancy complications, facilitating differential diagnosis, conducting comprehensive history taking, and providing a robust record-keeping system. By offering key follow-ups for each complication, the developed system helps to prevent diagnostic errors from occurring. This study also contributed to reducing the cognitive burden of physicians in ensuring a differential diagnosis process, as well as assisting in the development of a diagnostic plan by generating streamlining using order sets and default testing suggestions. Moreover, the system aids in detecting diagnostic errors by utilizing electronic algorithms and double-checks during the diagnosis process, thereby detecting missed opportunities for diagnosis and discrepancies. We acknowledge that collaboration with healthcare experts, ensuring regulatory compliance and data security, rigorous validation, prioritized user training, system interoperability, and careful ethical considerations are required before implementing the developed system in clinical setting. Moreover, integrating the proposed system into a national Electronic Medical Record system presents challenges in addressing resistance to technology adoption, ensuring interoperability, and managing resource constraints.
Conclusion
Managing pregnancy complications in low-resource settings present significant challenges due to limited healthcare resources and poor patient record management. Pregnancy complications can have profound implications for the well-being of both the mother and the child, addressing these risks through comprehensive prenatal care and timely medical attention are crucial steps in safeguarding the health of expectant mothers and promoting healthy fetal development. Early screening for medical complications holds immense promise for improving pregnancy outcomes and enhancing intervention and management strategies. This paper has proposed an expert system specifically designed for diagnosing maternal complications. Demonstrating a 94% accuracy, the expert system identifies three maternal complications based on a comprehensive set of risk factors and is seamlessly integrated into a user-friendly, custom-designed web-based interface. The system serves as a valuable tool in alleviating the workload of physicians, particularly in developing countries with limited experts.
Footnotes
Acknowledgments
This paper is based on the thesis of Birhan Meskelu. It has been published on the Jimma University institutional website:
. Resources required to conduct the study were provided by the school of Biomedical Engineering and the AI and Biomedical Imaging research lab at Jimma Institute of Technology, and department of Midwifery at Jimma institute of Health sciences, Jimma University.
Authorship
BM and GL conceptualized, designed, and implemented in collaboration with the co-investigator AY and GT. All authors contributed to the preliminary study, the design, prototyping, and testing. The article was drafted by BM, taking into account the comments and suggestions of the coauthors. All coauthors had the opportunity to comment on the manuscript and approved the final version for publication.
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Ethics approval and consent to participate
The study was approved by institutional review board of Jimma institute of health, Jimma university, with permission number IHRPG1/22/21/75/21, and institutional review board of Saint Paul's hospital millennium medical college, with approval number PM23/279. In addition, an informed written consent was obtained from all study participants prior to data collection. All methods were carried out in accordance with the ethical standards as laid down in the 2013 Declaration of Helsinki and its later amendments or comparable ethical standards.
Funding
The authors received no financial support for the research, authorship, and/or publication of this article.
Guarantor
Gizeaddis Lamesgin Simegn
