From e2a0433a0b67dd19133e489b5e32ed696b34e1db Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Tue, 30 Apr 2024 12:01:53 -0400 Subject: [PATCH] ca: Update nt electoral districts based on script --- .../territory-nt-electoral_districts.csv | 4 ++-- scripts/country-ca/Gemfile.lock | 7 ++++--- scripts/country-ca/ca_nt_electoral_districts.rb | 15 ++++++++++++--- scripts/country-ca/run-all.sh | 6 ++++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/identifiers/country-ca/territory-nt-electoral_districts.csv b/identifiers/country-ca/territory-nt-electoral_districts.csv index 1624d0d2..1f16a24b 100644 --- a/identifiers/country-ca/territory-nt-electoral_districts.csv +++ b/identifiers/country-ca/territory-nt-electoral_districts.csv @@ -7,14 +7,14 @@ ocd-division/country:ca/territory:nt/ed:hay_river_south,Hay River South ocd-division/country:ca/territory:nt/ed:inuvik_boot_lake,Inuvik Boot Lake ocd-division/country:ca/territory:nt/ed:inuvik_twin_lakes,Inuvik Twin Lakes ocd-division/country:ca/territory:nt/ed:kam_lake,Kam Lake -ocd-division/country:ca/territory:nt/ed:mackenzie-delta,Mackenzie-Delta +ocd-division/country:ca/territory:nt/ed:mackenzie_delta,Mackenzie Delta ocd-division/country:ca/territory:nt/ed:monfwi,Monfwi ocd-division/country:ca/territory:nt/ed:nahendeh,Nahendeh ocd-division/country:ca/territory:nt/ed:nunakput,Nunakput ocd-division/country:ca/territory:nt/ed:range_lake,Range Lake ocd-division/country:ca/territory:nt/ed:sahtu,Sahtu ocd-division/country:ca/territory:nt/ed:thebacha,Thebacha -ocd-division/country:ca/territory:nt/ed:tu_nedhé_-_wiilideh,Tu Nedhé - Wiilideh +ocd-division/country:ca/territory:nt/ed:tu_nedhé-wiilideh,Tu Nedhé-Wiilideh ocd-division/country:ca/territory:nt/ed:yellowknife_centre,Yellowknife Centre ocd-division/country:ca/territory:nt/ed:yellowknife_north,Yellowknife North ocd-division/country:ca/territory:nt/ed:yellowknife_south,Yellowknife South diff --git a/scripts/country-ca/Gemfile.lock b/scripts/country-ca/Gemfile.lock index 79020e7b..75bb3b2c 100644 --- a/scripts/country-ca/Gemfile.lock +++ b/scripts/country-ca/Gemfile.lock @@ -34,11 +34,11 @@ GEM net-http-digest_auth (1.4.1) net-http-persistent (4.0.2) connection_pool (~> 2.2) - nokogiri (1.15.6-arm64-darwin) + nokogiri (1.13.10-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.6-x86_64-darwin) + nokogiri (1.13.10-x86_64-darwin) racc (~> 1.4) - nokogiri (1.15.6-x86_64-linux) + nokogiri (1.13.10-x86_64-linux) racc (~> 1.4) public_suffix (5.0.1) racc (1.7.3) @@ -57,6 +57,7 @@ GEM PLATFORMS universal-darwin-22 + universal-darwin-23 x86_64-linux DEPENDENCIES diff --git a/scripts/country-ca/ca_nt_electoral_districts.rb b/scripts/country-ca/ca_nt_electoral_districts.rb index 18b04307..c5e9a5d8 100755 --- a/scripts/country-ca/ca_nt_electoral_districts.rb +++ b/scripts/country-ca/ca_nt_electoral_districts.rb @@ -5,13 +5,22 @@ # Scrapes Northwest Territories electoral district codes and names +# https://newsinteractives.cbc.ca/elections/northwest-territories/2023/results/ +# https://en.wikipedia.org/wiki/Category:Northwest_Territories_territorial_electoral_districts +REPLACEMENTS = { + "Mackenzie-Delta" => "Mackenzie Delta", + "Tu Nedhé - Wiilideh" => "Tu Nedhé-Wiilideh", +} + class NT < Runner def names ShapefileParser.new( - "http://represent.opennorth.ca.s3.amazonaws.com/data/nt_ed.zip", + "https://www.geomatics.gov.nt.ca/en/electoral-district-boundaries", "territory:nt/ed:", { - :id => "EDNWTF_ID", - :name => "ED", + :name => lambda { |record| + name = record.attributes["ED"].force_encoding("utf-8").encode("utf-8") + REPLACEMENTS.fetch(name, name) + }, } ).run end diff --git a/scripts/country-ca/run-all.sh b/scripts/country-ca/run-all.sh index c4a0cd70..714f94f9 100755 --- a/scripts/country-ca/run-all.sh +++ b/scripts/country-ca/run-all.sh @@ -23,10 +23,12 @@ $DIR/ca_bc_electoral_districts.rb names > $DIR/../../identifiers/country-ca # $DIR/ca_mb_electoral_districts.rb names > $DIR/../../identifiers/country-ca/province-mb-electoral_districts.csv echo 'ca_nb_electoral_districts' $DIR/ca_nb_electoral_districts.rb names > $DIR/../../identifiers/country-ca/province-nb-electoral_districts.csv -echo 'ca_ns_electoral_districts' -$DIR/ca_ns_electoral_districts.rb names > $DIR/../../identifiers/country-ca/province-ns-electoral_districts.csv echo 'ca_nl_electoral_districts' $DIR/ca_nl_electoral_districts.rb names > $DIR/../../identifiers/country-ca/province-nl-electoral_districts.csv +echo 'ca_ns_electoral_districts' +$DIR/ca_ns_electoral_districts.rb names > $DIR/../../identifiers/country-ca/province-ns-electoral_districts.csv +echo 'ca_nt_electoral_districts' +$DIR/ca_nt_electoral_districts.rb names > $DIR/../../identifiers/country-ca/province-nt-electoral_districts.csv echo 'ca_on_electoral_districts' $DIR/ca_on_electoral_districts.rb names > $DIR/../../identifiers/country-ca/province-on-electoral_districts.csv echo 'ca_pe_electoral_districts'