What we walked into.
The client needed real insights from dozens of Excel files holding hundreds of thousands of rows each — millions of records in total. Queries like "inpatient data for Crohn's disease patients between 2012 and 2020" or "year-wise hospitalization trends" broke traditional RAG: context windows exhausted, vector search returned partial results, and aggregations came back wrong. For analytical healthcare work, incomplete answers are unusable.
The solution.
A code-first AI analytics architecture built on OpenAI's Code Interpreter instead of a RAG pipeline.
The model acts as a data scientist: it writes Python for filtering, aggregation, and statistical analysis, runs time-bound cohort studies, and generates precise charts and tables.
No vectorization, chunking, or semantic compression — queries over millions of records execute without information loss.
Hardened prompt strategies enforce deterministic, reproducible analysis and consistent chart formats.
Handles generative asks too: "generate 5 clinical case studies from this data" or "summarize long-term anomalies across years."
What changed.
Processed millions of tabular healthcare records with no data loss or sampling errors.
Accurate year-wise and cohort analysis (e.g., 2012–2020 disease trends) that RAG pipelines could not reliably achieve.
Statistically accurate charts generated straight from raw data — no manual validation pass needed.
Work that previously needed analysts and BI tooling now happens through natural-language queries.