diff --git a/all_countries.py b/all_countries.py index 5306252..d2e2c67 100644 --- a/all_countries.py +++ b/all_countries.py @@ -34,7 +34,8 @@ def plot(data, countries, pop, metadata={}, **kwargs): continue name = basename+loc time, new_cases, new_deaths, total_cases, total_deaths, total_vaccinations, stringency_index, new_vaccinations = data[loc]['time'], data[loc]['new_cases'], data[loc]['new_deaths'], data[loc]['total_cases'], data[loc]['total_deaths'], data[loc]['total_vaccinations'], data[loc]['stringency_index'], data[loc]['new_vaccinations'] - + people_fully_vaccinated = data[loc]['people_fully_vaccinated'] + fig, ax1 = pp.subplots(num=name, figsize=figsize) @@ -54,19 +55,8 @@ def plot(data, countries, pop, metadata={}, **kwargs): if np.isnan(total_vaccinations[-2]): print(f"{loc} starts vaccinating, adding to plot") - ax2.plot(time, np.array(total_vaccinations), label=f"Total vaccinations", marker="", linestyle="-.", color="crimson") - - if False: - # plot detailed vaccination plot for all_countries.py - rfig, rax = pp.subplots(1,1,num=f"{loc}_vacc") - rax2 = rax.twinx() - rax.plot(time, new_vaccinations, linestyle="--", color="green", label="new vac") - rax2.plot(time, total_vaccinations, linestyle="-.", color="red", label="total vac") - rax.set_ylabel("new vaccinatios") - rax2.set_ylabel("total vaccinations") - rax.legend(frameon=False, loc=2) - - rfig.savefig("img/"+f"{loc}".replace(" ", "_").replace("'", "").replace("/", "") + "/vaccs.png") + ax2.plot(time, np.array(total_vaccinations), label=f"Total vaccination doses", marker="", linestyle="-.", color="crimson") + ax2.plot(time, np.array(people_fully_vaccinated), label="fully vaccinated", marker="", linestyle="-", color="crimson") # fix lower bound of plot for ax in (ax1, ax2): @@ -145,9 +135,9 @@ def plot(data, countries, pop, metadata={}, **kwargs): if loc in pop: #pp.title(f"{loc}", population = "+f"{pop[loc]['pop']:,}".replace(",",".")) title += ", population = "+f"{pop[loc]['pop']:,}".replace(",",".") - if not np.isnan(total_vaccinations[-1]): - 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 + if not np.isnan(people_fully_vaccinated[-1]): + title += ", vac rate: "+f"{people_fully_vaccinated[-1]/pop[loc]['pop']*100:1.3f}%" + vaccs.append([loc, people_fully_vaccinated[-1], people_fully_vaccinated[-1]/pop[loc]['pop']*100]) # bookkeeping for overview ax1.set_title(title) 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) @@ -167,7 +157,7 @@ def plot(data, countries, pop, metadata={}, **kwargs): # data for loc, tvac, rvac in vaccs: line = f"{loc}" + \ - f"{tvac:,d}".replace(",",".") + \ + f"{int(tvac):,d}".replace(",",".") + \ f"{rvac:3.3f}%".replace(".", ",") if "vaccines" in metadata[loc]: line += f"{metadata[loc]['vaccines']}\n" diff --git a/coronavis.py b/coronavis.py index 2e4acae..12fe46d 100644 --- a/coronavis.py +++ b/coronavis.py @@ -224,6 +224,10 @@ def get_data(): for n in range(1, len(total_vaccinations)): if np.isnan(total_vaccinations[n]) and not np.isnan(total_vaccinations[n-1]): total_vaccinations[n] = total_vaccinations[n-1] + # fix vaccination data: not all countries report fully vaccinated + for n in range(1, len(people_fully_vaccinated)): + if np.isnan(people_fully_vaccinated[n]) and not np.isnan(people_fully_vaccinated[n-1]): + people_fully_vaccinated[n] = people_fully_vaccinated[n-1] ### @@ -254,7 +258,7 @@ def get_data(): if loc in vaccines_country_dict: metadata[loc]['vaccines'] = vaccines_country_dict[loc] # cast population to int - if loc not in ("International", "Africa", "European Union", "Europe", "Asia", "North America", "South America", "Oceania"): + if loc not in ("International", "Africa", "European Union", "Europe", "Asia", "North America", "South America", "Oceania", "Northern Cyprus"): try: metadata[loc]['population'] = int(float(metadata[loc]['population'])) except: metadata[loc][loc]['population'] = np.nan diff --git a/country_details.py b/country_details.py index 2e8f178..0dc2355 100644 --- a/country_details.py +++ b/country_details.py @@ -30,17 +30,32 @@ def plot(data, countries, pop, metadata, **kwargs): # is this country vaccinating? is_vaccinating = True if data[loc]['total_vaccinations'][-1] > 0 else False if is_vaccinating: - first_vac_report = np.argwhere(np.isnan(data[loc]['total_vaccinations']))[-1][0] + 1 - vac_text = f"Impfstart{data[loc]['time'][first_vac_report]}" + vac_text = "" try: - vac_rate = data[loc]['total_vaccinations'][-1]/metadata[loc]['population']*100 - vac_text+= f"Impfrate{vac_rate:1.3f} %" + first_vac_report = np.argwhere(np.isnan(data[loc]['total_vaccinations']))[-1][0] + 1 + vac_text += f"Impfstart{data[loc]['time'][first_vac_report]}" + except: + print("------> country details: strange error, ignoring") + try: + if not (np.isnan(data[loc]['people_fully_vaccinated'])).all(): + vac_rate = data[loc]['people_fully_vaccinated'][-1]/metadata[loc]['population']*100 + vac_text += f"Impfrate{vac_rate:1.3f} %" + else: + vac_text += f"Impfraten/a" + except: pass try: - immune_rate = (data[loc]['total_vaccinations'][-1] + data[loc]['total_cases'][-1])/metadata[loc]['population']*100 - vac_text += f"Immunrate{immune_rate:1.3f} %" - vac_text += f"Geimpfte{data[loc]['total_vaccinations'][-1]}" + if not (np.isnan(data[loc]['people_fully_vaccinated'])).all(): + immune_rate = (data[loc]['people_fully_vaccinated'][-1] + data[loc]['total_cases'][-1])/metadata[loc]['population']*100 + vac_text += f"Immunrate{immune_rate:1.3f} %" + vac_text += f"verabreichte Impfdosen{data[loc]['total_vaccinations'][-1]}" + vac_text += f"vollständig Geimpfte{int(data[loc]['people_fully_vaccinated'][-1])}" + else: + vac_text += f"Immunraten/a %" + vac_text += f"verabreichte Impfdosen{data[loc]['total_vaccinations'][-1]}" + vac_text += f"vollständig Geimpften/a" + except: pass try: @@ -103,7 +118,10 @@ Letztes Update: {datetime.datetime.strftime(datetime.datetime.now(), "%Y-%m-%d")
Testsituation
Testing dataset: Hasell, J., Mathieu, E., Beltekian, D. et al. A cross-country database of COVID-19 testing. Sci Data 7, 345 (2020). DOI:10.1038/s41597-020-00688-8
-
Impfsituation
+
Impfsituation +
+Immunität: Vollständige Impfung oder durchgemachte Erkrankung. Unterschätzung durch vernachlässigte Schutzwirkung der ersten Impfung. Überschätzung durch noch nicht beendete Erkrankungen. +


Zurück
@@ -221,13 +239,13 @@ Ein Infoservice von dukun.de; Anregungen gern