-
Notifications
You must be signed in to change notification settings - Fork 18
Boundary Reviews (2)
After the first election using a new set of boundaries has happened, a BoundaryLine release will be published containing the finalised boundaries and GSS codes. When this happens, we want to retrospectively replace the LGBCE boundaries and temp codes with GSS codes and boundaries from Ordnance Survey. There are 2 steps to this process:
boundaryline_backport_codes takes a reference date and a BoundaryLine release. The reference date is used to work out which DivisionSets are valid for the BoundaryLine release so should be after the start date of the relevant DivisionSets e.g:
manage.py boundaryline_backport_codes 2018-05-04 -u "http://parlvid.mysociety.org/os/bdline_gb-2018-05.zip"
NB 2018-05-04 is the Friday after an election Thursday - which will be the start date for lot's of DivisionSets
- Pass
--dry-runto get a report of what it will do without commiting changes - Pass
-v 2for extra debug info - There will usually be a handful of areas which we couldn't automatically attach a code to. These will require manual follow-up. Usually these will be due to minor differences in the ward name between the LGBCE data and BoundaryLine. The remaining manual edits can be made via /admin
- If the command reports that a whole divisionset for a unitary authority (
UTA) has no matches, then it's worth checking the divisions'division_type. Right now, when we import divisionsets forUTAs, we set their divisions'division_typeto unitary ward (UTW) by default. This is sometimes wrong becauseUTA's can either haveUTWorUTEdivisions. BoundaryLine has different shape files forUTWs andUTEs, so if a divisionset's divisions are set toUTW, but Boundaryline has them asUTE, then the command fails find a match for them. The quick fix is to correct the division_type in the django shell to beUTE.
Once we've replaced the temp identifiers with gss codes, we can use those GSS codes to import boundaries from BoundaryLine e.g:
manage.py boundaryline_import_boundaries --source "bdline_gb-2018-05" --codes "myfile.json" -u "http://parlvid.mysociety.org/os/bdline_gb-2018-05.zip"
-
--codesaccepts a path to a local JSON file containing an array of codes e.g:["gss:X01000001", "gss:X01000002"] - If a GSS code exists attached to multiple
Divisionrecords, those divisions will be ignored by default and we'll need to re-run the import with the--allflag (but check them first!)
Backporting GSS codes on EE will cause YNR to have orphan posts (An orphan post is one that doesn't have any ballots attached). There's no real problem to them, but it does make things untidy so we have a command popolo_delete_orphan_posts on YNR to clean them up. Once you're done with all the backporting work, make sure to run this command on YNR.