AI systems, 2026
PharmaTrace
Six LLM agents check a medicine against three drug registries and refuse to invent medical terms.
- Role
- Personal project
- Type
- AI systems
- Links
- Source on GitHub
- LangGraph agents
- 6
- drug registries
- 3
- voice languages
- 4
How it fits together
- React 19 PWATesseract OCR, Whisper voice in 4 languages, IndexedDB outbox
- scan or speak
- FastAPIStrict Pydantic schemas and the jargon firewall
- 6-agent graph
- LangGraphBarcode, FDA lookup, recall, interaction, safety and report agents
- asyncio.gather
- RegistriesOpenFDA, RxNav / RxNorm, CDSCO, FAERS signals
- validated output
- Report + auditSeverity-sorted warnings, SHA-256 hash-chained log in Supabase
The problem
Checking whether a medicine is genuine, recalled or unsafe for a particular patient means cross-referencing several registries that disagree in format. An LLM can summarise that well, but it also likes to make up confident clinical terms, which is the one thing a health tool cannot do.
How I approached it
- 1
Split the job into agents
A LangGraph pipeline with six agents (barcode, FDA lookup, recall, interaction, safety, report) over OpenFDA, RxNav and India's CDSCO registry. Independent lookups run in parallel with asyncio.gather to cut end-to-end latency.
- 2
Replace counts with signal
Naive adverse-event report counts were replaced with NLM RxNorm clinical mapping, FAERS signal strength and severity-sorted warnings.
- 3
Constrain the model
Strict Pydantic schemas plus a field-validator 'jargon firewall' structurally block hallucinated medical terminology. Patient age, weight and renal function are injected into prompts to trigger dosage warnings.
- 4
Work offline
A React 19 PWA with in-browser Tesseract OCR for expiry dates, IndexedDB caching and a Background Sync outbox for poor connectivity.
What I built
- Whisper-based voice input in Malayalam, Hindi, Tamil and English.
- Every verification is written to a SHA-256 hash-chained audit log, so tampering with history is detectable.
- Deployment configs for Railway (API) and Vercel (PWA).
The result
A verification flow that answers in the user's language, keeps working without a network, and returns warnings that are traceable to a registry rather than to the model's imagination.
Built with
- Python
- FastAPI
- LangGraph
- Pydantic
- Llama 3.3
- Whisper
- React
- PWA
- Supabase
- PostGIS
- Tesseract