An AI triage system that ranks incoming emergency patient cases by severity — combining a Logistic Regression classifier for structured scoring with LLM-based reasoning (OpenAI) for dynamic, edge-case handling, in a simulated hospital environment.
- Severity classification — a trained Logistic Regression model scores patient cases from structured features.
- LLM edge-case reasoning — for ambiguous or borderline cases, an LLM adds context-aware judgment beyond the classifier's fixed decision boundary.
- Batch intake — upload a CSV of patient records; the app processes and ranks them.
- Web interface — Flask app with user login for reviewing assessments.
- Patient features are preprocessed (
pandas) and scaled with a persistedscaler.pkl. - The Logistic Regression model (
model.pkl) produces a severity score/class. - Borderline cases are escalated to the LLM for a reasoned second opinion.
- Results are surfaced in the UI, ranked by severity.
Python · Flask · scikit-learn (Logistic Regression) · pandas · joblib · OpenAI API · SQLite
git clone https://github.com/baghdme/severityranker
cd severityranker
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install flask pandas scikit-learn joblib openai python-dotenv
cp .env.example .env # then add your OPENAI_API_KEY
python app.pySet these in a .env file (never commit it — it's gitignored):
| Variable | Purpose |
|---|---|
OPENAI_API_KEY |
LLM reasoning for edge cases |
FLASK_SECRET_KEY |
Flask session signing |
- Built for the EECE 490 (Machine Learning) course project at AUB.
- Data is simulated — no real patient information.
- Demo login users are seeded for local testing only; change them before any real deployment.
Built by Mohamad Baghdadi.