Skip to main content

Voluntary organisations per kommune, total

Atlas view

Voluntary organisations per kommune, total

api_v1.kommune_ngo_totals

One row per kommune: how many active voluntary organisations are registered there.

Built from​

This Atlas view joins data from the following upstream sources. Click through for provenance, methodology, and citation.

Showing direct dbt parents. See full lineage in /lineage/ →

Columns​

ColumnDescription
kommune_nr4-digit kommune code. FK to dim_kommune.
kommune_nameKommune name in bokmål, joined from dim_kommune.
active_countTotal active voluntary organisations in this kommune, summed across ICNPO categories. Always >= 1; a kommune with none has no row.

Sample query​

Live PostgREST query that returns the first 5 rows. URL adapts to the current host — local dev shows api-atlas.localhost; the deployed site shows the configured API base.

https://api-atlas.urbalurba.com/kommune_ngo_totals?limit=5

About this view​

One row per kommune: how many active voluntary organisations are registered there. One row per kommune: how many active voluntary organisations are registered there. 357 rows instead of the ~5 400 in kommune_ngo_summary. Published as api_v1.kommune_ngo_totals. Exists because PostgREST cannot sum — `?select=active_count.sum()` returns PGRST123, aggregates are disabled — so a consumer wanting one number per kommune otherwise fetches every category row and adds them client-side. That was most of a cold page load (urb-agents #1265). ⚠️ Counts exclude the 10.3 % of active voluntary units carrying no kommune_nr, exactly as kommune_ngo_summary does. Summing this gives the placed total, not the register total. ⚠️ CHANGED 2026-09-21: SSB's 9999 'Uoppgitt' is no longer included. It is a current code, so `is_active` never excluded it, and this relation had been reporting a place that does not exist. Counts drop by that row. `dim_kommune` still carries 9999 — the dimension mirrors SSB's list — and the value is published in `unattributed_totals` (urb-agents #1301). ⚠️ COST, AND ONE LOAD-BEARING DEPENDENCY. Measured end-to-end against the live API: 0.12 s filtered by kommune_nr, 0.205-0.326 s unfiltered for all rows. Before the covering index on dim_brreg_enhet it was 25 s cold for a 24 kB response and one request timed out. That index is not an optimisation — drop it and this relation is unusable rather than slow.