End-to-end ML deployment project predicting patient triage levels using FastAPI, Streamlit, and Docker followed by a short GenAI explanation of the predictions.
Try the demo!: Healthcare Triage Assistant Frontend
The Healthcare Triage Assistant is a ML project designed to support emergency departments by predicting patient triage levels based on vital signs, symptoms, and arrival mode. It provides a user friendly interface for healthcare staff to quickly assess patient urgency and prioritize care effectively. Also includes a GenAI explanation feature to help non-clinical staff understand the model's predictions in an intuitive way.
The project demonstrates the full ML lifecycle:
- Data wrangling & feature engineering
- Model training & evaluation
- FastAPI backend for serving predictions
- Streamlit frontend with intuitive hospital friendly UI
- Dockerized deployment for portability
- GenAI integration for explainability
This project uses the Synthetic Medical Triage Priority Dataset from Kaggle for model development and evaluation.
- Predicts triage levels (Routine, Urgent, Emergency, Self-care/Non-urgent)
- FastAPI backend with RESTful API endpoints
- Streamlit frontend with segmented controls and color coded outputs
- Dockerized setup with
docker-composefor easy deployment - Interactive API documentation (
/docs) for API exploration - GenAI integration for explainability
Healthcare-Triage-Assistant/
├── app/
│ └── streamlit_app.py # Streamlit frontend
├── data/
│ └── raw/
│ └──synthetic_medical_triage.csv # Raw dataset
├── notebooks/
│ └── cleandata.ipynb # Data cleaning & Model training
├── src/
│ ├── api.py # FastAPI backend
│ └── model.pkl # Trained ML model
├── .dockerignore
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile.backend # Docker definition for backend
├── Dockerfile.frontend # Docker definition for frontend
├── example.env
├── LICENSE
├── README.md
├── requirements-backend.txt # For docker backend
├── requirements-frontend.txt # For docker frontend
└── requirements.txt # For local deploymentClone the repo:
git clone https://github.com/rishabhpatel9/Healthcare-Triage-Assistant.git
cd Healthcare-Triage-AssistantBefore running the application, you need to configure your environment variables:
- Copy
example.envto.env:
cp example.env .env- Open
.envand fill in the required variables (specificallyOPENROUTER_API_KEYfor the GenAI explanations).
Install dependencies:
pip install -r requirements.txtRun FastAPI backend:
uvicorn src.api:app --reloadRun Streamlit frontend:
streamlit run app/streamlit_app.pyBuild and run with docker-compose:
docker-compose up --buildUse Streamlit app frontend → http://localhost:8501
Once backend is running, visit:
- API Documentation →
http://localhost:8000/docs - Redoc →
http://localhost:8000/redoc
The triage classifier was trained on patient intake data with the following features:
- Age → Patient’s age in years
- Heart Rate → Beats per minute
- Systolic Blood Pressure → mmHg
- Oxygen Saturation (SpO₂) → Percentage
- Body Temperature → Patient's body temperature (°C)
- Chronic Disease Count → Number of chronic conditions
- Previous ER Visits → Number of prior emergency room visits
- Pain Level → Self-reported scale (0–10)
- Arrival Mode → Walk-in, Ambulance, Referral
Ouput shown as:
- 🟢 Routine
- 🟡 Urgent
- 🔴 Emergency
- 🔵 Self-care / Non-urgent
along with a short GenAI explanation of the prediction.
- Improve model accuracy with larger datasets
- Integrate hospital database for real patient records
- Add authentication & role-based access control
Contributions are welcome!
- Fork the repo
- Create a feature branch
- Submit a pull request