-
Notifications
You must be signed in to change notification settings - Fork 15
Backporting CED codes
Although County Electoral Divisions (CEDs) have GSS codes, BoundaryLine doesn't use them. This means our existing process for back-porting GSS codes doesn't work for CEDs. ONS do publish the GSS codes for CEDS in files like County Electoral Division (May 2024) Names and Codes in EN, but the problem with those files is that some CED names are duplicated and we can't find out which county they're in, e.g.:
E58000050 Abbey ED
E58000472 Abbey ED
E58000402 Abbey ED
What we actually need is the latest version of files like Ward to LAD to County to County Electoral Division (May 2024) Lookup for EN that contain both the CED name and the county they're in so we can create a lookup (note that CEDs records appear duplicated in these files because it also contains wards).
CED_backport_GSS_codes_from_csv
takes a Ward to LAD to County to CED Lookup as a file path (-f
) or url (-u
) and a county divisionset id (--divset-id
).
- You can also pass
--divset-ids
which accepts a path to a local JSON file containing an array of divisionset ids e.g: ["632", "674"] - Pass
--dry-run
to get a report of what it will do without committing changes - Pass
-v 2
for extra debug info
examples:
python manage.py CED_backport_GSS_codes_from_csv -f /path/to/lookup/file.csv --divset-id 21 --dry-run
python manage.py CED_backport_GSS_codes_from_csv -u https://link-to-download --divset-ids path/to/file.json -v 2
There might be a few 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 naming (e.g '&' vs 'and') between our database and the ONS file. The remaining manual edits can be made via /admin.