aggregate
Compute a grouped aggregate over one topic — the aggregation-first path. agg is one of avg/sum/min/max/count/weighted_rate; metric is a metric column (DEFAULTS to the topic key_metric; ignored for count); group_by is a list of grain columns (year, FK codes like district_code or county_fips, or categoricals — see describe_dataset). weighted_rate computes a true population-weighted SUM(numerator)/SUM(denominator) for a rate key metric (when the contract declares the components) — prefer it over avg for a rate across multiple places/years, since avg means the per-row rates and ignores population. Supports the same filters / year / year_min-year_max / detail as query_dataset, plus order_by+order for top-N (order_by 'value' for the aggregated column; NULL cells sort LAST in either direction). Returns one small row per group with <metric>_<agg> (or row_count) plus coverage diagnostics (input_rows / non-null counts) so suppression is visible; aggregation_scope flags whether rows are source-published at this grain or recomputed from a finer detail (prefer source-published — see the advisory). Aggregates SKIP NULLs and NULL means SUPPRESSED not zero. No raw SQL: all identifiers are contract-allowlisted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agg | No | avg | |
| year | No | ||
| limit | No | ||
| order | No | asc | |
| topic | Yes | ||
| detail | No | ||
| metric | No | ||
| offset | No | ||
| filters | No | ||
| group_by | No | ||
| order_by | No | ||
| year_max | No | ||
| year_min | No | ||
| main_topic | No | education |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||