+1 (502) 904-2126   One Westbrook Corporate Center, Suite 300, Westchester, IL 60154, USA   Site Map
ISSN: 2574 -1241

Impact Factor : 0.548

  Submit Manuscript

Research ArticleOpen Access

Towards Predicting the Grade of Peritonitis with a Mamdani-Type Fuzzy Decision System: Application of Artificial Intelligence in Surgical Emergency Referrals Volume 46- Issue 2

Subhagata Chattopadhyay*

  • Independent researcher, Bangalore India

Received: September 02, 2022;   Published: September 15, 2022

*Corresponding author: Subhagata Chattopadhyay, Independent researcher, Bangalore India,

DOI: 10.26717/BJSTR.2022.46.007315

Abstract PDF


Diagnostic healthcare has ambiguities due to the literal expression of symptoms, e.g., more, less, moderate, severe, and so on. Acute abdomen, associated with pain, vomiting, and fever of various grades, are commonly encountered in the surgical emergency department. Peritonitis is one of the commonest acute abdomens. It needs immediate medical attention as it can be life-threatening. Developing nations lack experienced clinicians and high-end investigation facilities, especially in the rural setup. Thus, referral of such cases to higher facilities is the mainstay procedure. A timely referral is a challenge. This paper has explained an intelligent referral system (IRS) by developing a fuzzy decision system (FDS) of Mamdani-type. Three symptoms - pain, vomiting, and fever, each having three grades, e.g., poor, average, and good are the inputs to the FDS, while the grade of peritonitis is the output as a low, medium, and high grade based on the fuzzy rule base obtained from an expert clinician. The efficacy of the FDS is tested and validated in three arbitrary cases.

Keywords: Artificial Intelligence; Peritonitis; Surgical Emergency; Fuzzy Decision Engine; Fuzzy Rules; Mamdani’s Approach; Intelligent Referral System


Clinical healthcare has its ambiguities, especially in the usage of several literal terms, such as more, less, adequate, poor, well, good, worse, bad, better, and many more while stating the health conditions. These terms create a wide and indefinite search space for both the providers and the receivers. It is one of the most common reasons for confusion and communication gap. In the clinical domain, symptoms are often much subjective in nature, e.g., an episode of illness can be expressed with ‘mild’, ‘moderate’, and ‘severe’ symptoms and signs, and even in its combinations, e.g., mild-to-moderate or moderate-to-severe, etc., which is decoded by the clinicians by assigning some weightage to each of these based on the clinical rule base that they have gathered and learned during their medical career [1]. The conventional probability theory often fails to address this practical challenge as its working principle is either ‘present’ or ‘absent’. Therefore, the field of ‘ambiguity’ remains a fertile domain for using AI methods, such as soft computing methods (e.g., fuzzy set and fuzzy logic, neural networks, and genetic algorithm and their various combinations) which traditional machine learning approaches may not be suitable to address the real-world subjective issues [2]. Fuzzy set and fuzzy logic have been proposed and implemented by Prof. Lotfi A. Zadeh in 1965 to solve the issue of uncertainty due to literal ambiguity, such as more, less, moderate, mild, severe, etc. in mathematics [3]. The fuzzy set explains the possibility of belongingness by computing the membership grade [0,1], where ‘0’ is the minimum and ‘1’ is the minimum score. It gives a wider search space than the probability of belongingness which is ‘0’ i.e., not existing vs ‘1’ i.e., existing. Fuzzy logic is a set of IFS (antecedent)-THEN (consequent) rules, which are used for decision-making. Given input with a fuzzy term, the algorithm defuzzifies it into a crisp value. Using fuzzy rules, the output is predicted. Together, it is called a fuzzy decision system (FDS).

There are three types of FDS – Mamdani’s [4], Takagi-Sugeno’s [5], and Tsukamoto’s techniques [6]. The first technique uses the center of gravity or centroid technique, while the remaining two use the weighted average to defuzzify and compute crisp output [7]. The FDS methods have been used in diagnosing diseases, such as typhoid fever [8], mental illnesses [9], cancers [10], risk of heart disease [11], erectile dysfunction [12], etc. Abdominal pain, fever, and vomiting feature a possibility of surgical emergency [13]. Peritonitis is one of the most common surgical emergencies, which presents with this symptom triad. Peritonitis happens due to a diffuse inflammation of the peritoneal membrane that covers the abdominal organs [14]. Leakage of fluid from the viscera is one of the commonest causes of this inflammation when they rupture [14]. Other potential conditions are peritoneal dialysis, pancreatitis, diverticulitis, and trauma [14]. The severity of peritonitis needs to be assessed by an experienced clinician, as it may turn out to be life-threatening due to septic shock, multiorgan failure, and finally cardiorespiratory arrest [14]. During the historytaking process, symptoms are often presented by the patients and their caregivers in subjective literal terms, as discussed above. The experienced clinician can decode it into objective terms by assigning some weights to each of the symptoms and the rule base they have acquired over a good time of clinical practice. It is called the doctor’s ‘clinical eye’.

