1
0
Fork 0

Compare commits

..

No commits in common. "fc650e120756650fd64baeba02673903d3b2c4ec" and "548eebfc96a7294467c9c283e95e4aa146f9fcf2" have entirely different histories.

2 changed files with 118 additions and 128 deletions

View file

@ -22,8 +22,6 @@
<p class="data-text"> <p class="data-text">
Gestern wurden <em>{{ '{:n}'.format(data_first_vaccination.vaccinations_last_day).replace('.', '') }}</em> Erstimpfungen vorgenommen (<em>{{ '{:.3n}'.format(data_first_vaccination.vaccinations_last_day_percentage) }} %</em> der Bevölkerung, <em>{{ '{:.3n}'.format(data_first_vaccination.vaccinations_last_day_vaccination_percentage) }} %</em> der verabreichten Erstimpfdosen). Gestern wurden <em>{{ '{:n}'.format(data_first_vaccination.vaccinations_last_day).replace('.', '') }}</em> Erstimpfungen vorgenommen (<em>{{ '{:.3n}'.format(data_first_vaccination.vaccinations_last_day_percentage) }} %</em> der Bevölkerung, <em>{{ '{:.3n}'.format(data_first_vaccination.vaccinations_last_day_vaccination_percentage) }} %</em> der verabreichten Erstimpfdosen).
Innerhalb der letzten Kalenderwoche sind <em>{{ '{:.9n}'.format(data_first_vaccination.vaccinations_last_week).replace('.', '') }}</em> Erstimpfungen erfolgt (<em>{{ '{:.3n}'.format(data_first_vaccination.vaccinations_last_week_percentage) }} %</em>, <em>{{ '{:.3n}'.format(data_first_vaccination.vaccinations_last_week_vaccination_percentage) }} %</em>). Innerhalb der letzten Kalenderwoche sind <em>{{ '{:.9n}'.format(data_first_vaccination.vaccinations_last_week).replace('.', '') }}</em> Erstimpfungen erfolgt (<em>{{ '{:.3n}'.format(data_first_vaccination.vaccinations_last_week_percentage) }} %</em>, <em>{{ '{:.3n}'.format(data_first_vaccination.vaccinations_last_week_vaccination_percentage) }} %</em>).
Es wurden außerdem <em>{{ '{:n}'.format(data_second_vaccination.vaccinations_last_day).replace('.', '') }}</em> Zweitimpfungen vorgenommen (<em>{{ '{:.3n}'.format(data_second_vaccination.vaccinations_last_day_percentage) }} %</em> der Bevölkerung, <em>{{ '{:.3n}'.format(data_second_vaccination.vaccinations_last_day_vaccination_percentage) }} %</em> der verabreichten Erstimpfdosen).
Innerhalb der letzten Kalenderwoche sind <em>{{ '{:.9n}'.format(data_second_vaccination.vaccinations_last_week).replace('.', '') }}</em> Zweitimpfungen erfolgt (<em>{{ '{:.3n}'.format(data_second_vaccination.vaccinations_last_week_percentage) }} %</em>, <em>{{ '{:.3n}'.format(data_second_vaccination.vaccinations_last_week_vaccination_percentage) }} %</em>).
</p> </p>
<p class="data-text"> <p class="data-text">
In den letzten sieben Tagen wurden durchschnittlich <em>{{ '{:n}'.format(data_first_vaccination['extrapolation_mean_seven_days']['rate_int']).replace('.', '') }}</em> Erstimpfungen und <em>{{ '{:n}'.format(data_second_vaccination['extrapolation_mean_seven_days']['rate_int']).replace('.', '') }}</em> Zweitimpfungen pro Tag vorgenommen (<em>{{ '{:n}'.format(data_first_vaccination['extrapolation_mean_seven_days']['rate_int'] * 7).replace('.', '') }}</em>/<em>{{ '{:n}'.format(data_second_vaccination['extrapolation_mean_seven_days']['rate_int'] * 7).replace('.', '') }}</em> pro Woche). In den letzten sieben Tagen wurden durchschnittlich <em>{{ '{:n}'.format(data_first_vaccination['extrapolation_mean_seven_days']['rate_int']).replace('.', '') }}</em> Erstimpfungen und <em>{{ '{:n}'.format(data_second_vaccination['extrapolation_mean_seven_days']['rate_int']).replace('.', '') }}</em> Zweitimpfungen pro Tag vorgenommen (<em>{{ '{:n}'.format(data_first_vaccination['extrapolation_mean_seven_days']['rate_int'] * 7).replace('.', '') }}</em>/<em>{{ '{:n}'.format(data_second_vaccination['extrapolation_mean_seven_days']['rate_int'] * 7).replace('.', '') }}</em> pro Woche).

