add vaccination state: data fetched in all_countries and included in index

This commit is contained in:
fordprefect
2020-12-29 12:31:57 +01:00
parent bdf570c6b1
commit 6591ea628e
2 changed files with 17 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ corr = {"Chile": 10000,
def plot(data, countries, pop, **kwargs): def plot(data, countries, pop, **kwargs):
figsize = (10,5) figsize = (10,5)
vaccs = []
for loc in data: for loc in data:
try: try:
if loc == "International": if loc == "International":
@@ -136,6 +138,7 @@ def plot(data, countries, pop, **kwargs):
title += ", population = "+f"{pop[loc]['pop']:,}".replace(",",".") title += ", population = "+f"{pop[loc]['pop']:,}".replace(",",".")
if not np.isnan(total_vaccinations[-1]): if not np.isnan(total_vaccinations[-1]):
title += ", vac rate: "+f"{total_vaccinations[-1]/pop[loc]['pop']*100:1.3f}%" title += ", vac rate: "+f"{total_vaccinations[-1]/pop[loc]['pop']*100:1.3f}%"
vaccs.append([loc, total_vaccinations[-1], total_vaccinations[-1]/pop[loc]['pop']*100]) # bookkeeping for overview
ax1.set_title(title) ax1.set_title(title)
fig.tight_layout() fig.tight_layout()
pp.text(0.002,0.005, f"plot generated {time_module.strftime('%Y-%m-%d %H:%M')}, CC-by-sa-nc, origin: dukun.de/corona, datasource: ourworldindata.org/coronavirus-source-data", color="dimgrey", fontsize=8, transform=fig.transFigure) pp.text(0.002,0.005, f"plot generated {time_module.strftime('%Y-%m-%d %H:%M')}, CC-by-sa-nc, origin: dukun.de/corona, datasource: ourworldindata.org/coronavirus-source-data", color="dimgrey", fontsize=8, transform=fig.transFigure)
@@ -144,3 +147,13 @@ def plot(data, countries, pop, **kwargs):
pp.close(fig) pp.close(fig)
except Exception as e: except Exception as e:
print(f"=====> plotting failed for {loc}, skipping plot. Error: {e}") print(f"=====> plotting failed for {loc}, skipping plot. Error: {e}")
## vaccination overview html
with open("vac_state.html", "w") as f:
# header
f.write("<table><tr><th>Land</th><th>Impfungen</th><th>Impfrate</th></tr>\n")
# data
for loc, tvac, rvac in vaccs:
f.write(f"<tr><td>{loc}</td><td>" + f"{tvac:,d}".replace(",",".") + f"</td><td>{rvac:3.3f}%</td></tr>\n".replace(".", ","))
# footer
f.write("</table>\n")

View File

@@ -29,6 +29,10 @@ Von den extrem reichhaltigen Daten dort verarbeite ich nur die Zahl der Neufäll
<br><br> <br><br>
Aktuelle Daten aus Deutschland mit vielen Hintergründen finden sich im <a href="https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Situationsberichte/Gesamt.html">Lagebericht des RKI</a>. Aktuelle Daten aus Deutschland mit vielen Hintergründen finden sich im <a href="https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Situationsberichte/Gesamt.html">Lagebericht des RKI</a>.
<details>
<summary><h2>Impfstatus / Vaccination state<h2></summary>
<iframe src="vac_state.html" height="400px" width="100%"></iframe>
</details>
<details open> <details open>
<summary><h2>Ausgewählte Länder</h2></summary> <summary><h2>Ausgewählte Länder</h2></summary>