A comprehensive system for early detection, risk stratification, and management of Chronic Kidney Disease (CKD).
The Automated CKD Stratification system is designed to assist healthcare providers in the early detection and management of Chronic Kidney Disease. CKD is a significant global health issue that often goes undetected until advanced stages. Early identification and proper management can significantly slow disease progression and improve patient outcomes.
This application combines machine learning models, clinical guidelines, and an intuitive user interface to:
- Predict CKD risk based on laboratory test results
- Stratify patients according to risk levels
- Generate clinical alerts for high-risk patients
- Provide evidence-based recommendations from KDIGO guidelines
- Create automated referrals and test orders
- FastAPI Server: Provides API endpoints for predictions and text generation
- Machine Learning Models: Trained models for CKD risk prediction
- RAG System: Retrieval-Augmented Generation system that provides clinical advice based on KDIGO guidelines
- Data Processing: ETL pipelines for processing patient data
- Alert Dashboard: Monitors and manages patient alerts
- Risk Assessment: Visualizes patient history and risk levels
- CKD Prediction: Provides ML-based prediction of CKD risk
- PDF Generator: Creates clinical documents like referrals and test orders
The Alert Dashboard provides a centralized view of all patient alerts, categorized by priority (Critical, High, Medium, Low) and type (Risk, Test, Prediction, Medication, Referral). Healthcare providers can:
- Filter alerts by priority, category, or search terms
- View active and acknowledged alerts
- Access detailed information for each alert
- Acknowledge alerts after taking appropriate action
The Risk Assessment module visualizes patient kidney function over time, including:
- eGFR (estimated Glomerular Filtration Rate) history
- uACR (urine Albumin-to-Creatinine Ratio) history
- Risk level classification based on KDIGO guidelines
- Interactive charts for trend analysis
The CKD Prediction module uses machine learning models to predict the risk of CKD development or progression based on laboratory test results:
- Patient selection and test data visualization
- Risk probability calculation
- Risk level classification (Low, Moderate, High)
- Assessment details for clinical decision-making
The system can automatically generate clinical documents:
- Nephrology referrals for high-risk patients
- Laboratory test orders for recommended tests
- Standardized formats for clinical workflow integration
The system leverages a language model with Retrieval-Augmented Generation to provide evidence-based clinical advice:
- Contextually relevant information from KDIGO guidelines
- Personalized recommendations based on patient data
- Citations to clinical guidelines for reference
- Docker
- Docker Compose (usually included with Docker Desktop)
Before running the application, make sure you have the following files:
- Model File: Place your GGUF model file in the project root and rename it to
model.gguf
- Data Files:
- Place any CSV data files in the
data
directory - For the frontend, ensure you have
cleaned_data.csv
andcleaned_labs.csv
in themy-app/public/data
directory
- Place any CSV data files in the
-
Clone the repository:
git clone https://github.com/yourusername/automated-ckd-stratification.git cd automated-ckd-stratification
-
Run the setup script:
./docker-setup.sh
-
Build and start the application:
docker-compose up -d
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
-
Install Python dependencies:
pip install -e . pip install llama-cpp-python langchain langchain_huggingface langchain_community scikit-learn fastapi uvicorn
-
Start the backend server:
python api_back.py
-
Navigate to the frontend directory:
cd my-app
-
Install Node.js dependencies:
npm install
-
Start the development server:
npm run dev
-
Backend:
- Python 3.11
- FastAPI
- Llama CPP (for language model inference)
- Scikit-learn (for machine learning models)
- Langchain (for RAG implementation)
-
Frontend:
- Next.js
- TypeScript
- Tailwind CSS
- Recharts (for data visualization)
- jsPDF (for PDF generation)
/predict
: Endpoint for model predictions/generate
: Endpoint for simple text generation/generate_rag
: Endpoint for text generation with RAG context
The application requires the following data files:
cleaned_data.csv
: Contains patient eGFR, uACR, and risk level datacleaned_labs.csv
: Contains laboratory test results
This project is licensed under the terms of the license included in the repository.