← BACK TO LEVEL SELECT

🏥 Production ML · ★★★ FEATURED

Medical AI Pipeline

Compliance-grade pipeline that condenses FDA drug monographs into clinician-ready summaries — powered by a homegrown, runtime-configurable prompt-graph engine I built before LangGraph was a thing. ₹2 crores+ revenue in 3 months.

Overview

The brief sounds simple: FDA drug monographs are long, dense, regulated documents, and clinicians need them condensed into something they can actually preview before prescribing. Get one fact wrong and it’s not a bug, it’s a patient. So the whole system had to be compliance-grade — every claim in a summary traceable back to the exact passage it came from.

I owned the AI side end to end: the parser, the prompt system, the orchestration, and the AWS deployment. It generated ₹2 crores+ in revenue within 3 months of launch, processing 10,000+ documents at 95%+ accuracy.

But the number isn’t the interesting part. The interesting part is when this was built.

Architecture

flowchart LR
    SRC["FDA drug monographs<br/>long · dense · regulated"]
    subgraph PARSE["The parser — later grew into XParser"]
        P1["OCR + CV<br/>text · tables · figures"]
        P2["Context-aware chunking<br/>tuned to medical structure"]
    end
    subgraph ENGINE["Prompt-graph engine · AWS Lambda"]
        G["Runtime-built graph<br/>chained prompts + tools"]
    end
    SUM["Condensed monograph<br/>clinician previews → prescribes"]
    XAI["XAI audit trail<br/>every claim traceable"]
    SRC --> P1 --> P2 --> G --> SUM
    G --> XAI

The engine I accidentally built

This was early 2024. LangGraph didn’t exist in any usable form, agent frameworks weren’t a thing yet, and I needed to chain prompts, call tools, and carry memory between steps. So I wrote the whole thing from scratch in Python — endpoint calling, memory management, chain-of-thought prompt chaining where one prompt’s output feeds the next — everything.

The part I’m still proud of is how it handles change. Instead of hard-coding the workflow, the execution plan lives as a configuration JSON in the database: which prompts to pick, what steps to run, which node’s output routes into which node’s input. At runtime, the Lambda reads that config and builds a finite-state prompt graph with memory, then executes it — sequentially or however the config says.

Which means changing the pipeline’s behavior — a new summary style, a reordered reasoning chain, an extra validation step — is a JSON edit, not a redeployment. The business could reshape the workflow at runtime while the code stayed frozen and audited. For a compliance-grade system, that separation turned out to matter a lot.

flowchart TD
    CFG[("Config JSON · in the DB<br/>steps · prompts · routing")]
    PDB[("Prompt store<br/>200+ versioned prompts<br/>rollback built in")]
    subgraph LAMBDA["AWS Lambda — one engine, any workflow"]
        BUILD["Graph builder<br/>reads config at runtime"]
        subgraph FSG["Finite-state prompt graph"]
            N1["extract<br/>prompt node"]
            N2["reason<br/>chain-of-thought node"]
            N3["tool call<br/>parser endpoint"]
            N4["compose<br/>summary node"]
        end
        MEM[("Graph memory<br/>any node's output, routable<br/>to any later node")]
    end
    OUT["Summary + XAI trace"]
    CFG --> BUILD
    PDB -.-> BUILD
    BUILD --> N1 --> N2 --> N3 --> N4 --> OUT
    N1 & N2 & N3 --> MEM
    MEM -.-> N4

Only after delivering did it click what this had quietly become: LangChain/LangGraph, before I’d ever touched either. When I later adopted the real frameworks, nothing about them surprised me — I’d already had to invent the same shapes, and I knew exactly why every piece existed.

Prompt ops at 200+ scale

The system ran on 200+ production prompts, and at that count “prompts in the code” is a liability. So I built a small prompt-management framework of my own: prompts version-controlled, stored in the database, with rollback — change a prompt, and if quality dips, roll back like any other deploy. This is standard practice now; it wasn’t then.

What it shipped

  • ₹2 crores+ revenue within 3 months of launch
  • 10,000+ documents processed at 95%+ extraction accuracy
  • FDA compliance-grade — XAI workflows so every generated claim is auditable back to its source passage
  • The parser born here grew into XParser, sold at $100K+ per deployment to healthcare clients in the US and Europe — that story has its own page
  • A runtime-configurable orchestration engine that let the business change AI behavior without a single redeploy