diff --git a/dashboard_template.xhtml b/dashboard_template.xhtml index 75fac84..9c7ec1c 100644 --- a/dashboard_template.xhtml +++ b/dashboard_template.xhtml @@ -8,7 +8,7 @@

Dashboard Impfungen

- Quelle: Robert-Koch-Institut (RKI)
+ Quelle: Robert-Koch-Institut (RKI)
Stand: {{ stand }}

diff --git a/plot.py b/plot.py index f294877..5ef08d1 100644 --- a/plot.py +++ b/plot.py @@ -193,6 +193,107 @@ filename_stand = stand_date.strftime("%Y%m%d%H%M%S") print(f"Effective {stand_date}, last reported date {dates.iloc[-1].date()}") +''' + +# Infos der einzelnen Länder +details_sheet_name = (set(rki_file.keys()) - {'Erläuterung', 'Impfungen_proTag'}).pop() + +details_sheet = rki_file[details_sheet_name] + +regionalcodes = details_sheet['RS'].iloc[0:17] +land_names = details_sheet['Bundesland'].iloc[0:17] + +total_vaccinations_by_land = details_sheet['Impfungen kumulativ'].iloc[0:17] +vaccination_per_mille_by_land = details_sheet['Impfungen pro 1.000 Einwohner'].iloc[0:17] + +vaccination_reason_age_by_land = details_sheet['Indikation nach Alter*'].iloc[0:17] +vaccination_reason_job_by_land = details_sheet['Berufliche Indikation*'].iloc[0:17] +vaccination_reason_medical_by_land = details_sheet['Medizinische Indikation*'].iloc[0:17] +vaccination_reason_oldhome_by_land = details_sheet['Pflegeheim-bewohnerIn*'].iloc[0:17] + +details_per_land = {} +details_per_land_formatted = {} + +# Regionalcodes der Länder zu Abkürzung und Name (Plus gesamt) +laendernamen = [ + ('SH', 'Schleswig-Holstein'), + ('HH', 'Hamburg'), + ('NI', 'Niedersachsen'), + ('HB', 'Bremen'), + ('NW', 'Nordrhein-Westfalen'), + ('HE', 'Hessen'), + ('RP', 'Rheinland-Pfalz'), + ('BW', 'Baden-Württemberg'), + ('BY', 'Bayern'), + ('SL', 'Saarland'), + ('BE', 'Berlin'), + ('BB', 'Brandenburg'), + ('MV', 'Mecklenburg-Vorpommern'), + ('SN', 'Sachsen'), + ('ST', 'Sachsen-Anhalt'), + ('TH', 'Thüringen'), + ('𝚺', 'Gesamt') +] + +def row_to_details(i): + regionalcode = regionalcodes[i] if i != 16 else 16 + + print(laendernamen[regionalcode]) + + shortname, name = laendernamen[regionalcode] + + return { + 'name': name, + 'shortname': shortname, + 'total_vaccinations': int(total_vaccinations_by_land[i]), + 'total_vaccinations_percentage': vaccination_per_mille_by_land[i] / 10, + 'vaccination_reason_age': int(vaccination_reason_age_by_land[i]), + 'vaccination_reason_age_percentage': np.round(vaccination_reason_age_by_land[i] / total_vaccinations_by_land[i] * 100), + 'vaccination_reason_job': int(vaccination_reason_job_by_land[i]), + 'vaccination_reason_job_percentage': np.round(vaccination_reason_job_by_land[i] / total_vaccinations_by_land[i] * 100), + 'vaccination_reason_medical': int(vaccination_reason_medical_by_land[i]), + 'vaccination_reason_medical_percentage': np.round(vaccination_reason_medical_by_land[i] / total_vaccinations_by_land[i] * 100), + 'vaccination_reason_oldhome': int(vaccination_reason_oldhome_by_land[i]), + 'vaccination_reason_oldhome_percentage': np.round(vaccination_reason_oldhome_by_land[i] / total_vaccinations_by_land[i] * 100), + } + +def row_to_details_formatted(i): + regionalcode = regionalcodes[i] if i != 16 else 16 + + print(laendernamen[regionalcode]) + + shortname, name = laendernamen[regionalcode] + + return { + 'name': name, + 'shortname': shortname, + 'total_vaccinations': '{:n}'.format(int(total_vaccinations_by_land[i])).replace('.', ' '), + 'total_vaccinations_percentage': '{:.3n}'.format(np.round(vaccination_per_mille_by_land[i] / 10, 2)), + 'vaccination_reason_age': '{:n}'.format(int(vaccination_reason_age_by_land[i])).replace('.', ' '), + 'vaccination_reason_age_percentage': '{:n}'.format(np.round(vaccination_reason_age_by_land[i] / total_vaccinations_by_land[i] * 100)), + 'vaccination_reason_job': '{:n}'.format(int(vaccination_reason_job_by_land[i])).replace('.', ' '), + 'vaccination_reason_job_percentage': '{:n}'.format(np.round(vaccination_reason_job_by_land[i] / total_vaccinations_by_land[i] * 100)), + 'vaccination_reason_medical': '{:n}'.format(int(vaccination_reason_medical_by_land[i])).replace('.', ' '), + 'vaccination_reason_medical_percentage': '{:n}'.format(np.round(vaccination_reason_medical_by_land[i] / total_vaccinations_by_land[i] * 100)), + 'vaccination_reason_oldhome': '{:n}'.format(int(vaccination_reason_oldhome_by_land[i])).replace('.', ' '), + 'vaccination_reason_oldhome_percentage': '{:n}'.format(np.round(vaccination_reason_oldhome_by_land[i] / total_vaccinations_by_land[i] * 100)) + } + + +for i in range(len(land_names) - 1): + + details_per_land[land_names[i]] = row_to_details(i) + details_per_land_formatted[land_names[i]] = row_to_details_formatted(i) + +details_total = row_to_details(16) +details_total_formatted = row_to_details_formatted(16) + +''' + + + + + archive_folder = site_folder + 'archive/' + filename_stand