diff --git a/README.md b/README.md index ec518e2f4b1d3c3d08d7749715809b06b5354b00..beca4498565599217d182755026cd426db686465 100644 --- a/README.md +++ b/README.md @@ -193,19 +193,23 @@ class WhoGlobalDataImportTable(db.Model): ### 0.0.9 Release * Fixed #18 /europe/update: Download * Fixed #19 /europe/update: Import File to DB -* Issue #20 /europe/update: Update DB -* Issue #21 update_date_reported -* Issue #22 update_continent -* Issue #23 update_country -* Issue #24 update_data -* Issue #25 /who/update/initial update_data_initial -* Issue #26 /admin/database/dump -* Issue #27 /admin/database/drop -* Issue #28 /admin/database/import -* Issue #3 ORM: 3NF for ecdc_europa_data_import -* Issue #4 data update for 3NF ecdc_europa_data_import +* Fixed #20 /europe/update: Update DB +* Fixed #21 update_date_reported +* Fixed #22 update_continent +* Fixed #23 update_country +* Fixed #24 update_data +* Fixed #25 /who/update/initial update_data_initial +* Fixed #27 /admin/database/drop +* Fixed #3 ORM: 3NF for ecdc_europa_data_import +* Fixed #4 data update for 3NF ecdc_europa_data_import ### 0.0.10 Release +* Issue #26 /admin/database/dump +* Issue #28 /admin/database/import +* Issue #29 /who/info +* Issue #30 /europa/info +* Issue #31 /rki/info +* Issue #32 /nrw/info * Issue #5 Visual Graphs for Data per Countries order by Date diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000000000000000000000000000000000000..c7418817439b2f071c93a4a6cee831e996123c0b --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-slate \ No newline at end of file diff --git a/app.py b/app.py index 885252baf36bfa4267ac10078fdfec78dfc03fed..d4d9e3605eee33fe6ef0bafbe1833c5c84f747ae 100644 --- a/app.py +++ b/app.py @@ -14,6 +14,7 @@ from server_mq import europe_update_task drop_and_create_data_again = True + class ApplicationPage: def __init__(self, default_title, default_subtitle=None, default_subtitle_info=None): @@ -41,9 +42,11 @@ def url_root(): return redirect(url_for('home')) +################################################################################################################## # # WHO # +################################################################################################################## @app.route('/who/info') def url_who_info(): page_info = ApplicationPage('WHO', "Info") @@ -226,9 +229,11 @@ def url_update_data_countries(): return redirect(url_for('home')) +################################################################################################################## # # Europe # +################################################################################################################## @app.route('/europe/info') def url_europe_info(): page_info = ApplicationPage('Europe', "Info") @@ -266,9 +271,47 @@ def url_europe_data_imported(page=1): page_info=page_info) +################################################################################################################## +# +# RKI +# +################################################################################################################## +@app.route('/rki/info') +def url_rki_info(): + page_info = ApplicationPage('RKI', "Info") + return render_template( + 'rki/rki_info.html', + page_info=page_info) + + +@app.route('/rki/tasks') +def url_rki_tasks(): + page_info = ApplicationPage('RKI', "Tasks") + return render_template( + 'rki/rki_tasks.html', + page_info=page_info) + + +@app.route('/rki/imported/page/<int:page>') +@app.route('/rki/imported') +def url_rki_imported(page=1): + page_info = ApplicationPage('RKI', "Last Import") + try: + page_data = WhoGlobalDataImportTable.get_all_as_page(page) + except OperationalError: + flash("No data in the database.") + page_data = None + return render_template( + 'rki/rki_imported.html', + page_data=page_data, + page_info=page_info) + + +################################################################################################################## # # NRW # +################################################################################################################## @app.route('/nrw/info') def url_nrw_info(): page_info = ApplicationPage('NRW', "Info") @@ -313,6 +356,11 @@ def url_nrw_bochum(page=1): page_info=page_info) +################################################################################################################# +# +# Admin +# +################################################################################################################# @app.route('/test/alive_message') def url_alive_message_start(): app.logger.info("url_alive_message_start [start]") diff --git a/templates/europe/europe_info.html b/templates/europe/europe_info.html index 560522438f0c288e4164fc8f7c6ed9065d2a5fda..f3ccb4faf85e612b324774eba59c446d7254c677 100644 --- a/templates/europe/europe_info.html +++ b/templates/europe/europe_info.html @@ -17,6 +17,56 @@ {% block main_container %} + <div> + <h3>ECDC: COVID-19 pandemic</h3> + <h4>European Centre for Disease Prevention and Control</h4> + <h5>An agency of the European Union</h5> + <p> + <a href="https://www.ecdc.europa.eu/en/covid-19-pandemic"> + https://www.ecdc.europa.eu/en/covid-19-pandemic + </a> + </p> + </div> + <div> + <h3>ECDC: Weekly maps in support of the Council Recommendation</h3> + <p> + <a href="https://www.ecdc.europa.eu/en/covid-19/situation-updates/weekly-maps-coordinated-restriction-free-movement"> + Maps in support of the Council Recommendation on a coordinated approach to the restriction + of free movement in response to the COVID-19 pandemic in the EU/EEA</a> + </p> + <div> + <h3>ECDC: COVID-19 situation update for the EU/EEA, weekly</h3> + <p> + <a href="https://www.ecdc.europa.eu/en/cases-2019-ncov-eueea"> + COVID-19 situation update for the EU/EEA, weekly</a> + </p> + <div> + <h3>Situation updates on COVID-19</h3> + <p> + <a href="https://www.ecdc.europa.eu/en/cases-2019-ncov-eueea"> + Overview of all the data available on the COVID-19 pandemic.</a> + </p> + </div> + <div> + <h3>Download COVID-19 datasets</h3> + <p> + <a href="https://www.ecdc.europa.eu/en/covid-19/data"> + Download COVID-19 datasets</a> + </p> + <p class="fa-bold font-weight-bolder"> + ECDC switched to a weekly reporting schedule for the COVID-19 situation worldwide and in the EU/EEA + and the UK on 17 December 2020. Hence, all daily updates have been discontinued from 14 December. + ECDC will publish updates on the number of cases and deaths reported worldwide and aggregated + by week every Thursday. The weekly data will be available as downloadable files in the following formats: + XLSX, CSV, JSON and XML. + </p> + <p> + With the switch from daily to weekly reporting, ECDC will shift its Epidemic Intelligence (EI) resources + from case counting to signal/event detection and resume its regular EI activities, which will include + COVID-19 signal and event detection and analysis but also other potential threats. + </p> + </div> + {% endblock %} diff --git a/templates/fragment_navbar.html b/templates/fragment_navbar.html index e524fbdcfb8dc0589f57c0b9af1613fbcb029607..4eca36d4aecebeff42ce6678b429b05dae3e8d65 100644 --- a/templates/fragment_navbar.html +++ b/templates/fragment_navbar.html @@ -51,7 +51,21 @@ </div> </li> <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + RKI + </a> + <div class="dropdown-menu" aria-labelledby="navbarDropdown"> + <a class="dropdown-item" href="/rki/info">RKI</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="/rki/imported">RKI imported</a> + <div class="dropdown-divider"></div> + <a class="dropdown-item" href="/rki/tasks">RKI Tasks</a> + </div> + </li> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" + data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> NRW </a> <div class="dropdown-menu" aria-labelledby="navbarDropdown"> diff --git a/templates/fragment_navtabs.html b/templates/fragment_navtabs.html index 6cf91aabbaa8ed1ec5401738b84c3422819afb3c..534121c1e98b20fb8af9a2f71f7d77d13d95cc90 100644 --- a/templates/fragment_navtabs.html +++ b/templates/fragment_navtabs.html @@ -9,6 +9,9 @@ <li class="nav-item"> <a class="nav-link" href="/europe/info">Europe</a> </li> + <li class="nav-item"> + <a class="nav-link" href="/rki/info">RKI</a> + </li> <li class="nav-item"> <a class="nav-link" href="/nrw/info">NRW</a> </li> diff --git a/templates/fragment_navtabs_europe.html b/templates/fragment_navtabs_europe.html index 13abea813faa07609211eb2fceedcc75b5416825..ed73aaa8179fc7bf4bbe029fe209a3924c29646d 100644 --- a/templates/fragment_navtabs_europe.html +++ b/templates/fragment_navtabs_europe.html @@ -4,13 +4,13 @@ <a class="nav-link active" href="/home">Home</a> </li> <li class="nav-item"> - <a class="nav-link" href="/europe/tasks">WHO Info</a> + <a class="nav-link" href="/europe/info">Europe Info</a> </li> <li class="nav-item"> - <a class="nav-link" href="/europe/tasks">WHO tasks</a> + <a class="nav-link" href="/europe/tasks">Europe tasks</a> </li> <li class="nav-item"> - <a class="nav-link" href="/europe/imported">WHO imported</a> + <a class="nav-link" href="/europe/imported">Europe imported</a> </li> </ul> </nav> \ No newline at end of file diff --git a/templates/fragment_navtabs_nrw.html b/templates/fragment_navtabs_nrw.html index 253563968737278093f8b61cca3d4a5ba6f6ea7e..73c624ec1638602d95ccf5834a301a3e8be7f184 100644 --- a/templates/fragment_navtabs_nrw.html +++ b/templates/fragment_navtabs_nrw.html @@ -4,7 +4,7 @@ <a class="nav-link active" href="/home">Home</a> </li> <li class="nav-item"> - <a class="nav-link" href="/nrw/tasks">NRW Info</a> + <a class="nav-link" href="/nrw/info">NRW Info</a> </li> <li class="nav-item"> <a class="nav-link" href="/nrw/tasks">NRW tasks</a> diff --git a/templates/fragment_navtabs_rki.html b/templates/fragment_navtabs_rki.html new file mode 100644 index 0000000000000000000000000000000000000000..b9e5d7dcad6808480e1a40e23464b49b3123de3d --- /dev/null +++ b/templates/fragment_navtabs_rki.html @@ -0,0 +1,16 @@ + <nav> + <ul class="nav nav-tabs"> + <li class="nav-item"> + <a class="nav-link active" href="/home">Home</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="/rki/info">RKI Info</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="/rki/tasks">RKI tasks</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="/rki/imported">RKI imported</a> + </li> + </ul> + </nav> \ No newline at end of file diff --git a/templates/nrw/nrw_imported.html b/templates/nrw/nrw_imported.html index b46f9016aa7fdbb0fab66784ad62749f9932ed27..2563255826775df3ecbeed7aedcecfda7117c0f5 100644 --- a/templates/nrw/nrw_imported.html +++ b/templates/nrw/nrw_imported.html @@ -1,13 +1,9 @@ {% extends 'layout.html' %} +{% include 'fragment_pagination.html' %} + {% block navigation_breadcrumb %} - <nav aria-label="breadcrumb"> - <ol class="breadcrumb"> - <li class="breadcrumb-item"><a href="/">Home</a></li> - <li class="breadcrumb-item"><a href="/who/region/all">Regions</a></li> - <li class="breadcrumb-item active" aria-current="page">Countries</li> - </ol> - </nav> + {% endblock %} @@ -16,16 +12,77 @@ {% endblock %} - {% block main_container %} + {% 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('url_nrw_imported', 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('url_nrw_imported', 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('url_nrw_imported', page=page_data.next_num) }}">Next</a> + </li> + {% endif %} + </ul> + {% endif %} + + <table class="table table-hover table-striped"> + <thead> + <tr> + <th scope="col">date_reported</th> + <th scope="col">country_code</th> + <th scope="col">country</th> + <th scope="col">who_region</th> + <th scope="col">new_cases</th> + <th scope="col">cumulative_cases</th> + <th scope="col">new_deaths</th> + <th scope="col">cumulative_deaths</th> + </tr> + </thead> + <tbody> + {% for who_global_data_import in page_data.items %} + <tr> + <td>{{ who_global_data_import.date_reported }}</td> + <td>{{ who_global_data_import.country_code }}</td> + <td>{{ who_global_data_import.country }}</td> + <td>{{ who_global_data_import.who_region }}</td> + <td>{{ who_global_data_import.new_cases }}</td> + <td>{{ who_global_data_import.cumulative_cases }}</td> + <td>{{ who_global_data_import.new_deaths }}</td> + <td>{{ who_global_data_import.cumulative_deaths }}</td> + </tr> + {% endfor %} + </tbody> + </table> {% endblock %} {% block footer_container %} - <div> - {% for error in errors %} - <h4>{{ error }}</h4> - {% endfor %} - </div> -{% endblock %} \ No newline at end of file + +{% endblock %} + + + diff --git a/templates/rki/rki_imported.html b/templates/rki/rki_imported.html new file mode 100644 index 0000000000000000000000000000000000000000..975ef3b75527e2069e4c887f628de0e425f71c77 --- /dev/null +++ b/templates/rki/rki_imported.html @@ -0,0 +1,88 @@ +{% extends 'layout.html' %} + +{% include 'fragment_pagination.html' %} + +{% block navigation_breadcrumb %} + +{% endblock %} + + +{% block navigation_navtabs %} + {% include 'fragment_navtabs_rki.html' %} +{% endblock %} + + +{% block main_container %} + + {% 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('url_rki_imported', 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('url_rki_imported', 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('url_rki_imported', page=page_data.next_num) }}">Next</a> + </li> + {% endif %} + </ul> + {% endif %} + + <table class="table table-hover table-striped"> + <thead> + <tr> + <th scope="col">date_reported</th> + <th scope="col">country_code</th> + <th scope="col">country</th> + <th scope="col">who_region</th> + <th scope="col">new_cases</th> + <th scope="col">cumulative_cases</th> + <th scope="col">new_deaths</th> + <th scope="col">cumulative_deaths</th> + </tr> + </thead> + <tbody> + {% for who_global_data_import in page_data.items %} + <tr> + <td>{{ who_global_data_import.date_reported }}</td> + <td>{{ who_global_data_import.country_code }}</td> + <td>{{ who_global_data_import.country }}</td> + <td>{{ who_global_data_import.who_region }}</td> + <td>{{ who_global_data_import.new_cases }}</td> + <td>{{ who_global_data_import.cumulative_cases }}</td> + <td>{{ who_global_data_import.new_deaths }}</td> + <td>{{ who_global_data_import.cumulative_deaths }}</td> + </tr> + {% endfor %} + </tbody> + </table> +{% endblock %} + + +{% block footer_container %} + +{% endblock %} + + + diff --git a/templates/rki/rki_info.html b/templates/rki/rki_info.html new file mode 100644 index 0000000000000000000000000000000000000000..02bffeec114b8cf50c140c88c579e84dacbb384c --- /dev/null +++ b/templates/rki/rki_info.html @@ -0,0 +1,46 @@ +{% extends 'layout.html' %} + +{% block navigation_breadcrumb %} + +{% endblock %} + + +{% block navigation_navtabs %} + {% include 'fragment_navtabs_who.html' %} +{% endblock %} + + +{% block main_container %} + <div> + <h3>RKI Coronavirus Disease (COVID-19) Dashboard</h3> + <p> + <a href="https://experience.arcgis.com/experience/478220a4c454480e823b17327b2bf1d4/"> + https://experience.arcgis.com/experience/478220a4c454480e823b17327b2bf1d4 + </a> + </p> + </div> + <div> + <h3>RKI COVID-19</h3> + <p> + <a href="https://www.rki.de/EN/Content/infections/epidemiology/outbreaks/COVID-19/COVID19.html"> + https://www.rki.de/EN/Content/infections/epidemiology/outbreaks/COVID-19/COVID19.html + </a> + </p> + </div> + <div> + <h3>COVID-19 Dashboard by the Center for Systems Science and Engineering (CSSE) at Johns Hopkins University (JHU)</h3> + <p> + <a href="https://gisanddata.maps.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6"> + COVID-19 Dashboard by the Center for Systems Science and Engineering (CSSE) at Johns Hopkins University (JHU) + </a> + </p> + </div> +{% endblock %} + + +{% block footer_container %} + +{% endblock %} + + + diff --git a/templates/rki/rki_tasks.html b/templates/rki/rki_tasks.html new file mode 100644 index 0000000000000000000000000000000000000000..c15e97e09d3e45dbab5f65ff2e2c2169583caa18 --- /dev/null +++ b/templates/rki/rki_tasks.html @@ -0,0 +1,28 @@ +{% extends 'layout.html' %} + +{% block navigation_breadcrumb %} + +{% endblock %} + +{% block navigation_navtabs %} + {% include 'fragment_navtabs_who.html' %} +{% endblock %} + +{% block main_container %} + <div class="btn-group" role="group" aria-label="Views"> + <a class="btn btn-secondary btn-lg" href="/rki/region/all" role="button">RKI :: Region :: All</a> + </div> + <div class="btn-group" role="group" aria-label="Views"> + <a class="btn btn-primary btn-lg" href="/rki/update/initial" role="button">RKI :: update :: initial</a> + <a class="btn btn-secondary btn-lg" href="/rki/update/short" role="button">RKI :: update :: short</a> + </div> +{% endblock %} + + + +{% block footer_container %} + +{% endblock %} + + + diff --git a/templates/who/who_info.html b/templates/who/who_info.html index bd8cbe823dfab221553904a70deb3808e9b6fe2b..b5c8c41036dfef0af377d8740208c91e1f671adf 100644 --- a/templates/who/who_info.html +++ b/templates/who/who_info.html @@ -11,7 +11,20 @@ {% block main_container %} - + <div> + <h3>WHO Coronavirus Disease (COVID-19) Dashboard</h3> + <p> + <a href="https://covid19.who.int/">https://covid19.who.int</a> + </p> + </div> + <div> + <h3>WHO Coronavirus disease (COVID-19) pandemic</h3> + <p> + <a href="https://www.who.int/emergencies/diseases/novel-coronavirus-2019"> + https://www.who.int/emergencies/diseases/novel-coronavirus-2019 + </a> + </p> + </div> {% endblock %}