METIS
B.Sc. thesis. Clinical AI backend deploying a Neural Thompson Sampling model (PyTorch) as a REST API for real-time treatment recommendations. Model inference, clinician feedback ingestion, and posterior updates are handled by a FastAPI service backed by PostgreSQL and Neo4j — with deterministic safety gates enforced at the API layer before any model output is returned.
- Python
- PyTorch
- FastAPI
- PostgreSQL
- Neo4j
- Next.js
- React

The problem
Type-2 diabetes guidelines give general rules, but the best medication for a specific patient is often unclear: dozens of clinical features interact.
What was built
- A Neural Thompson Sampling contextual bandit (PyTorch) that recommends one of five therapies — Metformin, GLP-1 RA, SGLT-2i, DPP-4i, Insulin — with a calibrated confidence and a runner-up.
- A deterministic safety gate after the model that overrides contraindicated choices (for example Metformin below eGFR 30), with the pre-override choice kept for audit.
- A FastAPI service backed by PostgreSQL and a Neo4j cohort that finds the most similar historical patients.
- Clinician decisions (accepted or overridden) stored as feedback and replayed to update the model online.