AutoFlow
The Operating System for Hospital OPDs

Overview
AutoFlow is an operating system for hospital outpatient departments. It orchestrates the entire patient journey, from registration and triage through consultation, investigations, pharmacy, billing, and discharge, in real time across nine role-specific consoles driven by a single source-of-truth state machine. A Gemini-powered AI layer triages, transcribes, summarizes, and flags at every step, while a strict human-confirmation rule keeps a clinician in control of every medical decision.
Links
The Problem
India's outpatient departments are the front door to healthcare and its worst bottleneck. Tertiary government hospitals routinely process 3,000 to 10,000 outpatients a day, where patients wait 2 to 4+ hours for a 3 to 5 minute consultation. Throughput, not clinical skill, is the binding constraint. Administrators run blind with no real-time operational visibility, documentation is manual, billing leaks revenue, and Ayushman Bharat, the world's largest government health-insurance scheme covering 500M+ people, adds claims complexity that paper-based OPDs cannot handle.
The Solution
AutoFlow models the OPD as a real-time, event-sourced state machine: every patient is a live token moving through ten well-defined states, and every role sees exactly their slice on a purpose-built console. A fairness-aware scheduler decides who is next, weighing wait time, urgency, starvation protection, and emergency override. WebSockets keep every screen and the lobby board in sync, and an AI augmentation layer removes documentation and triage load, always as a suggestion a human confirms, never an auto-commit.
Agent Architecture
Triage Agent
Intake Conversationalist
Clinical Brief Agent
Scribe & Dual-Summary
Lab Vision OCR
Pharmacy Safety Engine
Technology Stack
client
- React 18
- TypeScript
- Vite
- TailwindCSS
- Zustand
- Framer Motion
- WebSockets
- PWA (Workbox)
- Dexie / IndexedDB
server
- Python
- FastAPI
- PostgreSQL
- psycopg2
- WebSockets
- Async workers
- Alembic
- JWT + bcrypt
ai
- Google Gemini 2.5 (Flash / Pro / Vision)
- Groq (Llama 3.x)
- Ollama (on-prem)
- MEWS vitals triage
- Drug-interaction engine
- AI cost-metering + kill-switch
data
- PostgreSQL (event-sourced, RLS audit log)
- Docker
- Render
- Vercel
- GitHub CI
Key Features
Nine real-time role consoles, reception, nurse, doctor, lab, pharmacy, admin, lobby display, a patient self-intake PWA, and an external lab-partner portal, all on one shared live state machine.
AI triage plus a multilingual intake chatbot (Hindi / Punjabi / English) that hands the doctor a structured clinical brief before the patient walks in.
AI clinical scribe producing a dual discharge summary (a clinician version and a plain-language patient version), lab-report vision OCR, and deterministic pharmacy safety flags, every output human-confirmed.
Fairness-aware queue scheduler with weighted scoring, starvation protection, emergency insertion, and a live token and display board.
Decimal-exact billing with automatic line-item accrual, Ayushman claims, payments, and daily revenue reconciliation, accurate to the paisa.
Enterprise backbone: JWT and role-based access control, per-facility data isolation, Aadhaar encryption, an append-only audit log, AI cost-metering with a kill-switch, and an offline-first PWA.
Screenshots
Overview film
The reel
The whole system, start to finish.
- One patient token moving live through all ten states, from registration to discharge.
- The AI layer triaging, scribing, and flagging, with a clinician confirming every call.
- Nine role consoles staying in lockstep on a single source-of-truth state machine.
System architecture
- Reception
- Nurse
- Doctor
- Lab
- Pharmacy
- Admin
- Lobby board
- Patient PWA
- Lab partner
- Triage
- Intake chatbot
- Clinical brief
- Dual scribe
- Lab vision OCR
- Pharmacy safety
- Event-sourced PostgreSQL
- WebSockets sync
- RBAC + audit log
- Aadhaar encryption
- Offline-first PWA
Project Presentation
12 slides
The full AutoFlow deck: the OPD state machine, the nine role consoles, the AI augmentation layer, and the security and compliance backbone.
Download deck PDF































