-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathMakefile
53 lines (37 loc) · 1.38 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
# Download orc.org RMS files and convert to json/csv using scoring.py
#
URL = http://data.orc.org/public/WPub.dll?action=DownRMS&ext=json&Family=1&VPPYear=$(YEAR)&CountryId=
COUNTRIES = ARG AUS AUT BRA BUL CAN CRO CYP DEN ECU ESP EST FIN FRA GBR \
GER GRE HKG HUN ISR ITA JPN KOR LAT LTU MLT MNE NED NOR PER \
POL POR ROU RSA RUS SLO SUI SWE TUR UKR USA
YEAR = 2024
JSON_FILES = $(addprefix data/$(YEAR)/, $(addsuffix $(YEAR).json, $(COUNTRIES)))
HEADERS += -H 'DNT: 1' -H 'Accept-Encoding: gzip, deflate, sdch'
HEADERS += -H 'Accept-Language: en' -H 'User-Agent: Mozilla/5.0'
HEADERS += -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
HEADERS += -H 'Referer: http://data.orc.org/public/WPub.dll'
HEADERS += -H 'Connection: keep-alive'
BASE = ALL$(YEAR)
# use `make site` to build new json for the site.
all: site
# use `make json` to fetch new files from orc.org
json: $(JSON_FILES)
data:
mkdir -p data/$(YEAR)
# Fetch the files from orc.org.
data/$(YEAR)/%$(YEAR).json: data
# Simple wget doesn't work here, with wget the downloaded file only contains the header.
curl '$(URL)$*' $(HEADERS) --compressed > $@
csv:
./scoring.py csv > $(BASE).csv
json:
./scoring.py json > $(BASE).json
site:
./scoring.py site
clean:
rm $(BASE).*
rm -rf data/*.rms
test:
npm run lint
flake8 --ignore=E501 scoring.py parser/*.py
.PHONY: site