Sharper is the clinical eye, accurate are the diagnoses. Unfortunately, highly experienced clinicians are not always available In developing nations, where most rural health centers are starving of experienced clinicians (physicians, surgeons, radiologists, etc.) and treatment facilities (X-ray and ultrasonogram or CT or MRI-scan, high-level blood tests, and so forth). It results in referring the patient to higher facilities. The referral process has documentation, logistic, and financial challenges. As a result, precious time is wasted in the patient’s life. Another issue lies with ‘wrong’ or ‘delayed’ referrals due to the respective overdiagnosing or underdiagnosing of the case. Underdiagnosis may lead to lifethreatening catastrophes due to the delay while overdiagnosis raises a false alarm and wastage of money and logistic support for the transfer to happen. To address it, a simple, symptom-based predictive tool such as an intelligent referral system (IRS) may be thought of that can handle the issue.

Material and Method

Mamdani’s FDS is developed on Windows 10 Pro using Python 3.9 with IDLE editor 3.9 64 bits preloaded with numpy, matplotlib. pyplot, and scikit-fuzzy packages. A fuzzy decision support system takes single or many inputs and gives one or many outputs. The decision is made inside its knowledge base, which is consisted of (a) input (membership) database and (b) rule base IF-THEN linguistic control rules), derived from the domain expertise. In this work, the input variables are varied subjective degrees e.g., poor, average, good of (i) abdominal pain, (ii) vomiting, and (iii) fever while the output would be peritonitis and its severity as low, medium, or high grades. Triangular membership functions are chosen here for ease of calculations.

Steps of Mamdani’s FDS construction: [15]

• Step-1: choosing the domain and find a domain expert

• Step-2: setting crisp input and then convert it into fuzzy input using the membership function, such as triangular, trapezoidal, Gaussian, and so on

• Step-3: computing the strength of the input by combining fuzzified units as per the fuzzy rules, obtained from the domain expert

• Step-4: coalescing the rule strength and the output membership function to decide on the consequent rule to be fired

• Step-5: merging all possible consequents to obtain output distribution, and finally

• Step-6: obtaining the defuzzified output that passes through the centroid of the combined consequents (output distribution) as the final inference

• Step-7: go back to the domain expert for validating the result.

Advantages of Mamdani’s FDS: [16] Intuitive

• Suitable for human inputs

• The highly interpretable rule base

• Suitable to develop hybrid decision support systems

• Has a wide acceptance in real-life applications.

Parameter setting:

• Inputs are set on an overlapped subjective range (low to high) as poor (<=5), average (0 to 10), and good (>=5), ranging between 0 and 10 (See Figure 1)

• Output grade has a range between 0 to 25 (See Figure 2).

Figure 1: Correlation between location of defect and general satisfaction.


Figure 2: A medium-grade peritonitis in case 1.


The triangular membership function for output is ranged from low-grade <=13, medium grade from 0 to 25, and high-grade to>=13, having overlapped spaces too.

Fuzzy rule base: This is the heart of the FDS and must be derived from the domain expertise to get an accurate result. Below is a sample of a set of rules, given arbitrarily by an experienced clinician. The conditions laid after ‘IF’ are the fuzzy antecedents, while those after ‘THEN’ is called the fuzzy consequents.

Rule-1: IF pain is ‘poor’ OR vomiting is ‘poor’ OR fever is ‘poor’ THEN peritonitis is ‘low-grade’

Rule-2: IF pain is ‘average’ OR vomiting is ‘average’ OR fever is ‘average’ THEN peritonitis is ‘medium’

Rule-3: IF pain is ‘good’ OR vomiting is ‘good’ OR fever is ‘good’ THEN peritonitis is ‘high-grade’.

