Add OCD-IDs for UK Scottish Parliament, Senedd, wards, and CEDs - #433
Add OCD-IDs for UK Scottish Parliament, Senedd, wards, and CEDs#433MiniCodeMonkey wants to merge 2 commits into
Conversation
Closes the gaps in country-gb coverage flagged by downstream consumers that key on OCD-IDs: * Scottish Parliament: 73 constituencies + 8 regions (`spc:` / `spr:`) * Senedd / Welsh Parliament: 40 + 16 constituencies + 5 regions, with validFrom/validThrough markers for the May 2026 boundary flip (`senc:` / `senr:`) * Wards: 8,396 UK-wide wards (`ward:<gss>`) * English county electoral divisions: 1,366 entries (`ced:<gss>`) Wards and CEDs key the slug on the canonical ONS GSS code rather than a name slug because UK ward names collide nationally (e.g. there are 21 distinct "Castle" wards). Constituencies and regions retain name-based slugs since their names are unique within type. Path scheme matches the prefixes (spc, spr, ward, ced) listed in the existing scripts/country-uk/README.md, brought under the active country:gb/part:<nation>/ tree. Body-name update: senc/senr replace the old nawc/nawr (the body has been called "Senedd" since 2020). Senedd 2026 source: DataMapWales senedd_final_2026 (Welsh Government, OGL v3.0). 16 placeholder GSS codes W92000001-W92000016 -- ONS hasn't published canonical 2026 codes yet. NI Assembly is intentionally not included: post-2023 OSNI review the boundaries are byte-identical to NI Westminster constituencies, so those `ed:` rows already serve. Tested with `python3 test/compile_test.py` (TEST_TMPDIR set).
* Add a `gss_code` extra column to scottish_parliament.csv, senedd.csv, wards.csv, county_electoral_divisions.csv -- mirrors the column carried by the older country-uk files and the stalled opencivicdata#186 migration so consumers can crosswalk OCD-IDs <-> GSS codes without a separate lookup. * Expand README with explicit context on: - why senc/senr (modern ONS column codes, post-2020 Senedd rename) rather than the nawc/nawr used by opencivicdata#186 (which predates the rename) - the unresolved hierarchy debate raised in opencivicdata#170 / opencivicdata#184 / opencivicdata#186 -- this PR follows the current merged convention but is willing to flip to the flat scheme if reviewers prefer.
|
#184 remains unresolved, but that's about what to do about the old uk. In the meantime, I'd say we are unconstrained about gb. Per the discussion in #184, I don't see a principled reason to have a proliferation of types like spc, spr, senc, senr, etc. especially when these types get renamed whenever a political body chooses to rename itself. My understanding is that ONS organizes itself such that anything with the label "senc" is a Senedd / Welsh Parliament constituency – such that if the maintainers for Canada used that type for a different purpose, it would imply that there is a Senedd / Welsh Parliament constituency in Canada. This project doesn't organize itself that way. As such, we can simplify and use e.g. GSS sounds fine to me. Canada also used numeric codes, but when these became unstable across vintages (and when we wanted to extend coverage into the past, for which we had no IDs), we switched to full names (and aliased the old numbers). It sounds like for gb we'd have to add local authorities to avoid numbers. |
Summary
Closes the OCD-ID coverage gap that downstream consumers run into when working with UK political districts.
country-gb.csvpreviously only carried Westminster (/ed:) constituencies; this PR adds the four largest missing categories:spc)country:gb/part:sct/spc:<slug>spr)country:gb/part:sct/spr:<slug>senc)country:gb/part:wls/senc:<slug>senr)country:gb/part:wls/senr:<slug>ward)country:gb/part:<nation>/ward:<gss>ced)country:gb/part:eng/ced:<gss>Total: ~9,900 new identifiers. NI Assembly is intentionally not touched -- post the 2023 OSNI review the boundaries are byte-identical to NI Westminster constituencies, so those
ed:rows already serve.Conventions
The path scheme follows the existing merged convention in
constituencies.csv(extended most recently in #385). I've also added agss_codeextra column on every row that maps to a single ONS GSS code, mirroring the oldercountry-ukfiles and #186 so consumers can crosswalk OCD-IDs ↔ GSS codes without a separate lookup.A few specific calls worth flagging for review:
Type prefixes follow ONS column codes:
spc/spr(Scottish Parliament constituency / region),senc/senr(Senedd constituency / region),ward,ced. These match modern ONS naming -- in particularsenc/senrrather than the oldernawc/nawrbecause the body was renamed from "National Assembly for Wales" to "Senedd / Welsh Parliament" in 2020 and ONS now shipssenc22cd/senr22cdcolumns. Happy to switch tonawc/nawrfor backwards parity with migrate country:uk ids to country:gb v1 #186 if that's preferred.Hierarchy retained (
country:gb/part:sct/spc:slug) for consistency with the currentconstituencies.csvrather than going flat (country:gb/spc:slug) per migrate country:uk ids to country:gb v1 #186. The original objection in Incorrect Country Code used for United Kingdom #184 that hierarchy implies geographic scope is specifically about Westminster (a UK-wide body); for Scottish Parliament / Senedd the part-nation nesting is geographically truthful. Either way the typed prefix carries the disambiguation, so I'm fine flipping to flat if reviewers want to pull the trigger on the migrate country:uk ids to country:gb v1 #186 direction in this PR -- just let me know.Wards keyed on GSS, not name, because UK ward names collide nationally (21 distinct "Castle" wards). They're nested under
part:<nation>rather thanlad:orcouncil:since this repo doesn't yet have UK Local Authority District identifiers; adding those is a much bigger change and out of scope here.Senedd 2026 transition marked with
validThrough=2026-05-05on the 40+5 old rows andvalidFrom=2026-05-06on the new 16 rows. The new rows use placeholder GSS codesW92000001-W92000016(DataMapWales' internal numbering) because ONS hasn't published canonical 2026 GSS codes yet; once they do, those rows will need asameAsplus a refreshedgss_code.Sources
Validation
python3 test/compile_test.pypasses (TEST_TMPDIR set).identifiers/country-gb.csvis included in the diff.scripts/compile.py.Refs
gss_codecolumn convention.cc @chris48s @jpmckinney @sguenther85 -- given the unresolved conventions discussion in #170 / #184, would appreciate your steer on the hierarchy + prefix choices before this gets too far.