feat: Added parsing of details and table with details to dashboard
This commit is contained in:
parent
fe6cfaf8b6
commit
bac8cac1b7
3 changed files with 138 additions and 3 deletions
|
@ -31,6 +31,64 @@
|
|||
Mit dieser Rate dauert es bis zum <em>{{ mean_vaccinations_last_seven_days_herd_immunity }}</em> für {{ herd_immunity }} % und bis zum <em>{{ mean_vaccinations_last_seven_days_done }}</em> für 100 %.
|
||||
</p>
|
||||
</section>
|
||||
<section>
|
||||
<h1>Details</h1>
|
||||
<figure>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="3">Land</th>
|
||||
<th rowspan="2" colspan="2">
|
||||
Impfungen<br />
|
||||
gesamt
|
||||
</th>
|
||||
<th colspan="8">Impfung wegen<sup><a href="#footnote-006">6</a></sup></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Alter</th>
|
||||
<th colspan="2">Beruf</th>
|
||||
<th colspan="2">Gesundheit</th>
|
||||
<th colspan="2">Pflegeheim</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Anzahl</th>
|
||||
<th>%</th>
|
||||
<th>Anzahl</th>
|
||||
<th>%</th>
|
||||
<th>Anzahl</th>
|
||||
<th>%</th>
|
||||
<th>Anzahl</th>
|
||||
<th>%</th>
|
||||
<th>Anzahl</th>
|
||||
<th>%</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for land in details_per_land %}
|
||||
<tr>
|
||||
<th>{{ land }}</th>
|
||||
<td class="number">{{ details_per_land[land].total_vaccinations }}</td>
|
||||
<td class="number">{{ details_per_land[land].total_vaccinations_percentage }} %</td>
|
||||
<td class="number">{{ details_per_land[land].vaccination_reason_age }}</td>
|
||||
<td class="number">{{ details_per_land[land].vaccination_reason_age_percentage }} %</td>
|
||||
<td class="number">{{ details_per_land[land].vaccination_reason_job }}</td>
|
||||
<td class="number">{{ details_per_land[land].vaccination_reason_job_percentage }} %</td>
|
||||
<td class="number">{{ details_per_land[land].vaccination_reason_medical }}</td>
|
||||
<td class="number">{{ details_per_land[land].vaccination_reason_medical_percentage }} %</td>
|
||||
<td class="number">{{ details_per_land[land].vaccination_reason_oldhome }}</td>
|
||||
<td class="number">{{ details_per_land[land].vaccination_reason_oldhome_percentage }} %</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<figcaption>
|
||||
<a name="table-001"><span class="ref">Tabelle 1:</span></a>
|
||||
Details der Impfungen, aufgeschlüsselt nach Ländern<br />
|
||||
Der Prozentwert bezieht sich bei den Gründen auf die in dem jeweiligen Land insgesamt vorgenommenen Impfungen, nicht auf die Größe der jeweiligen Gruppe.
|
||||
Eine Impfung kann mehrere der genannten Gründe haben oder bei keinen der Gründen genannt werden, daher stimmen die Summe der Gründe und die Gesamtzahl der Impfungen nicht überein.
|
||||
</figcaption>
|
||||
</figure>
|
||||
</section>
|
||||
<section>
|
||||
<h1>Fragen und Antworten</h1>
|
||||
<section>
|
||||
|
@ -138,6 +196,7 @@
|
|||
<li><a name="footnote-003">Bevölkerungsstand vom 31. Dezember 2019: {{ einwohner_deutschland }}.</a></li>
|
||||
<li><a name="footnote-004">{{ herd_immunity }} % ist der Wert, bei dem aktuell von einer Herdenimmunität ausgegangen wird.</a></li>
|
||||
<li><a name="footnote-005">Die täglichen Impfraten unterliegen starken Schwankungen und sind daher wenig aussagekräftig.</a></li>
|
||||
<li><a name="footnote-006">Nicht alle Länder veröffentlichen alle in der Aufschlüsselung aufgelisteten Daten.</a></li>
|
||||
</ol>
|
||||
</section>
|
||||
</body>
|
||||
|
|
53
plot.py
53
plot.py
|
@ -40,8 +40,6 @@ with open(data_filename, 'wb') as outfile:
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
rki_file = pd.read_excel(data_filename, sheet_name=None, engine='openpyxl')
|
||||
|
||||
raw_data = rki_file['Impfungen_proTag']
|
||||
|
@ -113,6 +111,54 @@ print_stand = stand_date.isoformat()
|
|||
filename_stand = stand_date.strftime("%Y%m%d%H%M%S")
|
||||
|
||||
|
||||
# Infos der einzelnen Länder
|
||||
details_sheet_name = (set(rki_file.keys()) - {'Erläuterung', 'Impfungen_proTag'}).pop()
|
||||
|
||||
details_sheet = rki_file[details_sheet_name]
|
||||
|
||||
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 = {}
|
||||
for i in range(len(land_names)):
|
||||
|
||||
details_per_land[land_names[i]] = {
|
||||
'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),
|
||||
|
||||
}
|
||||
details_per_land_formatted[land_names[i]] = {
|
||||
'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)),
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
archive_folder = site_folder + 'archive/' + filename_stand
|
||||
|
||||
if os.path.isdir(archive_folder):
|
||||
|
@ -227,7 +273,8 @@ def render_dashboard():
|
|||
last_date_day_rate_done = last_date_day_rate_done.strftime(df),
|
||||
mean_vaccinations_last_seven_days = '{:n}'.format(mean_vaccinations_last_seven_days_int).replace('.', ' '),
|
||||
mean_vaccinations_last_seven_days_herd_immunity = mean_vaccinations_last_seven_days_herd_immunity.strftime(df),
|
||||
mean_vaccinations_last_seven_days_done = mean_vaccinations_last_seven_days_done.strftime(df)
|
||||
mean_vaccinations_last_seven_days_done = mean_vaccinations_last_seven_days_done.strftime(df),
|
||||
details_per_land = details_per_land_formatted
|
||||
).dump('site/index.xhtml')
|
||||
|
||||
shutil.copyfile(dashboard_filename, dashboard_archive_filename)
|
||||
|
|
|
@ -45,6 +45,10 @@ sup {
|
|||
|
||||
|
||||
|
||||
figure {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
figure img {
|
||||
width: 90%;
|
||||
height: auto;
|
||||
|
@ -57,3 +61,28 @@ figure figcaption {
|
|||
figure figcaption .ref {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
figure {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table td, table th {
|
||||
padding: .2em .5em;
|
||||
border: 1px solid #333333;
|
||||
}
|
||||
|
||||
table th {
|
||||
background: #BADBFF;
|
||||
}
|
||||
|
||||
table tbody th {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table td.number {
|
||||
text-align: right;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue