Skip to content

Commit 1bad10b

Browse files
committed
Add UK-AIR station thumbnails
1 parent 738597c commit 1bad10b

4 files changed

Lines changed: 83 additions & 4 deletions

File tree

docs/research/new-publisher-source-planning/UK_AIR_Publisher_Completion_Report_2026-05-26.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,22 @@ Two UI polish issues were found and fixed in the Explorer repo:
130130

131131
The UK-AIR symbol rule now maps air-quality stations to the same friendly emplaced sensor family used for Environment Agency Hydrology, USGS Water, CO-OPS, NDBC, and weather station markers.
132132

133+
## Representative Station Thumbnails
134+
135+
The UK-AIR SOS / 52 North API was checked for station and timeseries media fields. It exposes useful station/timeseries metadata, coordinates, units, pollutant URIs, and latest values, but no station photo or thumbnail media. Representative imagery was therefore selected from Wikimedia Commons / Geograph Britain and Ireland using reusable CC BY-SA 2.0 images that depict actual UK air-quality monitoring stations.
136+
137+
Selected images:
138+
139+
| Demo station | Image | Author | License | Rationale |
140+
| --- | --- | --- | --- | --- |
141+
| Camden Kerbside | `Air Quality Monitoring Station - geograph.org.uk - 2573031.jpg` | Jonathan Thacker | CC BY-SA 2.0 | Roadside/industrial monitoring cabinet is the closest visual match for an urban kerbside NO2 site. |
142+
| Auchencorth Moss | `Air-quality monitoring station, Dundonald - geograph.org.uk - 3201697.jpg` | Albert Bridge | CC BY-SA 2.0 | Vegetated/background cabinet is a better fit for a rural background ozone station than the roadside cabinet. |
143+
| Toft Newton | `Air-quality monitoring station, Dundonald - geograph.org.uk - 3201697.jpg` | Albert Bridge | CC BY-SA 2.0 | Used as a representative background particulate monitoring station image because no Toft Newton station photo is exposed by UK-AIR. |
144+
145+
The station image metadata is stored in `publishers/uk_air/stations.json` and emitted by `bootstrap_uk_air.py` as SensorML `documents` entries with role `http://dbpedia.org/resource/Photograph`, `image/jpeg` media type, source page, author, source, and license attribution. The live OSH server accepted a forced SensorML update for all three UK-AIR systems, and read-back confirmed the image documents persisted.
146+
147+
Explorer also carries a UK-AIR thumbnail fallback for resilience, but the local validation used the live SensorML media path: the side card for `UK-AIR Auchencorth Moss` rendered the Dundonald representative station image with natural dimensions `632 x 570`.
148+
133149
## Validation Commands
134150

135151
```powershell
@@ -138,6 +154,7 @@ py -m publishers.uk_air.uk_air_publisher --dry-run --once
138154
py -m publishers.uk_air.bootstrap_uk_air --dry-run
139155
py -m publishers.uk_air.bootstrap_uk_air
140156
py -m publishers.uk_air.uk_air_publisher --once
157+
py -m publishers.uk_air.bootstrap_uk_air --force-sml
141158
```
142159

143160
All final validation commands completed successfully.
@@ -148,10 +165,10 @@ Explorer validation command:
148165
npm --prefix demo run build
149166
```
150167

151-
The patched Explorer build completed successfully and was validated locally through Vite preview at `http://127.0.0.1:4174/` against the live `OSH (OS4CSAPI)` backend.
168+
The patched Explorer build completed successfully and was validated locally through Vite preview at `http://127.0.0.1:4174/` against the live `OSH (OS4CSAPI)` backend. The validation confirmed the UK-AIR thumbnail image appears in the deployed-system side card.
152169

153170
## Follow-Up Items
154171

155-
1. After the Explorer deployment completes, spot-check production again to confirm the patched `Air Quality Site` label and value/unit spacing are live.
156-
2. Consider adding a representative monitoring-station image/fallback after a verified public image source is selected, following the Environment Agency Hydrology pattern.
172+
1. After the Explorer deployment completes, spot-check production again to confirm the patched `Air Quality Site` label, value/unit spacing, and thumbnail fallback are live in the production bundle.
173+
2. Consider replacing representative images with exact station photos if Defra/UK-AIR later publishes station-specific media under reusable terms.
157174
3. Consider expanding the curated sidecar after demo validation, especially for additional urban NO2/PM sites and rural background stations.

publishers/uk_air/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ Source data comes from the UK-AIR SOS / 52 North Timeseries REST API:
1515
- https://uk-air.defra.gov.uk/data/sos/static/doc/api-doc/
1616
- https://uk-air.defra.gov.uk/sos-ukair/api/v1/
1717

18+
Station thumbnails use representative UK air-quality monitoring station photographs from Wikimedia Commons / Geograph Britain and Ireland because the UK-AIR API exposes no station photo media:
19+
20+
- Camden Kerbside uses a roadside monitoring-station cabinet photograph by Jonathan Thacker, CC BY-SA 2.0.
21+
- Auchencorth Moss and Toft Newton use a vegetation/background monitoring-station cabinet photograph by Albert Bridge, CC BY-SA 2.0.
22+
1823
## Bootstrap
1924

2025
```bash
@@ -42,3 +47,4 @@ Use `--stations` with comma-separated curated site IDs, such as `camden-kerbside
4247
- Source units such as `ug.m-3` are preserved in observation results as `unit`, while SWE schemas use the display-friendly `ug/m3` code.
4348
- The first-pass model consolidates co-located pollutant streams only where the source metadata clearly supports it, such as Toft Newton PM10 and PM2.5.
4449
- Explorer cards should show latest pollutant concentrations in the same latest-reading section used by other station-style publishers.
50+
- Explorer cards should show the representative thumbnail from SensorML `documents` when the server preserves it; the Explorer also carries a UK-AIR fallback while current OSH system SensorML update behavior is uneven.

