Horizon CAPA Dashboard
Text-to-SQL quality management with historical prioritization
Internal enterprise application — built at Takeda Pharmaceutical

The problem
Quality teams needed answers from CAPA, CAPA-Task and Deviation data but depended on analysts to write SQL and build reports. They also wanted to prioritize open items by real precedent, not generic aggregate benchmarks that ignore how similar cases actually resolved.
What it does
Horizon is a text-to-SQL quality dashboard built on the querychat package and Databricks GPT-5. Quality staff query CAPAs, CAPA Tasks and Deviations in plain English — no analyst in the loop.
Historical Similarity Prioritization
The standout feature: the Prioritize button uses LLM tool calling to find semantically similar closed CAPAs, pull each match's actual closure time and task breakdown, and rank open items grounded in that real history rather than aggregate benchmarks. On-demand tool calling keeps prompts at ~500 tokens versus 8–12K for a monolithic prompt that front-loads everything.
- 9-color calendar — 3 record types × 3 urgency levels — with a glowing 'Overdue' KPI card
- Conversational AI advisor with quick actions: Full Analysis, Risk Report, Bottlenecks, By Department, Prioritize
- Conversation memory across 10 turns