-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
22 lines (16 loc) · 792 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
PHONY := data reports
DATE := $(shell date --utc --iso-8601)
REPORTS_DIR := data/raw/reports
data: Makefile.reports.mk
make --jobs=8 data/processed/mobility_reports.csv
Makefile.reports.mk: data/processed/reports_urls.txt
@cat $< | while read f; do echo "$(REPORTS_DIR)/$${f##*/}:\n\tcurl $$f -sLo \$$@"; done > $@
@echo "reports: " $(shell sed -e 's/.*\/\(.*\)/data\/raw\/reports\/\1/g' $< | sed ':a;/./{N;s/\n/ /;ba}' -) >> $@
data/processed/reports_urls.txt: data/raw/html/$(DATE).html
grep -oE 'http.*gstatic.*pdf' $< >> $@
sort --unique $@ -o $@
data/raw/html/$(DATE).html:
curl https://www.google.com/covid19/mobility/ -Lo $@
data/processed/mobility_reports.csv: reports
PYTHONPATH=. python3 mobility_reports/cli.py data/raw/reports/*.pdf > $@
-include Makefile.reports.mk