Last active
August 25, 2020 16:36
-
-
Save psd/d26582a93c5d1a83bdcff344ea5a17ba to your computer and use it in GitHub Desktop.
Possibly missing shielding hub authorities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
missing.txt: missing.py missing.csv organisation.csv local-authority-type.csv local-authority-to-hub.csv | |
python3 missing.py | tee $@ | |
organisation.csv: | |
curl -qs 'https://raw.githubusercontent.com/digital-land/organisation-dataset/master/collection/organisation.csv' > $@ | |
local-authority-to-hub.csv: | |
curl -qs 'https://raw.githubusercontent.com/digital-land/organisation-dataset/master/data/local-authority-to-hub.csv' > $@ | |
local-authority-type.csv: | |
curl -qs "https://$(notdir $(basename $@)).register.gov.uk/records.csv?page-index=1&page-size=5000" > $@ |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
organisation | |
local-authority-eng:BKM | |
local-authority-eng:BMH | |
local-authority-eng:BRM | |
local-authority-eng:BUC | |
local-authority-eng:CAM | |
local-authority-eng:CHC | |
local-authority-eng:CMA | |
local-authority-eng:CPCA | |
local-authority-eng:DBY | |
local-authority-eng:DEV | |
local-authority-eng:DOR | |
local-authority-eng:EDO | |
local-authority-eng:ESS | |
local-authority-eng:ESX | |
local-authority-eng:FOR | |
local-authority-eng:GLA | |
local-authority-eng:GLS | |
local-authority-eng:GMCA | |
local-authority-eng:HAM | |
local-authority-eng:HRT | |
local-authority-eng:KEN | |
local-authority-eng:KHL | |
local-authority-eng:LAN | |
local-authority-eng:LCR | |
local-authority-eng:LEC | |
local-authority-eng:LIN | |
local-authority-eng:LIV | |
local-authority-eng:NDO | |
local-authority-eng:NECA | |
local-authority-eng:NFK | |
local-authority-eng:NTCA | |
local-authority-eng:NTH | |
local-authority-eng:NTT | |
local-authority-eng:NYK | |
local-authority-eng:OXF | |
local-authority-eng:POL | |
local-authority-eng:PUR | |
local-authority-eng:RED | |
local-authority-eng:SCR | |
local-authority-eng:SED | |
local-authority-eng:SFK | |
local-authority-eng:SLF | |
local-authority-eng:SOM | |
local-authority-eng:SRY | |
local-authority-eng:STS | |
local-authority-eng:SUF | |
local-authority-eng:TAU | |
local-authority-eng:TVCA | |
local-authority-eng:WAR | |
local-authority-eng:WAV | |
local-authority-eng:WDO | |
local-authority-eng:WECA | |
local-authority-eng:WEY | |
local-authority-eng:WMCA | |
local-authority-eng:WSO | |
local-authority-eng:WSX | |
local-authority-eng:WYCA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import csv | |
index = {} | |
missing = [] | |
def load(name): | |
index[name] = {} | |
for row in csv.DictReader(open(name + ".csv")): | |
index[name][row[name]] = row | |
load("organisation") | |
load("local-authority-type") | |
for row in csv.DictReader(open("missing.csv")): | |
organisation = row["organisation"] | |
o = index["organisation"][organisation] | |
if o["end-date"] and o["end-date"] < "2020-03-01": | |
print(organisation, "dissolved", o["end-date"]) | |
elif o["local-authority-type"] in [ "CTY", "COMB", "SRA", "CIT"]: | |
print(organisation, o["local-authority-type"], index["local-authority-type"][o["local-authority-type"]]["name"]) | |
else: | |
missing.append(organisation) | |
print("\nMissing:") | |
for organisation in missing: | |
o = index["organisation"][organisation] | |
print(organisation, o["name"], o["local-authority-type"], index["local-authority-type"][o["local-authority-type"]]["name"], o["start-date"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local-authority-eng:BKM CTY County | |
local-authority-eng:BMH dissolved 2019-03-31 | |
local-authority-eng:CAM CTY County | |
local-authority-eng:CHC dissolved 2019-03-31 | |
local-authority-eng:CMA CTY County | |
local-authority-eng:CPCA COMB Combined Authority | |
local-authority-eng:DBY CTY County | |
local-authority-eng:DEV CTY County | |
local-authority-eng:DOR dissolved 2019-03-31 | |
local-authority-eng:EDO dissolved 2019-03-31 | |
local-authority-eng:ESS CTY County | |
local-authority-eng:ESX CTY County | |
local-authority-eng:FOR dissolved 2019-03-31 | |
local-authority-eng:GLA SRA Strategic Regional Authority | |
local-authority-eng:GLS CTY County | |
local-authority-eng:GMCA COMB Combined Authority | |
local-authority-eng:HAM CTY County | |
local-authority-eng:HRT CTY County | |
local-authority-eng:KEN CTY County | |
local-authority-eng:LAN CTY County | |
local-authority-eng:LCR COMB Combined Authority | |
local-authority-eng:LEC CTY County | |
local-authority-eng:LIN CTY County | |
local-authority-eng:NDO dissolved 2019-03-31 | |
local-authority-eng:NECA COMB Combined Authority | |
local-authority-eng:NFK CTY County | |
local-authority-eng:NTCA COMB Combined Authority | |
local-authority-eng:NTH CTY County | |
local-authority-eng:NTT CTY County | |
local-authority-eng:NYK CTY County | |
local-authority-eng:OXF CTY County | |
local-authority-eng:POL dissolved 2019-03-31 | |
local-authority-eng:PUR dissolved 2019-03-31 | |
local-authority-eng:SCR COMB Combined Authority | |
local-authority-eng:SED dissolved 2019-03-31 | |
local-authority-eng:SFK CTY County | |
local-authority-eng:SOM CTY County | |
local-authority-eng:SRY CTY County | |
local-authority-eng:STS CTY County | |
local-authority-eng:SUF dissolved 2019-03-31 | |
local-authority-eng:TAU dissolved 2019-03-31 | |
local-authority-eng:TVCA COMB Combined Authority | |
local-authority-eng:WAR CTY County | |
local-authority-eng:WAV dissolved 2019-03-31 | |
local-authority-eng:WDO dissolved 2019-03-31 | |
local-authority-eng:WECA COMB Combined Authority | |
local-authority-eng:WEY dissolved 2019-03-31 | |
local-authority-eng:WMCA COMB Combined Authority | |
local-authority-eng:WSO dissolved 2019-03-31 | |
local-authority-eng:WSX CTY County | |
local-authority-eng:WYCA COMB Combined Authority | |
Missing: | |
local-authority-eng:BRM Bromsgrove District Council NMD Non-metropolitan district | |
local-authority-eng:BUC Buckinghamshire Council UA Unitary authority 2020-04-01 | |
local-authority-eng:KHL Hull City Council UA Unitary authority 1996-04-01 | |
local-authority-eng:LIV Liverpool City Council MD Metropolitan district 1905-06-08 | |
local-authority-eng:RED Redditch Borough Council NMD Non-metropolitan district | |
local-authority-eng:SLF Salford City Council MD Metropolitan district 1905-05-27 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment