diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2024-06-20 17:32:34 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2024-06-21 15:06:58 +0200 |
commit | d1f52a5e7ac2dd62c6348f17b02ccf324456c9da (patch) | |
tree | 7b96836ed3ac4071d4edbbdd1cf0835868fdfc78 /administrative-codes/Makefile | |
parent | e930cd95f3392b44152ae05b4189c65e833adaa3 (diff) |
Add script to download administrative codes from SCB.
Unfortunately SCB doesn't provide CSV files, so we download their xls
file and produce our own CSV files. We also add a conversion tool to
turn these CSV files into a (single, compact) JSON file to be served via
HTTP.
Diffstat (limited to 'administrative-codes/Makefile')
-rw-r--r-- | administrative-codes/Makefile | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/administrative-codes/Makefile b/administrative-codes/Makefile new file mode 100644 index 0000000..c0008bc --- /dev/null +++ b/administrative-codes/Makefile @@ -0,0 +1,19 @@ +OUT = administrative-codes +CSV_SOURCES = counties.csv municipalities.csv +GENERATED_FILES = $(addsuffix .json,$(OUT)) $(addsuffix .json.br,$(OUT)) +all: $(GENERATED_FILES) + +$(CSV_SOURCES): %.csv: + ./update + +%.json: $(CSV_SOURCES) + ./csv2json $^ >$@ + +# XXX The brotli(1) executable doesn't support mode=MODE_TEXT +%.json.br: %.json + brotli --best --keep --output=$@ -- $^ + +clean: + rm -f -- $(GENERATED_FILES) + +.PHONY: update clean |