Skip to content

Commit

Permalink
ca: Update nt electoral districts based on script
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Apr 30, 2024
1 parent d75ef0e commit e2a0433
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions identifiers/country-ca/territory-nt-electoral_districts.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions scripts/country-ca/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -57,6 +57,7 @@ GEM

PLATFORMS
universal-darwin-22
universal-darwin-23
x86_64-linux

DEPENDENCIES
Expand Down
15 changes: 12 additions & 3 deletions scripts/country-ca/ca_nt_electoral_districts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions scripts/country-ca/run-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit e2a0433

Please sign in to comment.