Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Severity Ranker 🏥

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.

What it does

  • 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.

How it works

  1. Patient features are preprocessed (pandas) and scaled with a persisted scaler.pkl.
  2. The Logistic Regression model (model.pkl) produces a severity score/class.
  3. Borderline cases are escalated to the LLM for a reasoned second opinion.
  4. Results are surfaced in the UI, ranked by severity.

Tech stack

Python · Flask · scikit-learn (Logistic Regression) · pandas · joblib · OpenAI API · SQLite

Getting started

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.py

Configuration

Set 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

Notes

  • 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.

About

AI medical triage — Logistic Regression + LLM reasoning to rank emergency cases by severity (Flask)

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages