-
Notifications
You must be signed in to change notification settings - Fork 0
/
prep_data.sh
executable file
·26 lines (22 loc) · 1.37 KB
/
prep_data.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! /bin/sh
# unzip polling place voting data
unzip SenateStateFirstPrefsByPollingPlaceDownload-15508-ACT.zip
unzip SenateStateFirstPrefsByPollingPlaceDownload-15508-NSW.zip
unzip SenateStateFirstPrefsByPollingPlaceDownload-15508-NT.zip
unzip SenateStateFirstPrefsByPollingPlaceDownload-15508-QLD.zip
unzip SenateStateFirstPrefsByPollingPlaceDownload-15508-SA.zip
unzip SenateStateFirstPrefsByPollingPlaceDownload-15508-TAS.zip
unzip SenateStateFirstPrefsByPollingPlaceDownload-15508-VIC.zip
unzip SenateStateFirstPrefsByPollingPlaceDownload-15508-WA.zip
# remove the extra header lines
tail -n +2 GeneralPollingPlacesDownload-15508.csv > PollingPlaces.csv
tail -n +2 SenateStateFirstPrefsByPollingPlaceDownload-15508-ACT.csv > ACTVotes.csv
tail -n +2 SenateStateFirstPrefsByPollingPlaceDownload-15508-NSW.csv > NSWVotes.csv
tail -n +2 SenateStateFirstPrefsByPollingPlaceDownload-15508-QLD.csv > QLDVotes.csv
tail -n +2 SenateStateFirstPrefsByPollingPlaceDownload-15508-VIC.csv > VICVotes.csv
tail -n +2 SenateStateFirstPrefsByPollingPlaceDownload-15508-TAS.csv > TASVotes.csv
tail -n +2 SenateStateFirstPrefsByPollingPlaceDownload-15508-SA.csv > SAVotes.csv
tail -n +2 SenateStateFirstPrefsByPollingPlaceDownload-15508-WA.csv > WAVotes.csv
tail -n +2 SenateStateFirstPrefsByPollingPlaceDownload-15508-NT.csv > NTVotes.csv
# create database
sudo -u postgres psql -d TreasureMap -f polling_places.sql