diff --git a/src/flask_covid19/blueprints/data_ecdc/ecdc_views.py b/src/flask_covid19/blueprints/data_ecdc/ecdc_views.py index bf0a24ec9cf584c723da8c102c4ccfb696a95bce..e8ac7a6e4879e2245a7a7edff8a1a85d05634d4b 100644 --- a/src/flask_covid19/blueprints/data_ecdc/ecdc_views.py +++ b/src/flask_covid19/blueprints/data_ecdc/ecdc_views.py @@ -29,7 +29,7 @@ admin.add_view(ModelView(EcdcData, db.session, category="ECDC")) @app_ecdc.route('/info') def url_ecdc_info(): - page_info = WebPageContent('Europe', "Info") + page_info = WebPageContent('ECDC', "Info") return render_template( 'ecdc/ecdc_info.html', title='Europe', @@ -38,7 +38,7 @@ def url_ecdc_info(): @app_ecdc.route('/tasks') def url_ecdc_tasks(): - page_info = WebPageContent('Europe', "Tasks") + page_info = WebPageContent('ECDC', "Tasks") return render_template( 'ecdc/ecdc_tasks.html', title='Europe Tasks', @@ -47,8 +47,8 @@ def url_ecdc_tasks(): @app_ecdc.route('/imported/page/<int:page>') @app_ecdc.route('/imported') -def url_ecdc_data_imported(page=1): - page_info = WebPageContent('Europe', "Last Import") +def url_ecdc_imported(page=1): + page_info = WebPageContent('ECDC', "Last Import") page_data = EcdcImport.get_all_as_page(page) return render_template( 'ecdc/imported/ecdc_imported.html', @@ -56,10 +56,21 @@ def url_ecdc_data_imported(page=1): page_info=page_info) +@app_ecdc.route('/flat/page/<int:page>') +@app_ecdc.route('/flat') +def url_ecdc_flat(page=1): + page_info = WebPageContent('ECDC', "flat") + page_data = EcdcFlat.get_all_as_page(page) + return render_template( + 'ecdc/flat/ecdc_flat.html', + page_data=page_data, + page_info=page_info) + + @app_ecdc.route('/date_reported/all/page/<int:page>') @app_ecdc.route('/date_reported/all') def url_ecdc_date_reported_all(page=1): - page_info = WebPageContent('Europe', "date_reported") + page_info = WebPageContent('ECDC', "date_reported") page_data = EcdcDateReported.get_all_as_page(page) return render_template( 'ecdc/date_reported/all/ecdc_date_reported_all.html', @@ -72,7 +83,7 @@ def url_ecdc_date_reported_all(page=1): @app_ecdc.route('/date_reported/notification_rate/<int:europe_date_reported_id>/page/<int:page>') @app_ecdc.route('/date_reported/notification_rate/<int:europe_date_reported_id>') def url_ecdc_date_reported_one_notification_rate(europe_date_reported_id, page=1): - page_info = WebPageContent('Europe', "date_reported") + page_info = WebPageContent('ECDC', "date_reported") europe_date_reported = EcdcDateReported.get_by_id(europe_date_reported_id) page_data = EcdcData.find_by_date_reported_order_by_notification_rate(europe_date_reported, page) return render_template( @@ -85,7 +96,7 @@ def url_ecdc_date_reported_one_notification_rate(europe_date_reported_id, page=1 @app_ecdc.route('/date_reported/deaths_weekly/<int:europe_date_reported_id>/page/<int:page>') @app_ecdc.route('/date_reported/deaths_weekly/<int:europe_date_reported_id>') def url_ecdc_date_reported_one_deaths_weekly(europe_date_reported_id, page=1): - page_info = WebPageContent('Europe', "date_reported") + page_info = WebPageContent('ECDC', "date_reported") europe_date_reported = EcdcDateReported.get_by_id(europe_date_reported_id) page_data = EcdcData.find_by_date_reported_order_by_deaths_weekly(europe_date_reported, page) return render_template( @@ -98,7 +109,7 @@ def url_ecdc_date_reported_one_deaths_weekly(europe_date_reported_id, page=1): @app_ecdc.route('/date_reported/cases_weekly/<int:europe_date_reported_id>/page/<int:page>') @app_ecdc.route('/date_reported/cases_weekly/<int:europe_date_reported_id>') def url_ecdc_date_reported_one_cases_weekly(europe_date_reported_id, page=1): - page_info = WebPageContent('Europe', "date_reported") + page_info = WebPageContent('ECDC', "date_reported") europe_date_reported = EcdcDateReported.get_by_id(europe_date_reported_id) page_data = EcdcData.find_by_date_reported_order_by_cases_weekly(europe_date_reported, page) return render_template( @@ -111,7 +122,7 @@ def url_ecdc_date_reported_one_cases_weekly(europe_date_reported_id, page=1): @app_ecdc.route('/continent/all/page/<int:page>') @app_ecdc.route('/continent/all') def url_ecdc_continent_all(page=1): - page_info = WebPageContent('Europe', "continent") + page_info = WebPageContent('ECDC', "continent") page_data = EcdcContinent.get_all_as_page(page) return render_template( 'ecdc/continent/all/ecdc_continent_all.html', @@ -122,7 +133,7 @@ def url_ecdc_continent_all(page=1): @app_ecdc.route('/continent/<int:continent_id>/page/<int:page>') @app_ecdc.route('/continent/<int:continent_id>') def url_ecdc_continent_one(continent_id: int, page=1): - page_info = WebPageContent('Europe', "continent") + page_info = WebPageContent('ECDC', "continent") continent = EcdcContinent.get_by_id(continent_id) page_data = EcdcCountry.find_by_location_group(continent, page) return render_template( @@ -135,7 +146,7 @@ def url_ecdc_continent_one(continent_id: int, page=1): @app_ecdc.route('/country/all/page/<int:page>') @app_ecdc.route('/country/all') def url_ecdc_country_all(page=1): - page_info = WebPageContent('Europe', "country") + page_info = WebPageContent('ECDC', "country") page_data = EcdcCountry.get_all_as_page(page) return render_template( 'ecdc/country/all/ecdc_country_all.html', @@ -146,7 +157,7 @@ def url_ecdc_country_all(page=1): @app_ecdc.route('/country/<int:country_id>/page/<int:page>') @app_ecdc.route('/country/<int:country_id>') def url_ecdc_country_one(country_id, page=1): - page_info = WebPageContent('Europe', "country") + page_info = WebPageContent('ECDC', "country") europe_country = EcdcCountry.get_by_id(country_id) page_data = EcdcData.find_by_location(europe_country, page) return render_template( @@ -159,7 +170,7 @@ def url_ecdc_country_one(country_id, page=1): @app_ecdc.route('/country/germany/page/<int:page>') @app_ecdc.route('/country/germany') def url_ecdc_country_germany(page=1): - page_info = WebPageContent('Europe', "country: Germany") + page_info = WebPageContent('ECDC', "country: Germany") europe_country = EcdcCountry.find_germany() if europe_country is None: flash('country: Germany not found in Database', category='error') diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat.html new file mode 100644 index 0000000000000000000000000000000000000000..9658216a64d37d866eb59690f187e565ed184a96 --- /dev/null +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat.html @@ -0,0 +1,33 @@ +{% extends 'app_application/layout/page_layout.html' %} + +{% block content %} + {{super()}} + {% include 'ecdc/navigation/ecdc_navtabs.html' %} + + <div class="container"> + <div class="row"> + <div class="col"> + {% include 'ecdc/flat/ecdc_flat_pagination.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'ecdc/flat/ecdc_flat_table.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'ecdc/flat/ecdc_flat_pagination.html' %} + </div> + </div> + </div> + +{% endblock %} + +{% block footer_container %} + <div> + {% for error in errors %} + <h4>{{ error }}</h4> + {% endfor %} + </div> +{% endblock %} \ No newline at end of file diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat_pagination.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat_pagination.html new file mode 100644 index 0000000000000000000000000000000000000000..6713e99ea7da9a6b2a7ff09af7803c71cb444fb9 --- /dev/null +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat_pagination.html @@ -0,0 +1,37 @@ + {% if page_data.pages > 1 %} + <!-- previous page --> + <ul class="pagination"> + {% if page_data.has_prev %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('ecdc.url_ecdc_flat', page=page_data.prev_num) }}">Previous</a> + </li> + {% endif %} + <!-- all page numbers --> + {% for page_num in page_data.iter_pages() %} + {% if page_num %} + {% if page_num != page_data.page %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('ecdc.url_ecdc_flat', page=page_num) }}">{{ page_num }}</a> + </li> + {% else %} + <li class="page-item active"> + <a class="page-link" href="#">{{ page_num }}</a> + </li> + {% endif %} + {% else %} + <li class="page-item"> + <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> + </li> + {% endif %} + {% endfor %} + <!-- next page --> + {% if page_data.has_next %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('ecdc.url_ecdc_flat', page=page_data.next_num) }}">Next</a> + </li> + {% endif %} + </ul> + {% endif %} diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat_table.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat_table.html new file mode 100644 index 0000000000000000000000000000000000000000..0ac9e868a0fbfcb44cea61790b941e1c39a4943a --- /dev/null +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat_table.html @@ -0,0 +1,28 @@ + <div class="table-responsive"> + <table class="table table-hover table-striped table-dark"> + <thead class="table-secondary"> + {% include 'ecdc/flat/ecdc_flat_table_head.html' %} + </thead> + <tbody> + {% for o in page_data.items %} + <tr> + <td>{{ o.datum }}</td> + <td>{{ o.year }}</td> + <td>{{ o.month }}</td> + <td>{{ o.day_of_month }}</td> + <td>{{ o.cases }}</td> + <td>{{ o.deaths }}</td> + <td>{{ o.pop_data_2019 }}</td> + <td>{{ o.location }}</td> + <td>{{ o.geo_id }}</td> + <td>{{ o.location_code }}</td> + <td>{{ o.location_group }}</td> + <td>{{ o.cumulative_number_for_14_days_of_covid19_cases_per_100000 }}</td> + </tr> + {% endfor %} + </tbody> + <tfoot class="table-secondary"> + {% include 'ecdc/flat/ecdc_flat_table_head.html' %} + </tfoot> + </table> + </div> diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat_table_head.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat_table_head.html new file mode 100644 index 0000000000000000000000000000000000000000..f7e19c4606a11c94aa2dc5242c633a07804bded6 --- /dev/null +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/flat/ecdc_flat_table_head.html @@ -0,0 +1,14 @@ + <tr> + <th scope="col">date reported</th> + <th scope="col">date rep year</th> + <th scope="col">date rep month</th> + <th scope="col">date rep day</th> + <th scope="col">cases weekly</th> + <th scope="col">deaths weekly</th> + <th scope="col">population data 2019</th> + <th scope="col">countries and territories</th> + <th scope="col">geo id</th> + <th scope="col">country territory code</th> + <th scope="col">continent</th> + <th scope="col">notification rate per 100000 population 14days</th> + </tr> diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_pagination.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_pagination.html index 40548e261d0a3af944dde726c7cff34382ff6b42..e5d8a589d6ed52e4e0a2191e15fbd233d59a1cae 100644 --- a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_pagination.html +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_pagination.html @@ -4,7 +4,7 @@ {% if page_data.has_prev %} <li class="page-item"> <a class="page-link" - href="{{ url_for('ecdc.url_ecdc_data_imported', page=page_data.prev_num) }}">Previous</a> + href="{{ url_for('ecdc.url_ecdc_imported', page=page_data.prev_num) }}">Previous</a> </li> {% endif %} <!-- all page numbers --> @@ -13,7 +13,7 @@ {% if page_num != page_data.page %} <li class="page-item"> <a class="page-link" - href="{{ url_for('ecdc.url_ecdc_data_imported', page=page_num) }}">{{ page_num }}</a> + href="{{ url_for('ecdc.url_ecdc_imported', page=page_num) }}">{{ page_num }}</a> </li> {% else %} <li class="page-item active"> @@ -30,7 +30,7 @@ {% if page_data.has_next %} <li class="page-item"> <a class="page-link" - href="{{ url_for('ecdc.url_ecdc_data_imported', page=page_data.next_num) }}">Next</a> + href="{{ url_for('ecdc.url_ecdc_imported', page=page_data.next_num) }}">Next</a> </li> {% endif %} </ul> diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_table.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_table.html index b6a794f336b02e2885d848eaf9d4c5a0bcefb281..7b060ad8680817a60a0b795840bb0bac3d795875 100644 --- a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_table.html +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_table.html @@ -1,27 +1,15 @@ + <div class="table-responsive"> <table class="table table-hover table-striped table-dark"> <thead class="table-secondary"> - <tr> - <th scope="col">date reported</th> - <th scope="col">date rep year</th> - <th scope="col">date rep month</th> - <th scope="col">date rep day</th> - <th scope="col">cases weekly</th> - <th scope="col">deaths weekly</th> - <th scope="col">population data 2019</th> - <th scope="col">countries and territories</th> - <th scope="col">geo id</th> - <th scope="col">country territory code</th> - <th scope="col">continent</th> - <th scope="col">notification rate per 100000 population 14days</th> - </tr> + {% include 'ecdc/imported/ecdc_imported_table_head.html' %} </thead> <tbody> {% for o in page_data.items %} <tr> <td>{{ o.date_rep }}</td> - <td>{{ o.date_rep_year }}</td> - <td>{{ o.date_rep_month }}</td> - <td>{{ o.date_rep_day }}</td> + <td>{{ o.year }}</td> + <td>{{ o.month }}</td> + <td>{{ o.day }}</td> <td>{{ o.cases }}</td> <td>{{ o.deaths }}</td> <td>{{ o.pop_data_2019 }}</td> @@ -33,4 +21,8 @@ </tr> {% endfor %} </tbody> - </table> \ No newline at end of file + <tfoot class="table-secondary"> + {% include 'ecdc/imported/ecdc_imported_table_head.html' %} + </tfoot> + </table> + </div> diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_table_head.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_table_head.html new file mode 100644 index 0000000000000000000000000000000000000000..f7e19c4606a11c94aa2dc5242c633a07804bded6 --- /dev/null +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/imported/ecdc_imported_table_head.html @@ -0,0 +1,14 @@ + <tr> + <th scope="col">date reported</th> + <th scope="col">date rep year</th> + <th scope="col">date rep month</th> + <th scope="col">date rep day</th> + <th scope="col">cases weekly</th> + <th scope="col">deaths weekly</th> + <th scope="col">population data 2019</th> + <th scope="col">countries and territories</th> + <th scope="col">geo id</th> + <th scope="col">country territory code</th> + <th scope="col">continent</th> + <th scope="col">notification rate per 100000 population 14days</th> + </tr> diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/navigation/ecdc_navbar_dropdown.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/navigation/ecdc_navbar_dropdown.html index ddadab92d7e714d41f612008da3f113fb46d2a78..e72901f670e7010a4b171ffb9c680be08a019107 100644 --- a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/navigation/ecdc_navbar_dropdown.html +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/navigation/ecdc_navbar_dropdown.html @@ -35,7 +35,7 @@ <div class="dropdown-divider"></div> </li> <li> - <a class="dropdown-item" href="{{ url_for( 'ecdc.url_ecdc_data_imported') }}"> + <a class="dropdown-item" href="{{ url_for( 'ecdc.url_ecdc_imported') }}"> ECDC imported </a> </li> diff --git a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/navigation/ecdc_navtabs.html b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/navigation/ecdc_navtabs.html index 6d31235a5bc96137ac1b4ded252d85f86273ff2b..033ac94e0fc1b828cb64160fa45aa955868979bf 100644 --- a/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/navigation/ecdc_navtabs.html +++ b/src/flask_covid19/blueprints/data_ecdc/templates/ecdc/navigation/ecdc_navtabs.html @@ -13,9 +13,13 @@ </li> <li class="nav-item"> <a class="nav-link" - href="{{ url_for( 'ecdc.url_ecdc_data_imported') }}">ECDC imported</a> + href="{{ url_for( 'ecdc.url_ecdc_imported') }}">ECDC imported</a> </li> {% endif %} + <li class="nav-item"> + <a class="nav-link" + href="{{ url_for( 'ecdc.url_ecdc_flat') }}">ECDC flat</a> + </li> <li class="nav-item"> <a class="nav-link" href="{{ url_for( 'ecdc.url_ecdc_date_reported_all') }}">ECDC date_reported</a>