new header size, add total boosters to available data dict

This commit is contained in:
fordprefect
2021-09-23 10:22:01 +02:00
parent d8d4d7a440
commit 4d8f28d9d3

View File

@@ -91,7 +91,7 @@ def get_data():
## file archiving: include error log just in case… ## file archiving: include error log just in case…
try: try:
subprocess.run(["/usr/bin/cp", f"../{date}-full-data.csv", "data.csv"], cwd="/srv/http/dukun.de/corona/data/git") subprocess.run(["/usr/bin/cp", f"../{date}-full-data.csv", "data.csv"], cwd="/srv/http/dukun.de/corona/data/git")
subprocess.run(["/usr/bin/git", "commit", "-a", f"-m'{date}'"], cwd="/srv/http/dukun.de/corona/data/git") subprocess.run(["/usr/bin/git", "commit", "-a", f"-m {date}"], cwd="/srv/http/dukun.de/corona/data/git")
subprocess.run(["/usr/bin/git", "push"], cwd="/srv/http/dukun.de/corona/data/git") subprocess.run(["/usr/bin/git", "push"], cwd="/srv/http/dukun.de/corona/data/git")
except Exception as e: except Exception as e:
print(f"File archiving failed with {e} - need for debugging here…") print(f"File archiving failed with {e} - need for debugging here…")
@@ -125,6 +125,10 @@ def get_data():
iso_code, continent, location, date, total_cases, new_cases, new_cases_smoothed, total_deaths, new_deaths, new_deaths_smoothed, total_cases_per_million, new_cases_per_million, new_cases_smoothed_per_million, total_deaths_per_million, new_deaths_per_million, new_deaths_smoothed_per_million, reproduction_rate, icu_patients, icu_patients_per_million, hosp_patients, hosp_patients_per_million, weekly_icu_admissions, weekly_icu_admissions_per_million, weekly_hosp_admissions, weekly_hosp_admissions_per_million, total_tests, new_tests, total_tests_per_thousand, new_tests_per_thousand, new_tests_smoothed, new_tests_smoothed_per_thousand, positive_rate, tests_per_case, tests_units, total_vaccinations, people_vaccinated, people_fully_vaccinated, new_vaccinations, new_vaccinations_smoothed, total_vaccinations_per_hundred, people_vaccinated_per_hundred, people_fully_vaccinated_per_hundred, new_vaccinations_smoothed_per_million, stringency_index, population, population_density, median_age, aged_65_older, aged_70_older, gdp_per_capita, extreme_poverty, cardiovasc_death_rate, diabetes_prevalence, female_smokers, male_smokers, handwashing_facilities, hospital_beds_per_thousand, life_expectancy, human_development_index = row iso_code, continent, location, date, total_cases, new_cases, new_cases_smoothed, total_deaths, new_deaths, new_deaths_smoothed, total_cases_per_million, new_cases_per_million, new_cases_smoothed_per_million, total_deaths_per_million, new_deaths_per_million, new_deaths_smoothed_per_million, reproduction_rate, icu_patients, icu_patients_per_million, hosp_patients, hosp_patients_per_million, weekly_icu_admissions, weekly_icu_admissions_per_million, weekly_hosp_admissions, weekly_hosp_admissions_per_million, total_tests, new_tests, total_tests_per_thousand, new_tests_per_thousand, new_tests_smoothed, new_tests_smoothed_per_thousand, positive_rate, tests_per_case, tests_units, total_vaccinations, people_vaccinated, people_fully_vaccinated, new_vaccinations, new_vaccinations_smoothed, total_vaccinations_per_hundred, people_vaccinated_per_hundred, people_fully_vaccinated_per_hundred, new_vaccinations_smoothed_per_million, stringency_index, population, population_density, median_age, aged_65_older, aged_70_older, gdp_per_capita, extreme_poverty, cardiovasc_death_rate, diabetes_prevalence, female_smokers, male_smokers, handwashing_facilities, hospital_beds_per_thousand, life_expectancy, human_development_index = row
elif len(row) == 60: elif len(row) == 60:
iso_code, continent, location, date, total_cases, new_cases, new_cases_smoothed, total_deaths, new_deaths, new_deaths_smoothed, total_cases_per_million, new_cases_per_million, new_cases_smoothed_per_million, total_deaths_per_million, new_deaths_per_million, new_deaths_smoothed_per_million, reproduction_rate, icu_patients, icu_patients_per_million, hosp_patients, hosp_patients_per_million, weekly_icu_admissions, weekly_icu_admissions_per_million, weekly_hosp_admissions, weekly_hosp_admissions_per_million, new_tests, total_tests, total_tests_per_thousand, new_tests_per_thousand, new_tests_smoothed, new_tests_smoothed_per_thousand, positive_rate, tests_per_case, tests_units, total_vaccinations, people_vaccinated, people_fully_vaccinated, new_vaccinations, new_vaccinations_smoothed, total_vaccinations_per_hundred, people_vaccinated_per_hundred, people_fully_vaccinated_per_hundred, new_vaccinations_smoothed_per_million, stringency_index, population, population_density, median_age, aged_65_older, aged_70_older, gdp_per_capita, extreme_poverty, cardiovasc_death_rate, diabetes_prevalence, female_smokers, male_smokers, handwashing_facilities, hospital_beds_per_thousand, life_expectancy, human_development_index, excess_mortality = row iso_code, continent, location, date, total_cases, new_cases, new_cases_smoothed, total_deaths, new_deaths, new_deaths_smoothed, total_cases_per_million, new_cases_per_million, new_cases_smoothed_per_million, total_deaths_per_million, new_deaths_per_million, new_deaths_smoothed_per_million, reproduction_rate, icu_patients, icu_patients_per_million, hosp_patients, hosp_patients_per_million, weekly_icu_admissions, weekly_icu_admissions_per_million, weekly_hosp_admissions, weekly_hosp_admissions_per_million, new_tests, total_tests, total_tests_per_thousand, new_tests_per_thousand, new_tests_smoothed, new_tests_smoothed_per_thousand, positive_rate, tests_per_case, tests_units, total_vaccinations, people_vaccinated, people_fully_vaccinated, new_vaccinations, new_vaccinations_smoothed, total_vaccinations_per_hundred, people_vaccinated_per_hundred, people_fully_vaccinated_per_hundred, new_vaccinations_smoothed_per_million, stringency_index, population, population_density, median_age, aged_65_older, aged_70_older, gdp_per_capita, extreme_poverty, cardiovasc_death_rate, diabetes_prevalence, female_smokers, male_smokers, handwashing_facilities, hospital_beds_per_thousand, life_expectancy, human_development_index, excess_mortality = row
elif len(row) == 62:
iso_code, continent, location, date, total_cases, new_cases, new_cases_smoothed, total_deaths, new_deaths, new_deaths_smoothed, total_cases_per_million, new_cases_per_million, new_cases_smoothed_per_million, total_deaths_per_million, new_deaths_per_million, new_deaths_smoothed_per_million, reproduction_rate, icu_patients, icu_patients_per_million, hosp_patients, hosp_patients_per_million, weekly_icu_admissions, weekly_icu_admissions_per_million, weekly_hosp_admissions, weekly_hosp_admissions_per_million, new_tests, total_tests, total_tests_per_thousand, new_tests_per_thousand, new_tests_smoothed, new_tests_smoothed_per_thousand, positive_rate, tests_per_case, tests_units, total_vaccinations, people_vaccinated, people_fully_vaccinated, total_boosters, new_vaccinations, new_vaccinations_smoothed, total_vaccinations_per_hundred, people_vaccinated_per_hundred, people_fully_vaccinated_per_hundred, total_boosters_per_hundred, new_vaccinations_smoothed_per_million, stringency_index, population, population_density, median_age, aged_65_older, aged_70_older, gdp_per_capita, extreme_poverty, cardiovasc_death_rate, diabetes_prevalence, female_smokers, male_smokers, handwashing_facilities, hospital_beds_per_thousand, life_expectancy, human_development_index, excess_mortality = row
elif len(row) == 63:
iso_code, continent, location, date, total_cases, new_cases, new_cases_smoothed, total_deaths, new_deaths, new_deaths_smoothed, total_cases_per_million, new_cases_per_million, new_cases_smoothed_per_million, total_deaths_per_million, new_deaths_per_million, new_deaths_smoothed_per_million, reproduction_rate, icu_patients, icu_patients_per_million, hosp_patients, hosp_patients_per_million, weekly_icu_admissions, weekly_icu_admissions_per_million, weekly_hosp_admissions, weekly_hosp_admissions_per_million, new_tests, total_tests, total_tests_per_thousand, new_tests_per_thousand, new_tests_smoothed, new_tests_smoothed_per_thousand, positive_rate, tests_per_case, tests_units, total_vaccinations, people_vaccinated, people_fully_vaccinated, total_boosters, new_vaccinations, new_vaccinations_smoothed, total_vaccinations_per_hundred, people_vaccinated_per_hundred, people_fully_vaccinated_per_hundred, total_boosters_per_hundred, new_vaccinations_smoothed_per_million, stringency_index, population, population_density, median_age, aged_65_older, aged_70_older, gdp_per_capita, extreme_poverty, cardiovasc_death_rate, diabetes_prevalence, female_smokers, male_smokers, handwashing_facilities, hospital_beds_per_thousand, life_expectancy, human_development_index, excess_mortality_cumulative, excess_mortality = row
else: else:
print(f"WARNING! Table format changed, length now {len(row)}, new header:\n{row})") print(f"WARNING! Table format changed, length now {len(row)}, new header:\n{row})")
exit(1) exit(1)
@@ -153,6 +157,7 @@ def get_data():
tests_per_case = tofloat(tests_per_case) tests_per_case = tofloat(tests_per_case)
new_vaccinations = tofloat(new_vaccinations) new_vaccinations = tofloat(new_vaccinations)
tests_units = tests_units tests_units = tests_units
total_boosters = tofloat(total_boosters)
if location not in data: if location not in data:
data[location] = [] data[location] = []
@@ -164,7 +169,7 @@ def get_data():
stringency_index, reproduction_rate, icu_patients, hosp_patients, stringency_index, reproduction_rate, icu_patients, hosp_patients,
weekly_icu_admissions, weekly_hosp_admissions, new_tests, weekly_icu_admissions, weekly_hosp_admissions, new_tests,
total_tests, positive_rate, tests_per_case, tests_units, total_tests, positive_rate, tests_per_case, tests_units,
new_vaccinations, people_fully_vaccinated] new_vaccinations, people_fully_vaccinated, total_boosters]
) )
@@ -210,8 +215,9 @@ def get_data():
tests_units = [] tests_units = []
new_vaccinations = [] new_vaccinations = []
people_fully_vaccinated = [] people_fully_vaccinated = []
total_boosters = []
for entry in data[loc]: 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_, tests_units_, new_vaccinations_, people_fully_vaccinated_ = 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_, new_vaccinations_, people_fully_vaccinated_, total_boosters_ = entry
time.append(t_) time.append(t_)
new_cases.append(toint(new_cases_)) new_cases.append(toint(new_cases_))
@@ -232,6 +238,7 @@ def get_data():
new_vaccinations.append(toint(new_vaccinations_)) new_vaccinations.append(toint(new_vaccinations_))
tests_units.append(tests_units_) tests_units.append(tests_units_)
people_fully_vaccinated.append(people_fully_vaccinated_) people_fully_vaccinated.append(people_fully_vaccinated_)
total_boosters.append(total_boosters_)
### data tweaking and fixing goes here ### data tweaking and fixing goes here
@@ -268,6 +275,7 @@ def get_data():
'tests_units': tests_units, 'tests_units': tests_units,
'new_vaccinations': new_vaccinations, 'new_vaccinations': new_vaccinations,
'people_fully_vaccinated': people_fully_vaccinated, 'people_fully_vaccinated': people_fully_vaccinated,
'total_boosters': total_boosters,
} }
# add vaccine info to metadata # add vaccine info to metadata
if loc in vaccines_country_dict: if loc in vaccines_country_dict: