added case fatility rate
This commit is contained in:
parent
f5ba23cc75
commit
495677478b
@ -453,6 +453,7 @@ const processRecords = async () => {
|
|||||||
record.casesPerMillion = !!record.population ? record.cases.total / record.population * 1000000 : 0;
|
record.casesPerMillion = !!record.population ? record.cases.total / record.population * 1000000 : 0;
|
||||||
record.deathGrowthRate = getGrowthRate(record.timeSeriesDaily);
|
record.deathGrowthRate = getGrowthRate(record.timeSeriesDaily);
|
||||||
record.caseGrowthRate = getGrowthRate(record.cases.timeSeriesDaily);
|
record.caseGrowthRate = getGrowthRate(record.cases.timeSeriesDaily);
|
||||||
|
record.caseFatalityRate = record.cases.total !== 0 ? record.total / record.cases.total : 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
tsGlobalRecords.sort((a, b) => {
|
tsGlobalRecords.sort((a, b) => {
|
||||||
@ -575,6 +576,7 @@ const processRecords = async () => {
|
|||||||
timeSeriesDaily: convertTsObjectToArray(item.cases.timeSeriesDaily),
|
timeSeriesDaily: convertTsObjectToArray(item.cases.timeSeriesDaily),
|
||||||
timeSeriesMonthly: convertTsObjectToArray(item.cases.timeSeriesMonthly),
|
timeSeriesMonthly: convertTsObjectToArray(item.cases.timeSeriesMonthly),
|
||||||
},
|
},
|
||||||
|
caseFatalityRate: item.cases.total !== 0 ? item.total / item.cases.total : 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
stateItem.deathGrowthRate = getGrowthRate(stateItem.timeSeriesDaily);
|
stateItem.deathGrowthRate = getGrowthRate(stateItem.timeSeriesDaily);
|
||||||
@ -616,6 +618,7 @@ const processRecords = async () => {
|
|||||||
timeSeriesDaily: convertTsObjectToArray(item.cases.timeSeriesDaily),
|
timeSeriesDaily: convertTsObjectToArray(item.cases.timeSeriesDaily),
|
||||||
timeSeriesMonthly: convertTsObjectToArray(item.cases.timeSeriesMonthly),
|
timeSeriesMonthly: convertTsObjectToArray(item.cases.timeSeriesMonthly),
|
||||||
},
|
},
|
||||||
|
caseFatalityRate: item.cases.total !== 0 ? item.total / item.cases.total : 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
countryItem.deathGrowthRate = getGrowthRate(countryItem.timeSeriesDaily);
|
countryItem.deathGrowthRate = getGrowthRate(countryItem.timeSeriesDaily);
|
||||||
@ -666,6 +669,7 @@ const processRecords = async () => {
|
|||||||
worldData.population = 7781841000;
|
worldData.population = 7781841000;
|
||||||
worldData.deathsPerMillion = worldData.total / worldData.population * 1000000;
|
worldData.deathsPerMillion = worldData.total / worldData.population * 1000000;
|
||||||
worldData.casesPerMillion = worldData.cases.total / worldData.population * 1000000;
|
worldData.casesPerMillion = worldData.cases.total / worldData.population * 1000000;
|
||||||
|
worldData.caseFatalityRate = worldData.cases.total !== 0 ? worldData.total / worldData.cases.total : 0;
|
||||||
|
|
||||||
console.log(`transformed data in ${Date.now() - start}ms`);
|
console.log(`transformed data in ${Date.now() - start}ms`);
|
||||||
|
|
||||||
|
@ -53,6 +53,10 @@ html
|
|||||||
background-color: #a65353;
|
background-color: #a65353;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
.other-bg-dark {
|
||||||
|
background-color: #336556;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
.geo-bg {
|
.geo-bg {
|
||||||
background-color: #eeeeee;
|
background-color: #eeeeee;
|
||||||
}
|
}
|
||||||
@ -62,6 +66,9 @@ html
|
|||||||
.deaths-bg {
|
.deaths-bg {
|
||||||
background-color: #eac8c8;
|
background-color: #eac8c8;
|
||||||
}
|
}
|
||||||
|
.other-bg {
|
||||||
|
background-color: #9ed0c2;
|
||||||
|
}
|
||||||
.table-sm {
|
.table-sm {
|
||||||
font-size: 80%;
|
font-size: 80%;
|
||||||
}
|
}
|
||||||
@ -536,7 +543,7 @@ html
|
|||||||
th.text-center.font-weight-bold.geo-bg-dark(colspan=(hasPopulation ? 3 : 2)) Geography
|
th.text-center.font-weight-bold.geo-bg-dark(colspan=(hasPopulation ? 3 : 2)) Geography
|
||||||
th.text-center.font-weight-bold.cases-bg-dark(colspan=(hasPopulation ? 6 : 5)) Cases
|
th.text-center.font-weight-bold.cases-bg-dark(colspan=(hasPopulation ? 6 : 5)) Cases
|
||||||
th.text-center.font-weight-bold.deaths-bg-dark(colspan=(hasPopulation ? 6 : 5)) Deaths
|
th.text-center.font-weight-bold.deaths-bg-dark(colspan=(hasPopulation ? 6 : 5)) Deaths
|
||||||
th.text-center.font-weight-bold.geo-bg-dark Trends
|
th.text-center.font-weight-bold.other-bg-dark(colspan="2") Other
|
||||||
thead.headers: tr
|
thead.headers: tr
|
||||||
th.geo-bg #
|
th.geo-bg #
|
||||||
th.geo-bg(data-col="name"): +sortableLinks("name", true)= label
|
th.geo-bg(data-col="name"): +sortableLinks("name", true)= label
|
||||||
@ -558,7 +565,10 @@ html
|
|||||||
th.deaths-bg(data-col="yesterday"): +sortableLinks("yesterday") Yesterday
|
th.deaths-bg(data-col="yesterday"): +sortableLinks("yesterday") Yesterday
|
||||||
th.deaths-bg(data-col="last7"): +sortableLinks("last7") Last 7
|
th.deaths-bg(data-col="last7"): +sortableLinks("last7") Last 7
|
||||||
th.deaths-bg(data-col="growth"): +sortableLinks("growth") Growth
|
th.deaths-bg(data-col="growth"): +sortableLinks("growth") Growth
|
||||||
th.text-center.geo-bg Last 14 days
|
|
||||||
|
th.other-bg(data-col="cfr"): +sortableLinks("cfr")
|
||||||
|
acronym(title="Case Fatality Rate" style="border-bottom: 1px dotted #999999; cursor: help;") CFR
|
||||||
|
th.text-center.other-bg Trend
|
||||||
|
|
||||||
-
|
-
|
||||||
items.sort((a, b) => {
|
items.sort((a, b) => {
|
||||||
@ -599,6 +609,7 @@ html
|
|||||||
data-yesterday=yesterday
|
data-yesterday=yesterday
|
||||||
data-last7=last7
|
data-last7=last7
|
||||||
data-growth=item.deathGrowthRate
|
data-growth=item.deathGrowthRate
|
||||||
|
data-cfr=item.caseFatalityRate
|
||||||
)
|
)
|
||||||
td.sort-order= i + 1
|
td.sort-order= i + 1
|
||||||
td: +renderItemName(item)
|
td: +renderItemName(item)
|
||||||
@ -619,6 +630,7 @@ html
|
|||||||
td.text-right: code: +formatNumber(yesterday)
|
td.text-right: code: +formatNumber(yesterday)
|
||||||
td.text-right: code: +formatNumber(last7)
|
td.text-right: code: +formatNumber(last7)
|
||||||
td.text-right: code= Number(item.deathGrowthRate * 100).toFixed(2) + '%'
|
td.text-right: code= Number(item.deathGrowthRate * 100).toFixed(2) + '%'
|
||||||
|
td.text-right: code= Number(item.caseFatalityRate * 100).toFixed(2) + '%'
|
||||||
td
|
td
|
||||||
canvas.mx-auto(id="sparkline-" + i width="100" height="35")
|
canvas.mx-auto(id="sparkline-" + i width="100" height="35")
|
||||||
script.
|
script.
|
||||||
@ -732,6 +744,7 @@ html
|
|||||||
case 'population':
|
case 'population':
|
||||||
case 'million':
|
case 'million':
|
||||||
case 'growth':
|
case 'growth':
|
||||||
|
case 'cfr':
|
||||||
sortByNumberThenName(value);
|
sortByNumberThenName(value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user