-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
71 lines (54 loc) · 1.92 KB
/
Makefile
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
all : data/congressional-elections-list.csv data
data/congressional-elections-list.csv :
./scripts/list-congressional-elections.R
exportdata :
./scripts/export-data-to-repository.R
# Download and unzip raw data
# -------------------------------------------------------------------
data : data-raw/nnv-xml data-raw/nnv-tsv/all-votes.tsv data-raw/nnv-office data-raw/nnv-names data-raw/nnv-party/party-authority.xml
# XML records for each election in NNV
data-raw/nnv-xml : temp/nnv-xml.zip
mkdir -p $@
mkdir -p temp/nnv-xml
unzip -o $^ -d temp/nnv-xml
find temp/nnv-xml/ -type f -iname *.xml -exec mv -t $@ -i '{}' +
temp/nnv-xml.zip :
curl http://lincolnmullen.com/files/nnv-xml.zip -o $@
# NNV export of all votes
# http://hdl.handle.net/10427/70452
data-raw/nnv-tsv/all-votes.tsv : temp/all-votes.zip
unzip -o $^ -d $(@D)
touch $@
temp/all-votes.zip :
curl http://dl.tufts.edu/file_assets/generic/tufts:MS115.003.001.00001/0 -o $@
# Election records candidate office authority records
# http://hdl.handle.net/10427/70465
data-raw/nnv-office : temp/office-authority.zip
unzip -o $^ -d $@
temp/office-authority.zip :
curl http://dl.tufts.edu/file_assets/generic/tufts:MS115.003.001.00003/0 -o $@
# Election records candidate name authority records
# http://hdl.handle.net/10427/70466
data-raw/nnv-names : temp/name-authority.zip
unzip -o $^ -d $@
temp/name-authority.zip :
curl http://dl.tufts.edu/file_assets/generic/tufts:MS115.003.001.00002/0 -o $@
# Party authorities
# http://hdl.handle.net/10427/002163
data-raw/nnv-party/party-authority.xml :
mkdir -p $(@D)
curl http://dl.tufts.edu/file_assets/generic/tufts:party-authority/0 -o $@
# Utilities
# -------------------------------------------------------------------
setup :
@mkdir -p R
@mkdir -p data
@mkdir -p data-raw
@mkdir -p output
@mkdir -p scripts
@mkdir -p temp
clean :
rm -rf temp/*
clobber : clean
rm -rf output/*
.PHONY : all setup clean clobber data exportdata