Commit 3ca8a825 authored by Michał Woźniak's avatar Michał Woźniak
Browse files

more accurate global data

parent ffea4396
......@@ -259,15 +259,13 @@ let getSite = () => {
let getCovidData = () => {
console.log(`+-- fetching global covid data`)
return wtf
.fetch('2019-20 coronavirus pandemic')
.fetch('Template:2019-20 coronavirus pandemic data')
.then((doc)=>{
var data = doc.json()
.sections[0]
.infoboxes[0]
var cleaned_data = {
confirmed: 1 * data.confirmed_cases.text.replace(/^([0-9,]+).*$/, '$1').replace(/,/g, ''),
deaths: 1 * data.deaths.text.replace(/^([0-9,]+).*$/, '$1').replace(/,/g, ''),
recovered: 1 * data.recovery_cases.text.replace(/^([0-9,]+).*$/, '$1').replace(/,/g, ''),
confirmed: data.sections[0].tables[0][1].col3.number,
deaths: data.sections[0].tables[0][1].col4.number,
recovered: data.sections[0].tables[0][1].col5.number
}
cleaned_data.mortality = cleaned_data.deaths / cleaned_data.confirmed
console.log(`+-- got global covid data:`
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment