add a separate page for each country with information on testing and hospitalization, link these pages in the index. also required some fixing in the data aquisition

This commit is contained in:
fordprefect
2020-12-21 16:59:47 +01:00
parent 62e6baf00a
commit b15718ec88
4 changed files with 451 additions and 274 deletions

View File

@@ -40,7 +40,6 @@ metadata_fields = [
"hospital_beds_per_thousand",
"life_expectancy",
"human_development_index",
"tests_units",
]
### manual data
@@ -128,6 +127,7 @@ def get_data():
total_tests = tofloat(total_tests)
positive_rate = tofloat(positive_rate)
tests_per_case = tofloat(tests_per_case)
tests_units = tests_units
if location not in data:
data[location] = []
@@ -138,7 +138,7 @@ def get_data():
new_cases, new_deaths, total_cases, total_deaths, total_vaccinations,
stringency_index, reproduction_rate, icu_patients, hosp_patients,
weekly_icu_admissions, weekly_hosp_admissions, new_tests,
total_tests, positive_rate, tests_per_case,]
total_tests, positive_rate, tests_per_case, tests_units,]
)
@@ -152,7 +152,6 @@ def get_data():
else:
if metadata[location][field] != row[n]:
print(f"{location}: {field} seems not to be a constant ({metadata[location][field]} vs {row[n]})")
# reorganize data
data2 = {}
for loc in data:
@@ -167,8 +166,9 @@ def get_data():
total_tests = []
positive_rate = []
tests_per_case = []
tests_units = []
for entry in data[loc]:
t_, new_cases_, new_deaths_, total_cases_, total_deaths_, total_vaccinations_, stringency_index_, reproduction_rate_, icu_patients_, hosp_patients_, weekly_icu_admissions_, weekly_hosp_admissions_, new_tests_, total_tests_, positive_rate_, tests_per_case = entry
t_, new_cases_, new_deaths_, total_cases_, total_deaths_, total_vaccinations_, stringency_index_, reproduction_rate_, icu_patients_, hosp_patients_, weekly_icu_admissions_, weekly_hosp_admissions_, new_tests_, total_tests_, positive_rate_, tests_per_case_, tests_units_ = entry
time.append(t_)
new_cases.append(toint(new_cases_))
@@ -177,15 +177,16 @@ def get_data():
total_deaths.append(toint(total_deaths_))
total_vaccinations.append(toint(total_vaccinations_))
stringency_index.append(toint(stringency_index_))
reproduction_rate.append(toint(reproduction_rate_))
reproduction_rate.append(reproduction_rate_)
icu_patients.append(toint(icu_patients_))
hosp_patients.append(toint(hosp_patients_))
weekly_icu_admissions.append(toint(weekly_icu_admissions_))
weekly_hosp_admissions.append(toint(weekly_hosp_admissions_))
new_tests.append(toint(new_tests_))
total_tests.append(toint(total_tests_))
positive_rate.append(toint(positive_rate_))
tests_per_case.append(toint(tests_per_case_))
positive_rate.append(positive_rate_)
tests_per_case.append(tests_per_case_)
tests_units.append(tests_units_)
data2[loc] = {'time': time,
'new_cases': new_cases,
'new_deaths': new_deaths,
@@ -202,6 +203,7 @@ def get_data():
'total_tests': total_tests,
'positive_rate': positive_rate,
'tests_per_case': tests_per_case,
'tests_units': tests_units,
}
return data2, metadata