publishers/uk_air/bootstrap_uk_air.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,32 @@
4444
OGL3 = "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
4545

4646

47+
def _image_docs(station: dict) -> list[dict]:
48+
image = station.get("image") or {}
49+
if not image.get("url"):
50+
return []
51+
description = image.get("description") or "Representative UK air quality monitoring station image."
52+
attribution = "; ".join(part for part in [
53+
image.get("author"),
54+
image.get("source"),
55+
image.get("license"),
56+
] if part)
57+
return [
58+
{
59+
"role": "http://dbpedia.org/resource/Photograph",
60+
"name": image.get("name") or "Representative air quality monitoring station image",
61+
"description": f"{description} Attribution: {attribution}.",
62+
"link": {"href": image["url"], "type": "image/jpeg"},
63+
},
64+
{
65+
"role": "http://dbpedia.org/resource/Web_page",
66+
"name": "Representative image source and license",
67+
"description": f"Image source page and reuse terms ({image.get('license', 'license documented at source')}).",
68+
"link": {"href": image.get("pageUrl") or image["url"], "type": "text/html"},
69+
},
70+
]
71+
72+
4773
def _load_stations() -> list[dict]:
4874
here = os.path.dirname(os.path.abspath(__file__))
4975
with open(os.path.join(here, "stations.json"), encoding="utf-8") as f:
@@ -156,7 +182,7 @@ def _system_stub(station: dict) -> dict:
156182
def _system_sml(station: dict) -> dict:
157183
site_id = station["siteId"]
158184
pollutant_labels = ", ".join(s["pollutantCode"] for s in station.get("timeseries", []))
159-
docs = [
185+
docs = _image_docs(station) + [
160186
{
161187
"role": "http://dbpedia.org/resource/Web_page",
162188
"name": "UK-AIR Representative Timeseries",

publishers/uk_air/stations.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
"siteType": "urban roadside",
1616
"stationUrl": "https://uk-air.defra.gov.uk/sos-ukair/api/v1/timeseries/3",
1717
"selectionReason": "Recognizable London roadside nitrogen dioxide station with recent hourly values.",
18+
"image": {
19+
"url": "https://upload.wikimedia.org/wikipedia/commons/0/0e/Air_Quality_Monitoring_Station_-_geograph.org.uk_-_2573031.jpg",
20+
"pageUrl": "https://commons.wikimedia.org/wiki/File:Air_Quality_Monitoring_Station_-_geograph.org.uk_-_2573031.jpg",
21+
"name": "Representative roadside air quality monitoring station",
22+
"description": "Representative UK air quality monitoring station cabinet, used for the urban roadside Camden Kerbside demo site because the UK-AIR API exposes no station photo.",
23+
"author": "Jonathan Thacker",
24+
"source": "Geograph Britain and Ireland via Wikimedia Commons",
25+
"license": "CC BY-SA 2.0",
26+
"licenseUrl": "https://creativecommons.org/licenses/by-sa/2.0/"
27+
},
1828
"timeseries": [
1929
{
2030
"timeseriesId": "3",
@@ -41,6 +51,16 @@
4151
"siteType": "rural background",
4252
"stationUrl": "https://uk-air.defra.gov.uk/sos-ukair/api/v1/timeseries/24",
4353
"selectionReason": "Rural background ozone station with recent hourly values.",
54+
"image": {
55+
"url": "https://upload.wikimedia.org/wikipedia/commons/7/75/Air-quality_monitoring_station%2C_Dundonald_-_geograph.org.uk_-_3201697.jpg",
56+
"pageUrl": "https://commons.wikimedia.org/wiki/File:Air-quality_monitoring_station,_Dundonald_-_geograph.org.uk_-_3201697.jpg",
57+
"name": "Representative background air quality monitoring station",
58+
"description": "Representative UK air quality monitoring station cabinet in a vegetated setting, used for Auchencorth Moss because the UK-AIR API exposes no station photo.",
59+
"author": "Albert Bridge",
60+
"source": "Geograph Britain and Ireland via Wikimedia Commons",
61+
"license": "CC BY-SA 2.0",
62+
"licenseUrl": "https://creativecommons.org/licenses/by-sa/2.0/"
63+
},
4464
"timeseries": [
4565
{
4666
"timeseriesId": "24",
@@ -67,6 +87,16 @@
6787
"siteType": "background particulate monitoring",
6888
"stationUrl": "https://uk-air.defra.gov.uk/sos-ukair/api/v1/timeseries/5125",
6989
"selectionReason": "Co-located PM10 and PM2.5 timeseries with recent hourly values.",
90+
"image": {
91+
"url": "https://upload.wikimedia.org/wikipedia/commons/7/75/Air-quality_monitoring_station%2C_Dundonald_-_geograph.org.uk_-_3201697.jpg",
92+
"pageUrl": "https://commons.wikimedia.org/wiki/File:Air-quality_monitoring_station,_Dundonald_-_geograph.org.uk_-_3201697.jpg",
93+
"name": "Representative background particulate monitoring station",
94+
"description": "Representative UK air quality monitoring station cabinet in a vegetated setting, used for Toft Newton because the UK-AIR API exposes no station photo.",
95+
"author": "Albert Bridge",
96+
"source": "Geograph Britain and Ireland via Wikimedia Commons",
97+
"license": "CC BY-SA 2.0",
98+
"licenseUrl": "https://creativecommons.org/licenses/by-sa/2.0/"
99+
},
70100
"timeseries": [
71101
{
72102
"timeseriesId": "5125",

0 commit comments

Comments
 (0)