X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/gitweb.css?a=blobdiff_plain;f=enhance_table.py;h=bdf91e1654a28be8d6c33445362f2cd0aadf7a3f;hb=76d923286b2178d07972ac6b4da6c8877362b479;hp=0482bdfbffbf8fe0e89bb174454b04f561318a92;hpb=5252dee46a33cce9616ba4e4103b59dba2ec44c1;p=berlin-corona-table diff --git a/enhance_table.py b/enhance_table.py index 0482bdf..bdf91e1 100755 --- a/enhance_table.py +++ b/enhance_table.py @@ -32,6 +32,9 @@ translate = { 'TS': 'Tempelhof-Schöneberg', 'TK': 'Treptow-Köpenick', 'sum': 'all of Berlin', + 'wsum': 'sum for last 7 days', + 'wavg': 'per-day average of new infections for last 7 days', + 'winc': 'incidence (x per 100k inhabitants) of new infections for last 7 days', } # Read infections table path and output type. @@ -136,12 +139,17 @@ if output_type == 'html': print('') print('date') for district in sorted_districts: - print('%s' % district) + long_form = translate[district] + print('%s' % long_form) print('') sorted_dates.reverse() for date in sorted_dates: print('') print('%s' % date) + long_wsum = translate['wsum'] + long_wavg = translate['wavg'] + long_winc = translate['winc'] for district in sorted_districts: district_data = db[district][date] week_sum = week_avg = week_inc = '' @@ -153,12 +161,12 @@ if output_type == 'html': if 'week_incidence' in district_data: week_inc = '%.1f' % district_data['week_incidence'] print('') - print('') - print('' % new_infections) - print('' % week_sum) - print('' % week_avg) - print('' % week_inc) - print('
new%s
wsum%s
wavg%s
winc%s
') + print(new_infections) + print('
(more)') + print('' % (long_wsum, week_sum)) + print('' % (long_wavg, week_avg)) + print('' % (long_winc, week_inc)) + print('
%s%s
%s%s
%s%s
') print('') print('') print('') @@ -176,10 +184,7 @@ Abbrevations/explanations: """ for k in translate: intro += "%s: %s\n" % (k, translate[k]) - intro += """wsum: sum for last 7 days -wavg: per-day average of new infections for last 7 days -winc: incidence (x per 100k inhabitants) of new infections for last 7 days - + intro += """ Source code: https://plomlompom.com/repos/?p=berlin-corona-table """ print(intro)