Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/korp-collectors

.nornir/collectors/smhi-weather.md

Collector: smhi-weather (adopted — WAVE 2, batch 6)

The SMHI weather-station geometry daemon. Fetches an SMHI open metobs parameter station-set (.../parameter/<n>.json — the station[] array; CC-BY 4.0, no key) and lands each station as a point row. Adopted to the daemon architecture (../collectors-daemon-design.md, §11) as a warehouse-sink (Iceberg) daemon. Implementor: src/iceberg_daemons.rs (SmhiWeatherDaemon, parse_smhi_weather), behind --features daemon. Rides rest::parse_records driven by the RestCollector::smhi_weather() preset field map (records at /station). It is the station GEOMETRY the metobs value series joins back to.

Config trait (Settings ▸ Collectors ▸ smhi-weather)

enabled:   bool
url:       String   // parameter station-set  (default …/parameter/1.json = air temperature)
parameter: String   // advisory — the metobs parameter number, encode in the URL
table:     String   // Iceberg table          (default smhi_weather)

State machine (State trait)

Offline → Downloading(fetch %) → Indexing(parse JSON) → Online     // station rows landed
        → Failed{reason}                                           // empty-is-RED / fetch/parse error

The State Facet renders sink=iceberg, phase, table, rows_written, last_run_unix, error. Green only when ≥1 station row is landed.

Storage — Iceberg (warehouse-sink)

Rows land through CollectorCtx.warehouse into smhi_weather (columns: station_key, name, owner, lat, lon, height, active). No S3 bucket.

Acquisition — the fetch seam (GET)

The station-set JSON is fetched through CollectorCtx.fetch GET (korp = rustls HTTP core; tests = Fetcher::from_map, no live gov API). Fetch + parse run off the async reactor via spawn_blocking.

empty-is-RED

A parameter set with an empty station[] parses to 0 rows → Failed{…empty-is-RED} (red), never a silent green.

Tests (src/iceberg_daemons.rs + tests/collector_daemons_register.rs)

Credential note

Open API, no key — fully exercised live and offline (the offline sample proves the parse → Arrow shape; SMHI is reachable without a credential).