feat: Reliably sort table rows, total count split into footer
This commit is contained in:
parent
bac8cac1b7
commit
0284c755ae
3 changed files with 40 additions and 7 deletions
|
@ -80,6 +80,21 @@
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Gesamt</th>
|
||||||
|
<td class="number">{{ details_total.total_vaccinations }}</td>
|
||||||
|
<td class="number">{{ details_total.total_vaccinations_percentage }} %</td>
|
||||||
|
<td class="number">{{ details_total.vaccination_reason_age }}</td>
|
||||||
|
<td class="number">{{ details_total.vaccination_reason_age_percentage }} %</td>
|
||||||
|
<td class="number">{{ details_total.vaccination_reason_job }}</td>
|
||||||
|
<td class="number">{{ details_total.vaccination_reason_job_percentage }} %</td>
|
||||||
|
<td class="number">{{ details_total.vaccination_reason_medical }}</td>
|
||||||
|
<td class="number">{{ details_total.vaccination_reason_medical_percentage }} %</td>
|
||||||
|
<td class="number">{{ details_total.vaccination_reason_oldhome }}</td>
|
||||||
|
<td class="number">{{ details_total.vaccination_reason_oldhome_percentage }} %</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
<figcaption>
|
<figcaption>
|
||||||
<a name="table-001"><span class="ref">Tabelle 1:</span></a>
|
<a name="table-001"><span class="ref">Tabelle 1:</span></a>
|
||||||
|
|
22
plot.py
22
plot.py
|
@ -128,9 +128,9 @@ vaccination_reason_oldhome_by_land = details_sheet['Pflegeheim-bewohnerIn*'].ilo
|
||||||
|
|
||||||
details_per_land = {}
|
details_per_land = {}
|
||||||
details_per_land_formatted = {}
|
details_per_land_formatted = {}
|
||||||
for i in range(len(land_names)):
|
|
||||||
|
|
||||||
details_per_land[land_names[i]] = {
|
def row_to_details(i):
|
||||||
|
return {
|
||||||
'total_vaccinations': int(total_vaccinations_by_land[i]),
|
'total_vaccinations': int(total_vaccinations_by_land[i]),
|
||||||
'total_vaccinations_percentage': vaccination_per_mille_by_land[i] / 10,
|
'total_vaccinations_percentage': vaccination_per_mille_by_land[i] / 10,
|
||||||
'vaccination_reason_age': int(vaccination_reason_age_by_land[i]),
|
'vaccination_reason_age': int(vaccination_reason_age_by_land[i]),
|
||||||
|
@ -141,9 +141,10 @@ for i in range(len(land_names)):
|
||||||
'vaccination_reason_medical_percentage': np.round(vaccination_reason_medical_by_land[i] / total_vaccinations_by_land[i] * 100),
|
'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': 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),
|
'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]] = {
|
|
||||||
|
def row_to_details_formatted(i):
|
||||||
|
return {
|
||||||
'total_vaccinations': '{:n}'.format(int(total_vaccinations_by_land[i])).replace('.', ' '),
|
'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)),
|
'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': '{:n}'.format(int(vaccination_reason_age_by_land[i])).replace('.', ' '),
|
||||||
|
@ -153,11 +154,17 @@ for i in range(len(land_names)):
|
||||||
'vaccination_reason_medical': '{:n}'.format(int(vaccination_reason_medical_by_land[i])).replace('.', ' '),
|
'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_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': '{: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)),
|
'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
|
archive_folder = site_folder + 'archive/' + filename_stand
|
||||||
|
|
||||||
|
@ -274,7 +281,8 @@ def render_dashboard():
|
||||||
mean_vaccinations_last_seven_days = '{:n}'.format(mean_vaccinations_last_seven_days_int).replace('.', ' '),
|
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_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
|
details_per_land = dict(sorted(details_per_land_formatted.items(), key=lambda item: item[0])),
|
||||||
|
details_total = details_total_formatted
|
||||||
).dump('site/index.xhtml')
|
).dump('site/index.xhtml')
|
||||||
|
|
||||||
shutil.copyfile(dashboard_filename, dashboard_archive_filename)
|
shutil.copyfile(dashboard_filename, dashboard_archive_filename)
|
||||||
|
|
|
@ -68,6 +68,7 @@ figure {
|
||||||
|
|
||||||
table {
|
table {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
table td, table th {
|
table td, table th {
|
||||||
|
@ -86,3 +87,12 @@ table tbody th {
|
||||||
table td.number {
|
table td.number {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thead {
|
||||||
|
border-bottom: 2px solid #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
tfoot {
|
||||||
|
background: white;
|
||||||
|
border-top: 2px solid #333333;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue