The problem
STATdata, the public database of the Statistical Office of the Slovak Republic, holds almost 1,000 tables (995 when we checked), each with an eight-character code such as np3106rr. If you want one number, for example the average wage of craft workers in one region, you first have to know which table has it and how to filter it. That is hard for anyone who does not work with the database every day.
What we built
A one-screen assistant over 10 selected STATdata tables. You ask a question in plain Slovak. The assistant picks the table, selects the right values (region, year, indicator), downloads the data through the open API and shows a chart with a source line: table name, code, date of the last update, licence and link. If none of the 10 tables fits, it says so and draws nothing.
Out of scope on purpose: search over all STATdata tables, user accounts and personal question history, and any interpretation of the numbers by the AI model.
How it works
- A fixed catalogue of 10 tables (code, name, description, dimensions, “when to use / when not to use”, example questions).
- A language model makes only two decisions: which table, and which values to filter.
- Code checks the filter (unknown table codes are rejected, missing totals are added, max. 3 rounds per question).
- Code downloads the table from the STATdata API (a ZIP with flat JSON rows), filters it and draws the chart.
- Code writes the source line. No number passes through the model.
How long it took
6–8 hours in total, within one week (26–30 Oct 2026). The plan was 4 hours of build in two blocks.
Technologies
TypeScript · Qwen 3.6 running locally via Ollama · LLM tool calling with a JSON schema · Chart.js · STATdata REST API
The model runs locally via Ollama, so questions and data don’t go to an external AI model provider, and no paid AI API is used.
Data sources and licence
Open data of the Statistical Office of the Slovak Republic, STATdata, licence CC BY 4.0. 10 tables on wages (by occupation and by industry), registered unemployment, unemployment by age and sex, consumer price inflation, regional GDP per capita, life expectancy, tourism accommodation, age at marriage and electricity production. This is a LabZone experiment over open data; it is not a service of the Statistical Office and was not built with or for them.
What we measured
26 Oct 2026, 20 test questions, Qwen running locally via Ollama, temperature 0.
- The test set: 10 direct questions, 4 written in everyday language, 4 that require telling apart two similar tables, and 2 that the catalogue cannot answer.
- Table selection: the model picked the correct table for 20 of 20 test questions over 10 selected Statistical Office of the SR tables. This measures table selection only, not the values in the chart.
- Response time: median 4.5 s per question (min 2.5 s, max 12.0 s), down from a 24.1 s median in an earlier version. The gain came from server settings (smaller context window, model kept loaded, unchanged prompt between questions), not from rewriting the prompt.
- No paid AI API was used.
What we learned
- Picking the table was the easy part. Selecting the right values was harder: for example, counting category totals twice, or overlapping age groups.
- Rules belong in code, not in the prompt. One prompt version forgot to pick the “total” row; a filter check in code now prevents it. The local model did not enforce the list of allowed table codes on its own, so validation in code is required.
- Open data has traps: numbers stored as text, regions and districts in one column, yearly totals next to months, incomplete current year. Catalogue metadata did not always match the data (e.g. stated year ranges).
- Check the data source before the kick-off. The older DATAcube database we planned to use was shut down on 15 Sep 2026; we switched to STATdata on day one.
- A test set written before the build paid off: it let us compare three prompt versions with numbers and catch a regression.
Where this could be used
- An “ask your data” assistant over the tables or reports a public body already publishes.
- An internal assistant that finds the right report, dashboard or table in a company’s own data and shows the source.
- A help desk or newsroom tool that answers “what is the number for X” with a chart and a link, not with a paragraph to trust blindly.
- The same pattern (AI picks, code computes, every answer has a source line) for any catalogue where people get lost among many similar tables.
Who it’s for
Owners and publishers of public data, analysts, and any team whose people keep asking “which table has my number?”.
We store questions without IP addresses for 30 days to evaluate and improve the experiment. We use your IP address only briefly to limit the number of requests and do not store it. Please don't include personal data in your questions.