Turns what a patient describes into a Manchester urgency level, and audits every prediction so emotional weight doesn't hide a serious case.
MedFlow assigns each patient a Manchester urgency level, from C1 to C5, based on what they describe by text or voice.
The goal was to make that triage consistent and deployable in any environment. An LLM extracts and labels the symptoms, an ML model predicts the level and an ethics audit reviews every prediction; on top of that, each AI step is swappable between a free local backend and Azure, without touching code.

And the most serious cases aren't always the loudest: the way the patient communicates can hide an emergency.
A FastAPI gateway receives the case and Airflow orchestrates the pipeline end to end.
Transcription: the patient's audio is turned into text with whisperx.
Translation and summary: the clinical corpus is English and the patient speaks Spanish.
LLM enrichment: symptom extraction, normalisation against a closed dictionary, labelling and an anxiety score.
Training and prediction: the ML model assigns the Manchester level.
n8n fires the clinical and technical alerts. Everything runs on Postgres and minIO in Docker.

Three screens cover the full flow: create a case from text or voice, review the history of processed interviews and audit a specific case's prediction against the real medical judgement.



When the pipeline finishes, n8n fires real-time notifications: an urgent C1/C2 case to the clinical team and a processing failure to the technician, each with the context needed to act.


Each AI step is swappable between a local backend (free) and Azure, switchable via an environment variable with keyless authentication.
LLM: OpenRouter locally, Azure OpenAI in the cloud.
Transcription: whisperx locally, Azure AI Speech in the cloud.
Normalisation: CSV dictionary locally, Azure AI Search in the cloud.
PII redaction: regex locally, Azure AI Language in the cloud.
The rest of the system (ML, infrastructure and business logic) is independent of the cloud provider. A regression gate in CI (GitHub Actions) blocks, on every PR, prompt changes that degrade triage quality.
Moving normalisation to semantic search wasn't free: with no threshold it over-matches and sinks precision. With a score threshold it matches the literal dictionary and additionally catches linguistic variants that exact matching misses ("I can't get air" ↔ "I'm suffocating").

The pipeline's last stage compares the model's prediction with the emotional weight detected by the LLM. When a high-anxiety case gets a low urgency level, the alert fires: it's the under-triage pattern the system is designed not to let through.
The alert doesn't just warn. It records the real category against the predicted one, a hypothesis for why the bias happened and a concrete corrective action (retrain with reinforced class_weight, review the scoring prompts). The case is routed to human review before any communication with the patient.

MedFlow is an orchestrated microservice architecture, with quality verified in CI and deployable locally or on Azure.
Independent FastAPI services (gateways, AI, ML and audit) orchestrated in Docker.
They cover ingestion, enrichment, training, prediction, evaluation and audit.
Closed dictionary that normalises symptoms to a comparable Manchester vocabulary.
Fareez et al. corpus (Nature): real medical interviews, with the imprecise language people use to describe their symptoms.