Clarity.
Customer data, queried in plain English.
Clarity lets customers ask questions about their data and download CSV reports. I built on a colleague’s Java prototype, developed the query, reporting and access controls, and took the service into production.
- My role
- Developed the service and took it to production
- Context
- Loweconex
- Built with
- Java · Spring Boot · Spring AI · PostgreSQL · Kubernetes

01
Getting an answer from the database
Our customers operate sites such as supermarkets and warehouses, with sensors and HVAC equipment reporting into their databases. Getting a report meant knowing the schema or raising a ticket with someone who did.
Clarity identifies the relevant tables, runs a query and returns the answer with its SQL. Users can inspect that query or download the results as a CSV.
02
Schema context and query controls
A nightly job compiles a document describing each customer’s tables and relationships. The model uses that document as its starting point and can fall back to live schema discovery. This did not require a vector database.
Generated SQL is lexed and validated before execution. Comments can disguise a table reference such as FROM/**/pg_tables, so a simple text match is insufficient. Queries run with a read-only role, row limits and timeouts. If the read-only connection is unavailable, the request fails.
CSV reports stream to storage rather than being assembled in memory, allowing the service to handle larger exports.
03
Checking the response against the query
“Which sites are running hottest?” should have been a straightforward question. Clarity said no data was available, even though the database contained it. The request looked successful in the logs. The customer would still have received the wrong answer.
I added checks that compare the final response with the tool results: whether the query succeeded, whether named items appear in the returned data, and whether a claimed action actually happened. The application also limits tool calls and request rates.
04
In production
Customers can now ask questions and export reports without writing SQL or waiting for a reporting ticket. The production service includes tracing and usage records by customer and feature, with checks in the dev and QA delivery path.
Demo
Try an example.
This example uses sample data. It is not connected to customer systems.
What are the freezer temperatures across my northern sites?
Every query this turn failed, yet the answer presents data. Nothing produced those numbers.
Heimdall
See where a change has reached.