How this works:
-Each day, the Berlin health ministry publishes by-district data of the day's
+Each day, the Berlin health ministry publishes new by-district data of the day's
registered new Corona infections at [1]. ./update.sh crawls this and appends
the day's data as a single line to ./daily_infections_table.txt, then calls
./enhance_table.py which outputs an enhanced version of the data to
./berlin-corona-table.timer calls ./update.sh once per day, when the new daily
data are expected to be found at [1].
-[1] https://www.berlin.de/lageso/_assets/gesundheit/publikationen/corona/bezirkstabelle.csv
+[1] https://www.berlin.de/sen/gpg/service/presse/2020/
[2] https://plomlompom.com/berlin_corona.txt & https://plomlompom.com/berlin_corona.html
Set-up:
#!/bin/sh
set -e
-CSV_URL=https://www.berlin.de/lageso/_assets/gesundheit/publikationen/corona/bezirkstabelle.csv
table_path=daily_infections_table.txt
-# If we don't have a table file yet, we need to provide its header.
-header=" CW FK Li MH Mi Ne Pa Re Sp SZ TS TK sum"
-if [ ! -f "${table_path}" ]; then
- echo "${header}" > "${table_path}"
-fi
-
-# Parse Lageso day table of new infections by district into new line for history table.
-today="$(date +%Y-%m-%d)"
-curl "${CSV_URL}" \
-| awk 'BEGIN { FS=";"; ORS=""; print "'${today}'" }; '\
-'!/^"Bezirk"/ { printf "%4d", $3 }; '\
-'END { printf "\n" }' "${filename}" >> "${table_path}"
+# Re-build infections table.
+./scrape.py > "${table_path}"
# Write enhanced table output to directory served by web server.
#