PxWeb Statistics Extractor
Pricing
from $0.35 / 1,000 records
PxWeb Statistics Extractor
Point at ANY PxWeb statistical service (SCB Sweden, StatFi Finland, Norway, Iceland…): name a table and get flat, fully labeled statistics — one row per cell. Decodes index-encoded JSON-stat2, joining every dimension to its code + name. Discovery walks the subject tree. Pay per record.
Pricing
from $0.35 / 1,000 records
Rating
0.0
(0)
Developer
Datamule
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
0
Monthly active users
a day ago
Last modified
Categories
Share
Point at ANY PxWeb statistical service and get flat, fully-labeled statistics — one row per cell.
PxWeb (the open-source PC-Axis dissemination platform maintained by Statistics Sweden) is deployed by dozens of national and regional statistical offices — Statistics Sweden (SCB), Statistics Finland (StatFi), Norway, Iceland, Greenland and many more. Every one of them speaks the identical REST grammar: navigate a subject tree → GET a table's metadata → POST a dimension query → receive a compact JSON-stat2 dataset.
Most scrapers re-implement one country at a time. This actor is the generic decoder: point it at a PxWeb API root, name a table (or let it discover them), and it turns the compact, index-encoded JSON-stat2 into flat rows — one row per statistical cell, every dimension decoded to both its code and its human-readable name.
The value is the decode
A raw JSON-stat2 dataset is just a flat number array plus a shape:
{ "id": ["Region","Kon","ContentsCode","Tid"], "size": [1,2,1,1],"value": [5312519, 5239188], "dimension": { ...category index + label maps... } }
That array is meaningless without joining every linear index back to its per-dimension
category. This actor does exactly that — it walks value[] in row-major order, maps each
linear index to its per-dimension category position, and emits real columns:
| Region | Region_label | Kon | Kon_label | metric | metricLabel | timePeriod | value | unit |
|---|---|---|---|---|---|---|---|---|
| 00 | Sweden | 1 | men | BE0101N1 | Population | 2023 | 5312519 | number of persons |
| 00 | Sweden | 2 | women | BE0101N1 | Population | 2023 | 5239188 | number of persons |
Input
| Field | Description |
|---|---|
| serviceRoot (required) | The PxWeb REST API root, e.g. https://api.scb.se/OV0104/v1/doris/en/ssd (SCB Sweden) or https://pxdata.stat.fi/PxWeb/api/v1/en/StatFin (StatFi Finland). |
| tablePath | Path (relative to the root) to a leaf .px table to query, e.g. BE/BE0101/BE0101A/BefolkningNy or synt/12dj.px. Leave empty or point at a navigation level to discover instead. |
| query | Optional explicit dimension selection. Simple form {"Region": ["00"], "Kon": ["1","2"], "Tid": ["2023"]} or the native PxWeb array. Leave empty to auto-select (see below). |
| lastNPeriods | When auto-selecting, how many of the most recent time periods to fetch. Default 1. |
| discoveryRecurse / maxDepth | In discovery mode, walk the subject tree depth-first and emit every leaf table found. |
| maxRecords | Cap on rows emitted (each row = one billable record). |
| bearer / extraHeaders | Optional auth for gated services. Never required for public dissemination, never logged. |
Auto-query (no query supplied)
The actor builds a small, always-valid query from the table's metadata: the last N periods of the time dimension, all values of small mandatory dimensions, and it aggregates over eliminable dimensions (so you get the grand total instead of a combinatorial cell explosion). This returns real data on any table without you having to know its dimensions up front.
Modes (auto-selected)
- Data — the path points at a leaf table → GET metadata → POST query → decode JSON-stat2 into one labeled row per cell.
- Discovery — the path points at a navigation level (or is empty) → list the subject-tree nodes so you can find tables. Turn on Recurse to walk levels and emit leaf tables with their full paths.
Output
One flat row per cell (data mode) or per navigation node (discovery mode). Every dimension
becomes a {CODE} + {CODE}_label column pair; canonical timePeriod / metric /
metricLabel / value / unit / decimals columns are promoted from the JSON-stat2 roles;
source, label, updated, tablePath provenance is stamped on every row; and a lossless
_raw object keeps the exact cell coordinates, codes, labels and value.
Empty results (a query that matches nothing, an empty table) return 0 records and a clean exit — never a crash, never fabricated data.
Pricing
Pay-per-event: one record charge per emitted row.
Notes
- Two PxWeb dialects exist: the classic grammar (
/PxWeb/api/v1/{lang}/...and SCB'sdorisvariant) is fully supported; the Statbank REST variant (api.statbank.dk/v1/...) is best-effort for navigation. - PxWeb servers cap the number of cells per query. If a selection exceeds the cap the actor automatically retries with a reduced selection.
- JSON-stat2 is requested explicitly (
format: json-stat2) and decoded by itssize/id/dimensionshape. - No authentication is needed for public statistics dissemination.