DEV Community

Cover image for 📈 Fetch and use French COVID-19 dataset

📈 Fetch and use French COVID-19 dataset

yne profile image Rémy F. ・2 min read

The French government has published an opensource GIS website to keep an eye on the current epidemic growth.

They also publish the raw dataset but it's a mess to deal with, so let's just scrap the hell of the homepage.

FILE=$(curl -s $BASE | grep -Po '/_next/static/[^/]+?/pages/index.js' | head -n1)
JSON=$(curl -s $BASE/$FILE | grep -Po "JSON.parse\('\[.*?\]" | cut -c13- | sed 's/\\.//g')

You can now plot your 1-month worth of data using your favorite language or spreadsheet.

Paris data as CSV using jq:

echo "$JSON" | jq -r '.[] | select(.nom=="Paris") | [.date,.deces,.reanimation,.hospitalises,.gueris] |@csv'

Or if your a pipe junky, this bad boy will show you a New/Total logarithmic representation as shown in this video :

echo "$JSON" | node -e "
.forEach(l=>console.log(l.join(' ')))
" | graph -T png -lx -ly -X 'Total cases' -Y 'New cases variation' | display

Here is the ouput for the whole country


Here is the ouput for the Paris region



Editor guide
andrewrothman profile image
Andrew Rothman

Really cool simple project.

I find "jq" really useful at times. That "graph" tool looks is awesome too. Is it this one?