In this work there are three inputs each having three grades, therefore, a total of 33 = 27 rules have been generated according to the various combinations of the grades. It is important to mention here that 23 = 8 rules fall under ‘low’ and ‘medium’ grades of peritonitis, while the remaining 19 rules point towards a ‘high’ grade.

Here, OR (also denoted by ‘|’) fuzzy operations are used. It is a fuzzy union and computes the ‘maximum’ of the membership grades of any given input. There are two other fuzzy operators, such as AND often denoted by an ‘&’ is the fuzzy intersection that computes the ‘minimum’ of the membership, and NOT as the fuzzy additive complement. Using the rules, the grade of peritonitis has been computed in three arbitrary cases and clinically validated by an experienced clinician. It is important to note that the clinical data source is secondary in nature and the developed FDS is yet to be tested in a surgical department. The key focus of this paper is to develop Mamdani’s FDS and further it as an IRS from scratch and emphasis has been put on its predictive strength.


Outputs of the developed FDS can be seen in the following figures: Figure 1. shows the triangular membership functions plotted on the mentioned range for one input, i.e., pain. Similar plots are there for vomiting and fever. Figure 1 shows the triangular membership plots as poor (blue line), average as the orange line, and good as the green line. The x-axis denotes the respective range of inputs [0,10] while the y-axis refers to the membership grades [0,1], where ‘0’ and ‘1’ refers to the minimum and maximum degree of belongingness. Figures 2-4 serially shows the outputs of three arbitrary cases predicted by the developed FDS.

Figure 3: A medium-grade peritonitis in case 2.


Figure 4: A severe-grade peritonitis in case 3.



Pain, vomiting, and fever scores are 6.5 (close to average), 9.8 (very close to good), and 7.25 (close to good). The computed crispt score of peritonitis is 14.79, represented by the black line that passes through the centroid of the area of all possible consequents. Here, the score of 14.79 indicates medium-grade peritonitis.


In this case, the pain, vomiting, and fever scores are 3.5 (more towards poor), 4.8 (close to average), and 7.25 (moderately close to good), respectively. The computed crispt score of peritonitis is 12.48, which refers to a medium grade of peritonitis.

Case 3

In case 3, the pain, vomiting, and fever scores are 9.5 (close to poor), 9.8 (close to poor), and 9.25 (close to poor), respectively. The computed crispt score of peritonitis is 17.67, which refers to a high grade of peritonitis.

Clinical validation

The key clinical parameters (secondary data source) of the three cases and the respective diagnoses are mapped with the FDS predictions (see Table 1). The above findings are matching with the predicted grades of peritonitis by the developed FDS. Similarly, many more cases can be predicted by the FDS when it is trained with a large dataset. It is also important to state that, in this paper, three symptoms or indicators are considered which are not the exhaustive list of all indicators. The IRS can be made more robust by adding other indicators/symptoms, further guided by signs such as ascites and or free air in the abdomen for appropriate referral decision-making. Figure 5 shows the detailed IRS. Symptoms with grades consist of the inputs to the FDS having a database (membership functions of the inputs) and the antecedentconsequent rule base, obtained from the domain experts, based on which the FDS predicts the peritonitis and its respective grade, based on that initial referral decision (IRD) is taken. This is the first step. In the next step, the findings of the physical examination of the cases, e.g., rebound tenderness, referred pain, nature of vomiting (whether projectile), and fever (whether with chill and rigor and remission with profuse sweating, etc.) are noted by the doctor-onduty. Blood tests to note the WBC count and especially the count of neutrophils, other biochemical markers’ scores, and findings of the CT and/or Ultrasound would be considered to clinically assess the seriousness of the case further. After connecting all the dots, the final decision regarding referral has to be taken.

Table 1: Key clinical parameters and referral decision-making./p>


Figure 5: Structure and functionalities of the proposed IRS.



A surgical emergency department usually encounters the triad of abdominal pain, vomiting, and fever. A whopping rate of 24% of these is generalized peritonitis [17]. Symptoms are presented to clinicians in subjective literal terms. The health facilities of developing countries have limited resources, such as the availability of experienced doctors and often high-end investigation facilities, which leads to referring the case. The referral has to be ‘timely’ and that is a challenge. In today’s era of digital health, the application of artificial intelligence (AI) is undoubtedly revolutionary; however, it requires a solid understanding of the whole ecosystem and its interconnected dynamics to obtain a satisfactory health outcome. An IRS, proposed and developed in this paper could be useful to handle such complex clinical scenarios and may assist healthcare providers to get an effective health outcome, e.g., a timely referral that is the main focus. However, it requires training with a large sample of real-life cases [18-21].

