dssg-pt/covid19pt-data

Dados Diários

tiago32rodriguez opened this issue · 6 comments

A dgs voltou a divulgar os dados diários, e até tem os dados corrigidos dos ultimos 2 anos.

https://covid19.min-saude.pt/numero-de-novos-casos-e-obitos-por-dia

Estamos a olhar para isso… obrigado e até já.

Oh, thanks.
That is suboptimal, but better than nothing.
Thank you a lot for the info.

bash script dependente de jq e ssconvert para ficar com os dados num csv:

curl 'https://covid19.min-saude.pt/wp-json/wp/v2/media?author=3&mime_type=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | jq '.[0].source_url' | xargs wget --output-document data.xlsx
ssconvert -S data.xlsx data.csv
rm data.xlsx data.csv.0
mv data.csv.1 data.csv

Thank you t-var-s.
That is an elegant way. I took since march a different
approach with the following zsh script, works in bash as well.

#!/usr/bin/zsh
# get data 'Portugal Covid Dados' and convert indo csv
# depends on tidy, xlsx2csv

# extract xlsx file url  from https://covid19.min-saude.pt/numero-de-novos-casos-e-obitos-por-dia

url=$(curl https://covid19.min-saude.pt/numero-de-novos-casos-e-obitos-por-dia/ |\
    tidy 2>/dev/null |\
    grep -m1 xlsx|\
    sed 's/"//g;s/>$//')
echo "extracted URL =  $url"

wget --no-glob -O tmpfile.xlsx $url
xlsx2csv -s2 tmpfile.xlsx  port_dados.csv

New dados_diarios.csv and dados_diarios folder archive: 2d4f50c

DGS is blocking access from GitHub Actions, but that's ok we can work around it.

I'm now collecting the original XSLS files into the folder dados_diarios and the latest available data into dados_diarios.csv, with the columns aligned with the original dataset - confirmados, confirmados_novos, obitos, and obitos_novos.

Values are, as expected, not aligned with the data.csv, due to DGS adjusting the past, and, honestly, some weekly values on the PDF not matching with each other.

Please provide feedback if this helps.

Please provide feedback if this helps.

Yes, that helps a lot. After a bit of scripting its matching nicely in my databases.
And it is always up to date.
Thank you a lot.