Skip to content
Back to work
R / Shiny / Text-to-SQLRetired 2026 · final v1.1.0

Horizon CAPA Dashboard

Text-to-SQL quality management with historical prioritization

Internal enterprise application — built at Takeda Pharmaceutical

Horizon CAPA quality management dashboard
~500
Tokens per prompt
3
Record types queried
9
Calendar urgency states
10
Turns of memory

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 did

Horizon was a text-to-SQL quality dashboard built on the querychat package and Databricks GPT-5. Quality staff queried CAPAs, CAPA Tasks and Deviations in plain English, with no analyst in the loop.

Historical Similarity Prioritization

The standout feature: the Prioritize button used LLM tool calling to find semantically similar closed CAPAs, pull each match's actual closure time and task breakdown, and rank open items against that real history rather than an aggregate benchmark. Calling tools on demand kept 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 advisor with quick actions: Full Analysis, Risk Report, Bottlenecks, By Department, Prioritize
  • Conversation memory across 10 turns

Why it was retired

Horizon was decommissioned in 2026 in the same consolidation that retired DevSight: the site moved onto standardized global applications, and locally built tools in that space were wound down regardless of how they were performing. v1.1.0 was the final release.

The pattern worth keeping is the on-demand tool call — load context when a question needs it, rather than front-loading a schema and a rulebook into every prompt. That economy is what still keeps token spend down in AMIRA and BioTrack.

Stack

R ShinyquerychatDatabricks GPT-5AWS S3