Analytics Assistant (NL-to-SQL)
Our role: Led end-to-end: concept, architecture, cloud deployment, and integration.
The Challenge
The client's analytics team was the bottleneck for the entire organization. Business users across clinical and operational departments had to submit SQL query requests, wait days for results, and often go back-and-forth to refine requirements. Non-technical stakeholders had zero direct access to the data warehouse — creating delays in decisions that affected patient care and operational efficiency.
Solution & Approach
We engineered an intelligent assistant that lets anyone ask data questions in plain English. The system uses AWS Bedrock foundation models for natural-language understanding, with a schema-aware query planner that maps user intent to the correct tables, columns, and join paths. Generated SQL is validated against allowed schemas before execution — preventing unsafe or expensive queries. Deployed on ECS for elastic scaling, it handles concurrent users with sub-second query generation.
The hard call — freedom vs. trust. One pipeline can’t be both open enough for exploration and tight enough for must-be-right answers. So we split it by cost-of-wrong: an exploratory path with wide freedom, where the user verifies the result, and a deterministic path that answers high-stakes questions only from vetted, pre-written queries. Rigour matched to the stakes.
- Schema-aware query planning — Maps natural language to the correct warehouse tables, columns, and join paths automatically.
- Guardrails & validation — Generated SQL is validated against allowed schemas before execution, preventing unsafe or expensive queries.
- Conversational context — Supports follow-up questions that refine or drill into previous results without starting over.
- Knowledge transfer — The client’s engineering team was trained to maintain, monitor, and extend the system independently.
Outcome
Delivered as a working pilot. Business users could query the consolidated warehouse in plain English — no SQL, and no waiting in the data team's report queue. Two paths balanced freedom against trust: an exploratory path for open-ended questions, where the user verifies the result, and a deterministic path that answered must-be-right questions only from vetted, pre-written queries. A feedback loop captured each question and its generated SQL, so the system improved with use.
The long version: this build has a field note in our journal — the decisions, dead ends, and judgment calls behind it. Two paths to a trustworthy answer →
Let's discuss your next challenge.
Ready to bring AI-powered intelligence to your organisation?
Start the Conversation