· May 31, 2022 9m read

Web App to Predict Kidney Disease using IRIS IntegratedML

Kidney Disease can be discovered from some parameters well known to the medical community. In this way, in order to help the medical community and computerized systems, especially AI, the scientist Akshay Singh published a very useful dataset for training ML algorithms in the detection/prediction of kidney disease. This publication can be found on the largest and best known data repository for ML, Kaggle at

About the Dataset

The kidney disease dataset has the following metadata information (source:

  • It has 400 rows with 25 features like red blood cells, pedal edema, sugar,etc.
  • The aim is to classify whether a patient has chronic kidney disease or not.
  • The classification is based on a attribute named 'classification' which is either 'ckd'(chronic kidney disease) or 'notckd.
  • The dataset author performed cleaning of the dataset which includes mapping the text to numbers and some other changes. After the cleaning, the dataset author done some EDA(Exploratory Data Analysis) and then divided the dataset int training and testing and applied the models on them. It is observed that the classification results are not much satisfying initially. So, instead of dropping the rows with Nan values the dataset author used the lambda function to replace them with mode for each column. After that the dataset author divided the dataset again into training and testing sets and applied models on them. This time the results are better and we see that the random forest and decision trees are the best performers with an accuracy of 1.0 and 0 misclassifications. The performance of the classification is measured by printing confusion matrix, classification report and accuracy.

Data Set Information (source:

We use the following representation to collect the dataset
age - age
bp - blood pressure
sg - specific gravity
al - albumin
su - sugar
rbc - red blood cells
pc - pus cell
pcc - pus cell clumps
ba - bacteria
bgr - blood glucose random
bu - blood urea
sc - serum creatinine
sod - sodium
pot - potassium
hemo - hemoglobin
pcv - packed cell volume
wc - white blood cell count
rc - red blood cell count
htn - hypertension
dm - diabetes mellitus
cad - coronary artery disease
appet - appetite
pe - pedal edema
ane - anemia
class - class

Attribute Information (source:

We use 24 + class = 25 ( 11 numeric ,14 nominal)
age in years
2.Blood Pressure(numerical)
bp in mm/Hg
3.Specific Gravity(nominal)
sg - (1.005,1.010,1.015,1.020,1.025)
al - (0,1,2,3,4,5)
su - (0,1,2,3,4,5)
6.Red Blood Cells(nominal)
rbc - (normal,abnormal)
7.Pus Cell (nominal)
pc - (normal,abnormal)
8.Pus Cell clumps(nominal)
pcc - (present,notpresent)
ba - (present,notpresent)
10.Blood Glucose Random(numerical)
bgr in mgs/dl
11.Blood Urea(numerical)
bu in mgs/dl
12.Serum Creatinine(numerical)
sc in mgs/dl
sod in mEq/L
pot in mEq/L
hemo in gms
16.Packed Cell Volume(numerical)
17.White Blood Cell Count(numerical)
wc in cells/cumm
18.Red Blood Cell Count(numerical)
rc in millions/cmm
htn - (yes,no)
20.Diabetes Mellitus(nominal)
dm - (yes,no)
21.Coronary Artery Disease(nominal)
cad - (yes,no)
appet - (good,poor)
23.Pedal Edema(nominal)
pe - (yes,no)
ane - (yes,no)
25.Class (nominal)
class - (ckd,notckd)

Get the Kidney data from Kaggle

The Kidney data from Kaggle can be loaded into an IRIS table using the Health-Dataset application: To do this, from your module.xml project, set the dependency (ModuleReference for Health Dataset):

Module.xml with Health Dataset application reference

Web Frontend and Backend Application to Predict Kidney Disease

Go to Open Exchange  app link ( and follow these steps:

  1. Clone/git pull the repo into any local directory
$ git clone
  1. Open a Docker terminal in this directory and run:
$ docker-compose build
  1. Run the IRIS container:
$ docker-compose up -d 
  1. Go to Execute Query into Management Portal to train the AI model: http://localhost:52773/csp/sys/exp/%25CSP.UI.Portal.SQL.Home.zen?$NAMESPACE=USER
  2. Create the VIEW used to train:
age, al, ane, appet, ba, bgr, bp, bu, cad, classification, dm, hemo, htn, pc, pcc, pcv, pe, pot, rbc, rc, sc, sg, sod, su, wc
FROM dc_data_health.KidneyDisease
  1. Create the AI Model using the view:
CREATE MODEL KidneyDiseaseModel PREDICTING (classification) FROM KidneyDiseaseTrain
  1. Train the model:
TRAIN MODEL KidneyDiseaseModel
  1. Go to http://localhost:52773/disease-predictor/index.html to use the Disease Predictor frontend and predict diseases like this: Kidney-Predictor

Behind the scenes

Backend ClassMethod to predict Kidney Disease

InterSystems IRIS allows you execute SELECT to predict using the previous model created.

Backend ClassMethod to predict Kidney Disease

Now, any web application can consume the prediction and show the results. See the source code into frontend folder to predict-diseases application.

Discussion (0)1
Log in or sign up to continue