Conflict of Interest

The author affirms there is no conflict of interest.

Source of Funding

The study has not received funding from any source.


  1. Chattopadhyay S, Pratihar DK (2009) Towards Developing Intelligent Autonomous System in Psychiatry: Its Present State and Future Possibilities” in Intelligent Autonomous Systems: Foundations and Applications. In: Pratihar DK, Jain LC (Eds.)., n Intelligent Autonomous Systems: Foundations and Applications. Berlin: Springer-Verlag, pp. 143-166.
  2. Chattopadhyay S, Pratihar DK, De Sarkar SC (2008) Developing Fuzzy Classifiers to Predict the Chance of Occurrence of Adult Psychoses. Knowledge Based Systems 21(6): 479-497.
  3. Zadeh L (1965) Fuzzy Sets. Information and Control 8(3): 338-353.
  4. Mamdani EH, Assilian s (1975) An experiment in linguistic synthesis with a fuzzy logic controller. International Journal of Man-Machine Studies 7(1): 1-13.
  5. Takagi T, Sugeno M (1985) Fuzzy identification of systems and its applications to modeling and control. EEE Trans. Syst. Man Cybern SMC-15(1): 116-132.
  6. Tsukamoto Y (1979) An approach to fuzzy reasoning method. In: Gupta MM, Ragade RK, Yager RR (Eds.)., Advances in fuzzy set theory and applications. Amsterdam: Elsevier Science Ltd, pp. 137-149.
  7. Sari WE, Wahyunggoro O, Fauziati S (2016) A comparative study on fuzzy MamdaniSugeno-Tsukamoto for the childhood tuberculosis diagnosis. In Advances of Science and Technology for Society AIP Conference Proceedings 1755; 2016: AIP Publishing, p. 070003-1 - 6.
  8. Samuel OW, Omisore MO, Ojokoh BA (2013) A web-based decision support system driven by fuzzy logic for the diagnosis of typhoid fever. Expert Syst. Appl 40(10): 4164-4171.
  9. Chattopadhyay S, Pratihar DK, De Sarkar SC (2009) Fuzzy-Logic-Based Screening and Prediction of Adult Psychoses: A Novel Approach. IEEE Transactions on Systems, Man, and Cybernetics - Part A: Systems and Humans 39(2): 381-387.
  10. Miranda GHB, Felipe JC (2015) Computer-aided diagnosis system based on fuzzy logic for breast cancer categorization. Comput Biol Med 64(2015): 334-346.
  11. Kowsigan M, Jebamalar AC, Shobika S, Roshini R, Saravanan A, et al. (2017) Heart Disease Prediction by Analyzing Various Parameters using Fuzzy logic. Pak J Biotechnol 14(2): 157-161.
  12. Chattopadhyay S (2022) Smoking, erectile dysfunction, and its extended psychology. PsyArXiv. (PREPRINT).
  13. McCord C, Ozgediz D, Beard JH, T DH (2015) General Surgical Emergencies. In: Debas HT, Donkor P, Gawande A, Jamison DT, Kruk ME, Mock CN (Eds.)., Essential Surgery: Disease Control Priorities (3rd )., Washington (DC).
  16. (2022) Mamdani and Sugeno Fuzzy Inference Systems.
  17. Sharma L, Gupta S, Soin AS, Sikora S, Kapoor V, et al. (1991) Generalized peritonitis in India—The tropical spectrum. The Japanese Journal of Surgery 21: 272-277.
  18. Daley BJ (2019)
  19. Osman HA, Aly SS, Salah-Eldin EM, El-Masry MA, Hassan MH, et al. (2018) Diagnostic validity of flow cytometry vs manual counting of polymorphonuclear leukocytes in spontaneous bacterial peritonitis. J Clin Lab Anal 32(5): e22395.
  20. Rudralingam V, Footitt C, Layton B (2017) Ascites matters. Ultrasound 25(2): 69-79.
  21. Filippone A, Cianci R, Delli Pizzi A, Esposito G, Pulsone P, et al. (2015) CT findings in acute peritonitis: a pattern-based approach. Diagn Interv Radiol 21(6): 435-440.