query_data
Retrieve official statistics for Irish and UK areas: list available datasets, get figures and history for one area, or view council planning application data.
Instructions
Use when you need to find which datasets exist, which exist for one area, or the figures and history
for one area and dataset (or a council planning view). For what a metric means use explain_metric;
for how areas rank use compare.
Three modes, depending on which of area_id/dataset are given (plus a planning mode, council, described last) --
consolidates what were three separate tools (list_datasets,
list_area_datasets, get_dataset_for_area) behind one, since they are all
really "how do I get data" at different levels of specificity:
Neither
area_idnordataset: lists every dataset (stat) StatsMapped tracks for one country ('ireland' or 'united-kingdom'), with its key, human label, and which geography levels it can be shown at. Ireland and the UK track genuinely different datasets -- call this first for the right country before assuming a stat_key exists there, to find the rightstat_keyforcompare's ranking mode.area_idgiven,datasetomitted: lists every dataset available for that one area (e.g. "county:kerry" for Ireland, "uk:lad:e09000033" for the UK), with its latest figure, year-on-year change, and caveat labels only (not full caveat text -- use mode 3 for the full detail on any one dataset that matters). Passstat_key(from mode 1) to list only that stat's series for the area: a full listing is tens of KB, one stat is a few hundred bytes.area_idcomes fromlist_areas;countrymust match whichever country that call used, or this simply 404s ("unknown geography").Both
area_idanddatasetgiven: full detail for one dataset in one area -- the latest figure, a written summary, full caveat text, and (ifhistory_monthsis set) recent history.datasetis aseries_keyfrom mode 2's own response.history_monthsmeans actual months of history (0 = everything) -- e.g. 24 returns 2 years of an annual series, not 24 years.countrymust matcharea_id's own country. A stat key from mode 1 is also accepted asdatasetwhen the area has exactly one series for it (the reply saysresolved_from_stat_key); with several, the error names the series keys to use.councilalone (an Irish council slug, e.g. "cork-city-council"; country "ireland" only; no other argument): that council's planning applications by year received -- count, grant and refusal share of decided applications, median days to a decision -- with source, licence, the last data date, a receipt, plain notes, and typedabsencesinstead of zeros. A council the national planning feed has stopped carrying (for example Cork City, last record 2025-11-04) saysstatus: "stopped_reporting": a low recent figure is a feed gap, not fewer applications. Example: query_data(council="cork-city-council").datasetandhistory_monthsare only meaningful together witharea_id(and, forhistory_months,datasettoo, since it only applies to mode 3); giving either without its real precondition raises rather than silently dropping the argument and dispatching to the wrong mode.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| area_id | No | ||
| council | No | ||
| country | No | ireland | |
| dataset | No | ||
| stat_key | No | ||
| history_months | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |