')
print('%s | ' % date)
- long_wsum = translate['wsum']
- long_wavg = translate['wavg']
- long_winc = translate['winc']
+ print('')
+ print('+ | ')
+ for abbr in ['Σ', 'Ã', 'i']:
+ print('%s | ' %
+ (translate[abbr], abbr))
+ print(' | ')
for district in sorted_districts:
district_data = db[district][date]
- week_sum = week_avg = week_inc = ''
+ week_sum = week_avg = week_inc = '?'
new_infections = district_data['new_infections']
if 'week_sum' in district_data:
week_sum = '%s' % district_data['week_sum']
@@ -166,15 +186,12 @@ table, tr, th, td { border: 1px solid black; }
if 'week_incidence' in district_data:
week_inc = '%.1f' % district_data['week_incidence']
print('')
- print(new_infections)
- if district == sum_district:
- print('
')
- else:
- print('
')
- print('%s | %s | ' % (long_wsum, week_sum))
- print('%s | %s | ' % (long_wavg, week_avg))
- print('%s | %s | ' % (long_winc, week_inc))
- print(' ')
+ print('')
+ print('%s | ' % new_infections)
+ print('%s | ' % week_sum)
+ print('%s | ' % week_avg)
+ print('%s | ' % week_inc)
+ print(' ')
print('')
print('')
print(' ')
@@ -186,7 +203,7 @@ elif output_type == 'txt':
# Explain what this is.
intro = \
"""Table of Berlin's Corona infection number development by districts.
-Updated daily around 9pm.
+Updated daily at 9pm based on data from the "Senatsverwaltung für Gesundheit, Pflege und Gleichstellung".
Abbrevations/explanations:
"""
@@ -194,6 +211,7 @@ Abbrevations/explanations:
intro += "%s: %s\n" % (k, translate[k])
intro += """
Source code: https://plomlompom.com/repos/?p=berlin-corona-table
+HTML view: https://plomlompom.com/berlin_corona.html
"""
print(intro)
@@ -201,13 +219,12 @@ Source code: https://plomlompom.com/repos/?p=berlin-corona-table
# separated into 7-day units.
sorted_dates.reverse()
weekday_count = 0
- sum_district = sorted_districts[-1]
for date in sorted_dates:
# Week table header.
if weekday_count == 0:
- print(' '*11, ' '.join(sorted_districts[:-1]),
- sorted_districts[-1], 'wsum', ' wavg', 'winc')
+ print(' '*10, ' '.join(sorted_districts),
+ ' Σ', ' Ã', ' i')
week_start_date = date
# Day data line.
@@ -236,14 +253,14 @@ Source code: https://plomlompom.com/repos/?p=berlin-corona-table
weekly_sums = []
weekly_avgs = []
weekly_incs = []
- for district in sorted_districts[:-1]:
+ for district in sorted_districts[1:]:
weekly_sums += [db[district][week_start_date]['week_sum']]
weekly_avgs += [db[district][week_start_date]['week_average']]
weekly_incs += [db[district][week_start_date]['week_incidence']]
print()
print('district stats for week from %s to %s:' % (date, week_start_date))
- print(' '*7, ' '.join(sorted_districts[:-1]))
- print('wsum', ' '.join(['%5.1f' % wsum for wsum in weekly_sums]))
- print('wavg', ' '.join(['%5.1f' % wavg for wavg in weekly_avgs]))
- print('winc', ' '.join(['%5.1f' % winc for winc in weekly_incs]))
+ print(' '*4, ' '.join(sorted_districts[1:]))
+ print('Σ', ' '.join(['%5.1f' % wsum for wsum in weekly_sums]))
+ print('Ã', ' '.join(['%5.1f' % wavg for wavg in weekly_avgs]))
+ print('i', ' '.join(['%5.1f' % winc for winc in weekly_incs]))
print()
|