36
plot.py
View file

@ -52,21 +52,16 @@ plt.rcParams["figure.figsize"] = [11.69, 8.27]
# Download # Download
def download_rki(filename_prefix): data_filename = '{}/{}_Impfquotenmonitoring.xlsx'.format(data_folder, filename_now)
data_filename = '{}/{}_Impfquotenmonitoring.xlsx'.format(data_folder, filename_prefix)
r = req.get('https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx?__blob=publicationFile') r = req.get('https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx?__blob=publicationFile')
with open(data_filename, 'wb') as outfile: with open(data_filename, 'wb') as outfile:
outfile.write(r.content) outfile.write(r.content)
return data_filename #data_filename = 'data/20210118151908_Impfquotenmonitoring.xlsx'
data_filename = download_rki(filename_now) rki_file = pd.read_excel(data_filename, sheet_name=None, engine='openpyxl')
def parse_rki(filename):
rki_file = pd.read_excel(filename, sheet_name=None, engine='openpyxl')
raw_data = rki_file['Impfungen_proTag'] raw_data = rki_file['Impfungen_proTag']
@ -108,9 +103,10 @@ def parse_rki(filename):
else: else:
vaccinations_by_week[w] = v vaccinations_by_week[w] = v
def extrapolate(rate, to_be_vaccinated): def extrapolate(rate, to_be_vaccinated):
days_extrapolated = int(np.ceil(to_be_vaccinated / rate)) days_extrapolated = int(np.ceil(to_be_vaccinated / rate))
days_extrapolated_herd_immunity = int(np.ceil((einwohner_deutschland * herd_immunity - total) / rate)) days_extrapolated_herd_immunity = int(np.ceil((einwohner_deutschland * 0.7 - total) / rate))
weeks_extrapolated = int(np.ceil(days_extrapolated / 7)) weeks_extrapolated = int(np.ceil(days_extrapolated / 7))
weeks_extrapolated_herd_immunity = int(np.ceil(days_extrapolated_herd_immunity / 7)) weeks_extrapolated_herd_immunity = int(np.ceil(days_extrapolated_herd_immunity / 7))
@ -142,7 +138,7 @@ def parse_rki(filename):
mean_vaccination_rates_daily = np.round(cumulative / range(1, len(cumulative) + 1)) mean_vaccination_rates_daily = np.round(cumulative / range(1, len(cumulative) + 1))
vaccination_rates_daily_rolling_average = data.rolling(7).mean() vaccination_rates_daily_rolling_average = data.rolling(7).mean()
vaccinations_missing_until_target = einwohner_deutschland * herd_immunity - total vaccinations_missing_until_target = einwohner_deutschland * 0.7 - total
vaccination_rate_needed_for_target = vaccinations_missing_until_target / days_until_target vaccination_rate_needed_for_target = vaccinations_missing_until_target / days_until_target
vaccination_rate_needed_for_target_percentage = mean_all_time / vaccination_rate_needed_for_target * 100 vaccination_rate_needed_for_target_percentage = mean_all_time / vaccination_rate_needed_for_target * 100
@ -201,10 +197,6 @@ def parse_rki(filename):
stand_date = datetime.datetime.strptime(m.groups()[0], '%d.%m.%Y, %H:%M') stand_date = datetime.datetime.strptime(m.groups()[0], '%d.%m.%Y, %H:%M')
print_stand = stand_date.isoformat() print_stand = stand_date.isoformat()
return dates, start_of_reporting_date, data_first_vaccination, data_second_vaccination, stand_date, print_stand
dates, start_of_reporting_date, data_first_vaccination, data_second_vaccination, stand_date, print_stand = parse_rki(filename=data_filename)
filename_stand = stand_date.strftime("%Y%m%d%H%M%S") filename_stand = stand_date.strftime("%Y%m%d%H%M%S")
print(f"Effective {stand_date}, last reported date {dates.iloc[-1].date()}") print(f"Effective {stand_date}, last reported date {dates.iloc[-1].date()}")
@ -686,8 +678,8 @@ def plot_vaccination_done_days():
) )
d = data_first_vaccination d = data_first_vaccination
days_remaining_daily = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['mean_vaccination_rates_daily'])) days_remaining_daily = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['mean_vaccination_rates_daily']))
days_remaining_rolling = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['vaccination_rates_daily_rolling_average'])) days_remaining_rolling = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['vaccination_rates_daily_rolling_average']))
ax.set_xlim(start_of_reporting_date, today) ax.set_xlim(start_of_reporting_date, today)
ax.set_ylim(0, 2500) ax.set_ylim(0, 2500)
@ -730,8 +722,8 @@ def plot_vaccination_done_weeks():
) )
d = data_first_vaccination d = data_first_vaccination
weeks_remaining_daily = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['mean_vaccination_rates_daily'])) / 7 weeks_remaining_daily = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['mean_vaccination_rates_daily'])) / 7
weeks_remaining_rolling = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['vaccination_rates_daily_rolling_average'])) / 7 weeks_remaining_rolling = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['vaccination_rates_daily_rolling_average'])) / 7
ax.set_xlim(datetime.date(2021, 3, 1), today) ax.set_xlim(datetime.date(2021, 3, 1), today)
ax.set_ylim(0, 52) ax.set_ylim(0, 52)
@ -773,8 +765,8 @@ def plot_vaccination_done_dates():
) )
d = data_first_vaccination d = data_first_vaccination
days_remaining_daily = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['mean_vaccination_rates_daily'])) days_remaining_daily = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['mean_vaccination_rates_daily']))
days_remaining_rolling = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['vaccination_rates_daily_rolling_average'])) days_remaining_rolling = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['vaccination_rates_daily_rolling_average']))
dates_daily = [today + datetime.timedelta(days) for days in days_remaining_daily] dates_daily = [today + datetime.timedelta(days) for days in days_remaining_daily]
dates_rolling = [today + datetime.timedelta(days) for days in days_remaining_rolling.dropna()] dates_rolling = [today + datetime.timedelta(days) for days in days_remaining_rolling.dropna()]
@ -819,8 +811,8 @@ def plot_vaccination_done_dates_detail():
) )
d = data_first_vaccination d = data_first_vaccination
days_remaining_daily = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['mean_vaccination_rates_daily'])) days_remaining_daily = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['mean_vaccination_rates_daily']))
days_remaining_rolling = np.ceil((einwohner_deutschland * herd_immunity - d['cumulative']) / (d['vaccination_rates_daily_rolling_average'])) days_remaining_rolling = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['vaccination_rates_daily_rolling_average']))
dates_daily = [today + datetime.timedelta(days) for days in days_remaining_daily] dates_daily = [today + datetime.timedelta(days) for days in days_remaining_daily]
dates_rolling = [today + datetime.timedelta(days) for days in days_remaining_rolling.dropna()] dates_rolling = [today + datetime.timedelta(days) for days in days_remaining_rolling.dropna()]