🔬 A machine learning system for Chronic Kidney Disease (CKD) prediction using ensemble methods, based on Rahman et al., 2024 methodology. Features a FastAPI backend with 24 trained models and a React + TypeScript frontend.
🌐 Frontend: ckd-ensemble-classifier.vercel.app (Deployed on Vercel) ⚙️ Backend: Self-hosted FastAPI service
| Link | Description |
|---|---|
| 🌐 Live Demo | Frontend deployed on Vercel |
| 📖 Documentation | Full project documentation |
| 🐛 Issues | Report bugs or request features |
| 🤝 Contributing | How to contribute |
- Features
- Installation
- Usage
- Tech Stack
- Dependencies & Packages
- Folder Structure
- Model Performance & Charts
- API Reference
- Contributing
- License
- Security
- Code of Conduct
- 🧠 24 ML Models — 3 variants × 8 ensemble models for robust CKD prediction
- 🔄 3 Feature Selection Strategies — All Features (24), RFE (12), Boruta (selected)
- ⚖️ SMOTE Balancing — Borderline-SMOTE with regular SMOTE fallback for imbalanced data
- 🌐 REST API — FastAPI-based prediction and training endpoints
- 📊 Interactive Dashboard — React + TypeScript frontend with real-time predictions
- 📈 Rich Visualizations — Confusion matrices, ROC curves, comparison charts
- 🔍 MICE Imputation — Advanced missing data handling
- 🏥 Clinical Ready — Based on Rahman et al., 2024 CKD research
- Python >= 3.10
- Node.js >= 18
- npm >= 9
# Clone the repository
git clone https://github.com/H0NEYP0T-466/CKD-Ensemble-Classifier.git
cd CKD-Ensemble-Classifier
# Create virtual environment
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run ML pipeline (trains all 24 models)
python -m backend.ml_core.pipeline
# Start API server
python run.py
# Server runs at http://localhost:8007# From project root
npm install
# Start development server
npm run dev
# App runs at http://localhost:5173
# Build for production
npm run buildBackend (.env):
PORT=8007
PYTHONPATH=backendFrontend (.env):
VITE_API_URL=http://localhost:8007Via API:
curl -X POST http://localhost:8007/predict/all_features \
-H "Content-Type: application/json" \
-d '{
"age": 45,
"blood_pressure": 80,
"specific_gravity": 1.02,
"albumin": 0,
"sugar": 0,
"red_blood_cells": "normal",
"pus_cell": "normal",
"pus_cell_clumps": "notpresent",
"bacteria": "notpresent",
"blood_glucose_random": 90,
"blood_urea": 20,
"serum_creatinine": 0.8,
"sodium": 140,
"potassium": 4.2,
"hemoglobin": 14,
"packed_cell_volume": 42,
"white_blood_cell_count": 7500,
"red_blood_cell_count": 5.2,
"hypertension": "no",
"diabetes_mellitus": "no",
"coronary_artery_disease": "no",
"appetite": "good",
"pedal_edema": "no",
"anemia": "no"
}'Via Web UI: Navigate to ckd-ensemble-classifier.vercel.app → Enter patient data → Get instant CKD prediction with risk indicators.
# Trigger full training pipeline via API
curl -X POST http://localhost:8007/train# Get evaluation metrics for all variants
curl http://localhost:8007/metricsPython (backend/requirements.txt)
Node.js (package.json)
| Package | Version | Description |
|---|---|---|
| ^19.2.4 | UI framework | |
| ^19.2.4 | DOM rendering | |
| ^7.14.1 | Client-side routing | |
| ^5.99.0 | Server state management | |
| ^1.6.8 | HTTP client |
Node.js Dev Dependencies
CKD-Ensemble-Classifier/
├── 📁 backend/ # FastAPI ML Backend
│ ├── 📁 api/ # API layer
│ │ ├── main.py # FastAPI application
│ │ └── routers.py # API route handlers
│ ├── 📁 ml_core/ # ML pipeline core
│ │ ├── pipeline.py # Main orchestrator (trains all 24 models)
│ │ ├── preprocess.py # Data preprocessing (MICE, scaling)
│ │ ├── feature_selection.py # RFE & Boruta feature selection
│ │ ├── train.py # Model training (8 ensemble models)
│ │ └── evaluate.py # Evaluation & visualization
│ ├── 📁 schemas/ # Pydantic data models
│ │ └── models.py # Request/response schemas
│ ├── 📁 Dataset/ # CKD dataset files
│ ├── 📁 models/ # Trained model serialization
│ ├── 📁 plots/ # Generated visualizations
│ │ ├── 📁 all_features/ # Charts for all-features variant
│ │ ├── 📁 rfe/ # Charts for RFE variant
│ │ └── 📁 boruta/ # Charts for Boruta variant
│ ├── requirements.txt # Python dependencies
│ └── run.py # Server entry point
│
├── 📁 src/ # React Frontend
│ ├── 📁 components/ # Reusable UI components
│ │ ├── FormField.tsx # Input form field
│ │ ├── LoadingSpinner.tsx # Loading indicator
│ │ ├── MetricsTable.tsx # Metrics display table
│ │ ├── Navbar.tsx # Navigation bar
│ │ └── RiskIndicator.tsx # CKD risk visualization
│ ├── 📁 pages/ # Page components
│ │ ├── PredictionPage.tsx # Prediction form page
│ │ └── AnalyticsPage.tsx # Model analytics page
│ ├── 📁 services/ # API client
│ │ └── api.ts # Axios API service
│ ├── 📁 types/ # TypeScript types
│ │ └── index.ts # Type definitions
│ ├── App.tsx # Root application component
│ ├── main.tsx # Application entry point
│ └── assets/ # Static assets
│
├── 📁 .github/ # GitHub configuration
│ ├── 📁 ISSUE_TEMPLATE/ # Issue form templates
│ │ ├── bug_report.yml # Bug report form
│ │ ├── feature_request.yml # Feature request form
│ │ └── config.yml # Template config
│ └── pull_request_template.md # PR template
│
├── CLAUDE.md # AI assistant instructions
├── package.json # Node.js dependencies
├── vite.config.ts # Vite configuration
├── eslint.config.js # ESLint configuration
├── tsconfig.json # TypeScript configuration
├── LICENSE # MIT License
├── CONTRIBUTING.md # Contribution guidelines
├── SECURITY.md # Security policy
├── CODE_OF_CONDUCT.md # Community standards
└── README.md # This file
The ML pipeline generates comprehensive visualizations for each of the 3 variants (all_features, rfe, boruta):
| Random Forest | XGBoost | LightGBM | GBDT |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| AdaBoost | Bagging | Stacking | Voting Soft |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Note: Similar charts are generated for all three variants (
all_features,rfe,boruta) and stored in their respective directories underbackend/plots/.
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Service health check |
POST |
/train |
Trigger full ML pipeline training |
POST |
/predict/{variant} |
Get CKD prediction (all_features, rfe, or boruta) |
GET |
/metrics |
Get evaluation metrics for all variants |
{
"age": 45,
"blood_pressure": 80,
"specific_gravity": 1.02,
"albumin": 0,
"sugar": 0,
"red_blood_cells": "normal",
"pus_cell": "normal",
"pus_cell_clumps": "notpresent",
"bacteria": "notpresent",
"blood_glucose_random": 90,
"blood_urea": 20,
"serum_creatinine": 0.8,
"sodium": 140,
"potassium": 4.2,
"hemoglobin": 14,
"packed_cell_volume": 42,
"white_blood_cell_count": 7500,
"red_blood_cell_count": 5.2,
"hypertension": "no",
"diabetes_mellitus": "no",
"coronary_artery_disease": "no",
"appetite": "good",
"pedal_edema": "no",
"anemia": "no"
}We welcome contributions! Please see our Contributing Guidelines for details on how to submit pull requests, report issues, and contribute to the project.
This project is licensed under the MIT License.
Please review our Security Policy for information on reporting vulnerabilities and our responsible disclosure process.
We are committed to providing a welcoming and inclusive experience. Please read our Code of Conduct.
Made with ❤ by H0NEYP0T-466















