From f4a1ebdf1fd532dd81b15bbdc701c3d0c73a5bbe Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Sat, 30 Jan 2021 20:39:18 +0100 Subject: [PATCH] ### 0.0.13 Release * Fixed #49 EuropeServiceUpdate.__update_data_short() (wontfix) * Fixed #52 download vaccination timeline data file * Fixed #53 import vaccination timeline data file into db * Fixed #54 /vaccination/imported * Fixed #57 frontend: use npm for handling 3rdParty css and javascript modules like jQuery, Bootstrap * Fixed #58 frontend: remove jumbotron from all pageheader, put jumbotron as main content on home page * Fixed #47 major refactoring: Routes from app.py to org...who,europe,... (Doublette von #65) * Fixed #48 major refactoring: Tasks from server_mq.py to org...who,europe,... (Doublette von #65) * Fixed #64 major refactoring: create two packages: for web app and for celery worker * Issue #65 major refactoring: add flask-blueprints for admin, common, europe, rki, vaccination, who ### 0.0.14 Release * Issue #66 frontend: migrate to Bootstrap Theme sb-admin-angular * Issue #67 implement Flask-Login ### 0.0.15 Release * Issue #5 Visual Graphs for Data per Countries order by Date * Issue #59 frontend: add correct breadcrumb to every page * Issue #60 frontend: better design for tables * Issue #61 frontend: better design for navtabs * Issue #62 frontend: better design for pages * Issue #63 frontend: add footer design ### 0.0.16 Release * Issue #28 /admin/database/import * Issue #39 SQLalchemy instead of SQL: AllModelClasses.remove_all() * Issue #40 SQLalchemy instead of SQL: EuropeDataImportTable.get_date_rep() * Issue #41 SQLalchemy instead of SQL: EuropeDataImportTable.get_countries_of_continent() * Issue #42 SQLalchemy instead of SQL: WhoGlobalDataImportTable.get_new_dates_as_array() --- covid19/{oodm => blueprints}/__init__.py | 0 .../{oodm => blueprints}/admin/__init__.py | 0 .../admin/admin_service.py | 0 .../{oodm => blueprints}/admin/views_admin.py | 2 +- .../{oodm => blueprints}/common/__init__.py | 0 .../common/common_model.py | 0 .../common/common_model_transient.py | 0 .../common/common_service.py | 0 .../{oodm => blueprints}/europe/__init__.py | 0 .../europe/europe_model.py | 0 .../europe/europe_model_import.py | 0 .../europe/europe_service.py | 6 +- .../europe/europe_service_config.py | 0 .../europe/europe_service_download.py | 2 +- .../europe/europe_service_import.py | 4 +- .../europe/europe_service_update.py | 6 +- .../europe/views_europe.py | 61 ++++++------- covid19/{oodm => blueprints}/rki/__init__.py | 0 covid19/{oodm => blueprints}/rki/rki_model.py | 0 .../rki/rki_model_import.py | 0 .../{oodm => blueprints}/rki/rki_service.py | 6 +- .../rki/rki_service_download.py | 0 .../rki/rki_service_import.py | 2 +- .../rki/rki_service_update.py | 4 +- covid19/{oodm => blueprints}/rki/views_rki.py | 17 ++-- .../vaccination/__init__.py | 0 .../vaccination/vaccination_model.py | 0 .../vaccination/vaccination_model_import.py | 0 .../vaccination/vaccination_service.py | 6 +- .../vaccination/vaccination_service_config.py | 0 .../vaccination_service_download.py | 2 +- .../vaccination/vaccination_service_import.py | 4 +- .../vaccination/views_vaccination.py | 9 +- covid19/{oodm => blueprints}/who/__init__.py | 0 covid19/{oodm => blueprints}/who/views_who.py | 85 ++++++++++--------- covid19/{oodm => blueprints}/who/who_model.py | 0 .../who/who_model_import.py | 0 .../{oodm => blueprints}/who/who_service.py | 6 +- .../who/who_service_config.py | 0 .../who/who_service_download.py | 2 +- .../who/who_service_import.py | 4 +- .../who/who_service_update.py | 6 +- covid19/services.py | 12 +-- covid19/views.py | 12 +-- 44 files changed, 135 insertions(+), 123 deletions(-) rename covid19/{oodm => blueprints}/__init__.py (100%) rename covid19/{oodm => blueprints}/admin/__init__.py (100%) rename covid19/{oodm => blueprints}/admin/admin_service.py (100%) rename covid19/{oodm => blueprints}/admin/views_admin.py (98%) rename covid19/{oodm => blueprints}/common/__init__.py (100%) rename covid19/{oodm => blueprints}/common/common_model.py (100%) rename covid19/{oodm => blueprints}/common/common_model_transient.py (100%) rename covid19/{oodm => blueprints}/common/common_service.py (100%) rename covid19/{oodm => blueprints}/europe/__init__.py (100%) rename covid19/{oodm => blueprints}/europe/europe_model.py (100%) rename covid19/{oodm => blueprints}/europe/europe_model_import.py (100%) rename covid19/{oodm => blueprints}/europe/europe_service.py (88%) rename covid19/{oodm => blueprints}/europe/europe_service_config.py (100%) rename covid19/{oodm => blueprints}/europe/europe_service_download.py (96%) rename covid19/{oodm => blueprints}/europe/europe_service_import.py (94%) rename covid19/{oodm => blueprints}/europe/europe_service_update.py (96%) rename covid19/{oodm => blueprints}/europe/views_europe.py (74%) rename covid19/{oodm => blueprints}/rki/__init__.py (100%) rename covid19/{oodm => blueprints}/rki/rki_model.py (100%) rename covid19/{oodm => blueprints}/rki/rki_model_import.py (100%) rename covid19/{oodm => blueprints}/rki/rki_service.py (92%) rename covid19/{oodm => blueprints}/rki/rki_service_download.py (100%) rename covid19/{oodm => blueprints}/rki/rki_service_import.py (97%) rename covid19/{oodm => blueprints}/rki/rki_service_update.py (98%) rename covid19/{oodm => blueprints}/rki/views_rki.py (69%) rename covid19/{oodm => blueprints}/vaccination/__init__.py (100%) rename covid19/{oodm => blueprints}/vaccination/vaccination_model.py (100%) rename covid19/{oodm => blueprints}/vaccination/vaccination_model_import.py (100%) rename covid19/{oodm => blueprints}/vaccination/vaccination_service.py (83%) rename covid19/{oodm => blueprints}/vaccination/vaccination_service_config.py (100%) rename covid19/{oodm => blueprints}/vaccination/vaccination_service_download.py (96%) rename covid19/{oodm => blueprints}/vaccination/vaccination_service_import.py (95%) rename covid19/{oodm => blueprints}/vaccination/views_vaccination.py (86%) rename covid19/{oodm => blueprints}/who/__init__.py (100%) rename covid19/{oodm => blueprints}/who/views_who.py (83%) rename covid19/{oodm => blueprints}/who/who_model.py (100%) rename covid19/{oodm => blueprints}/who/who_model_import.py (100%) rename covid19/{oodm => blueprints}/who/who_service.py (92%) rename covid19/{oodm => blueprints}/who/who_service_config.py (100%) rename covid19/{oodm => blueprints}/who/who_service_download.py (97%) rename covid19/{oodm => blueprints}/who/who_service_import.py (95%) rename covid19/{oodm => blueprints}/who/who_service_update.py (97%) diff --git a/covid19/oodm/__init__.py b/covid19/blueprints/__init__.py similarity index 100% rename from covid19/oodm/__init__.py rename to covid19/blueprints/__init__.py diff --git a/covid19/oodm/admin/__init__.py b/covid19/blueprints/admin/__init__.py similarity index 100% rename from covid19/oodm/admin/__init__.py rename to covid19/blueprints/admin/__init__.py diff --git a/covid19/oodm/admin/admin_service.py b/covid19/blueprints/admin/admin_service.py similarity index 100% rename from covid19/oodm/admin/admin_service.py rename to covid19/blueprints/admin/admin_service.py diff --git a/covid19/oodm/admin/views_admin.py b/covid19/blueprints/admin/views_admin.py similarity index 98% rename from covid19/oodm/admin/views_admin.py rename to covid19/blueprints/admin/views_admin.py index 404575d1..c3c0636b 100644 --- a/covid19/oodm/admin/views_admin.py +++ b/covid19/blueprints/admin/views_admin.py @@ -6,7 +6,7 @@ from database import app from covid19.services import who_service, europe_service, vaccination_service, admin_service, rki_service from covid19.workers import celery -from covid19.oodm.common.common_model_transient import ApplicationPage +from covid19.blueprints.common.common_model_transient import ApplicationPage drop_and_create_data_again = True diff --git a/covid19/oodm/common/__init__.py b/covid19/blueprints/common/__init__.py similarity index 100% rename from covid19/oodm/common/__init__.py rename to covid19/blueprints/common/__init__.py diff --git a/covid19/oodm/common/common_model.py b/covid19/blueprints/common/common_model.py similarity index 100% rename from covid19/oodm/common/common_model.py rename to covid19/blueprints/common/common_model.py diff --git a/covid19/oodm/common/common_model_transient.py b/covid19/blueprints/common/common_model_transient.py similarity index 100% rename from covid19/oodm/common/common_model_transient.py rename to covid19/blueprints/common/common_model_transient.py diff --git a/covid19/oodm/common/common_service.py b/covid19/blueprints/common/common_service.py similarity index 100% rename from covid19/oodm/common/common_service.py rename to covid19/blueprints/common/common_service.py diff --git a/covid19/oodm/europe/__init__.py b/covid19/blueprints/europe/__init__.py similarity index 100% rename from covid19/oodm/europe/__init__.py rename to covid19/blueprints/europe/__init__.py diff --git a/covid19/oodm/europe/europe_model.py b/covid19/blueprints/europe/europe_model.py similarity index 100% rename from covid19/oodm/europe/europe_model.py rename to covid19/blueprints/europe/europe_model.py diff --git a/covid19/oodm/europe/europe_model_import.py b/covid19/blueprints/europe/europe_model_import.py similarity index 100% rename from covid19/oodm/europe/europe_model_import.py rename to covid19/blueprints/europe/europe_model_import.py diff --git a/covid19/oodm/europe/europe_service.py b/covid19/blueprints/europe/europe_service.py similarity index 88% rename from covid19/oodm/europe/europe_service.py rename to covid19/blueprints/europe/europe_service.py index 36a4f91b..f81e1fe0 100644 --- a/covid19/oodm/europe/europe_service.py +++ b/covid19/blueprints/europe/europe_service.py @@ -1,7 +1,7 @@ from database import app -from covid19.oodm.europe.europe_service_download import EuropeServiceDownload -from covid19.oodm.europe.europe_service_import import EuropeServiceImport -from covid19.oodm.europe.europe_service_update import EuropeServiceUpdate +from covid19.blueprints.europe.europe_service_download import EuropeServiceDownload +from covid19.blueprints.europe.europe_service_import import EuropeServiceImport +from covid19.blueprints.europe.europe_service_update import EuropeServiceUpdate class EuropeService: diff --git a/covid19/oodm/europe/europe_service_config.py b/covid19/blueprints/europe/europe_service_config.py similarity index 100% rename from covid19/oodm/europe/europe_service_config.py rename to covid19/blueprints/europe/europe_service_config.py diff --git a/covid19/oodm/europe/europe_service_download.py b/covid19/blueprints/europe/europe_service_download.py similarity index 96% rename from covid19/oodm/europe/europe_service_download.py rename to covid19/blueprints/europe/europe_service_download.py index d6144347..57f91f58 100644 --- a/covid19/oodm/europe/europe_service_download.py +++ b/covid19/blueprints/europe/europe_service_download.py @@ -2,7 +2,7 @@ import os import wget from flask import flash from database import app -from covid19.oodm.europe.europe_service_config import EuropeServiceDownloadConfig +from covid19.blueprints.europe.europe_service_config import EuropeServiceDownloadConfig class EuropeServiceDownload: diff --git a/covid19/oodm/europe/europe_service_import.py b/covid19/blueprints/europe/europe_service_import.py similarity index 94% rename from covid19/oodm/europe/europe_service_import.py rename to covid19/blueprints/europe/europe_service_import.py index bbc41fe2..85b85224 100644 --- a/covid19/oodm/europe/europe_service_import.py +++ b/covid19/blueprints/europe/europe_service_import.py @@ -3,8 +3,8 @@ import csv import psycopg2 from database import db, app -from covid19.oodm.europe.europe_model_import import EuropeDataImportTable -from covid19.oodm.europe.europe_service_config import EuropeServiceDownloadConfig +from covid19.blueprints.europe.europe_model_import import EuropeDataImportTable +from covid19.blueprints.europe.europe_service_config import EuropeServiceDownloadConfig class EuropeServiceImport: diff --git a/covid19/oodm/europe/europe_service_update.py b/covid19/blueprints/europe/europe_service_update.py similarity index 96% rename from covid19/oodm/europe/europe_service_update.py rename to covid19/blueprints/europe/europe_service_update.py index 5fa70eb6..c3da65cb 100644 --- a/covid19/oodm/europe/europe_service_update.py +++ b/covid19/blueprints/europe/europe_service_update.py @@ -1,7 +1,7 @@ from database import db, app -from covid19.oodm.europe.europe_service_config import EuropeServiceDownloadConfig -from covid19.oodm.europe.europe_model_import import EuropeDataImportTable -from covid19.oodm.europe.europe_model import EuropeDateReported, EuropeContinent, EuropeCountry, EuropeData +from covid19.blueprints.europe.europe_service_config import EuropeServiceDownloadConfig +from covid19.blueprints.europe.europe_model_import import EuropeDataImportTable +from covid19.blueprints.europe.europe_model import EuropeDateReported, EuropeContinent, EuropeCountry, EuropeData class EuropeServiceUpdate: diff --git a/covid19/oodm/europe/views_europe.py b/covid19/blueprints/europe/views_europe.py similarity index 74% rename from covid19/oodm/europe/views_europe.py rename to covid19/blueprints/europe/views_europe.py index bf14483f..47b9399d 100644 --- a/covid19/oodm/europe/views_europe.py +++ b/covid19/blueprints/europe/views_europe.py @@ -1,4 +1,4 @@ -from flask import render_template, redirect, url_for, flash +from flask import render_template, redirect, url_for, flash, Blueprint from celery import states from celery.utils.log import get_task_logger @@ -6,9 +6,12 @@ from database import app from covid19.services import europe_service from covid19.workers import celery -from covid19.oodm.europe.europe_model_import import EuropeDataImportTable -from covid19.oodm.europe.europe_model import EuropeDateReported, EuropeContinent, EuropeCountry, EuropeData -from covid19.oodm.common.common_model_transient import ApplicationPage +from covid19.blueprints.europe.europe_model_import import EuropeDataImportTable +from covid19.blueprints.europe.europe_model import EuropeDateReported, EuropeContinent, EuropeCountry, EuropeData +from covid19.blueprints.common.common_model_transient import ApplicationPage + + +app_europe = Blueprint('europe', __name__, template_folder='templates', static_folder='static') ################################################################################################################## @@ -44,7 +47,7 @@ def task_europe_update_short(self): return result -@app.route('/europe/info') +@app_europe.route('/europe/info') def url_europe_info(): page_info = ApplicationPage('Europe', "Info") return render_template( @@ -53,7 +56,7 @@ def url_europe_info(): page_info=page_info) -@app.route('/europe/tasks') +@app_europe.route('/europe/tasks') def url_europe_tasks(): page_info = ApplicationPage('Europe', "Tasks") return render_template( @@ -62,7 +65,7 @@ def url_europe_tasks(): page_info=page_info) -@app.route('/europe/update/initial') +@app_europe.route('/europe/update/initial') def europe_update_data(): europe_service.download() task_europe_update_initial.apply_async() @@ -70,8 +73,8 @@ def europe_update_data(): return redirect(url_for('url_home')) -@app.route('/europe/imported/page/<int:page>') -@app.route('/europe/imported') +@app_europe.route('/europe/imported/page/<int:page>') +@app_europe.route('/europe/imported') def url_europe_data_imported(page=1): page_info = ApplicationPage('Europe', "Last Import") page_data = EuropeDataImportTable.get_all_as_page(page) @@ -81,8 +84,8 @@ def url_europe_data_imported(page=1): page_info=page_info) -@app.route('/europe/date_reported/all/page/<int:page>') -@app.route('/europe/date_reported/all') +@app_europe.route('/europe/date_reported/all/page/<int:page>') +@app_europe.route('/europe/date_reported/all') def url_europe_date_reported_all(page=1): page_info = ApplicationPage('Europe', "date_reported") page_data = EuropeDateReported.get_all_as_page(page) @@ -92,10 +95,10 @@ def url_europe_date_reported_all(page=1): page_info=page_info) -@app.route('/europe/date_reported/<int:europe_date_reported_id>/page/<int:page>') -@app.route('/europe/date_reported/<int:europe_date_reported_id>') -@app.route('/europe/date_reported/notification_rate/<int:europe_date_reported_id>/page/<int:page>') -@app.route('/europe/date_reported/notification_rate/<int:europe_date_reported_id>') +@app_europe.route('/europe/date_reported/<int:europe_date_reported_id>/page/<int:page>') +@app_europe.route('/europe/date_reported/<int:europe_date_reported_id>') +@app_europe.route('/europe/date_reported/notification_rate/<int:europe_date_reported_id>/page/<int:page>') +@app_europe.route('/europe/date_reported/notification_rate/<int:europe_date_reported_id>') def url_europe_date_reported_one_notification_rate(europe_date_reported_id, page=1): page_info = ApplicationPage('Europe', "date_reported") europe_date_reported = EuropeDateReported.get_by_id(europe_date_reported_id) @@ -107,8 +110,8 @@ def url_europe_date_reported_one_notification_rate(europe_date_reported_id, page page_info=page_info) -@app.route('/europe/date_reported/deaths_weekly/<int:europe_date_reported_id>/page/<int:page>') -@app.route('/europe/date_reported/deaths_weekly/<int:europe_date_reported_id>') +@app_europe.route('/europe/date_reported/deaths_weekly/<int:europe_date_reported_id>/page/<int:page>') +@app_europe.route('/europe/date_reported/deaths_weekly/<int:europe_date_reported_id>') def url_europe_date_reported_one_deaths_weekly(europe_date_reported_id, page=1): page_info = ApplicationPage('Europe', "date_reported") europe_date_reported = EuropeDateReported.get_by_id(europe_date_reported_id) @@ -120,8 +123,8 @@ def url_europe_date_reported_one_deaths_weekly(europe_date_reported_id, page=1): page_info=page_info) -@app.route('/europe/date_reported/cases_weekly/<int:europe_date_reported_id>/page/<int:page>') -@app.route('/europe/date_reported/cases_weekly/<int:europe_date_reported_id>') +@app_europe.route('/europe/date_reported/cases_weekly/<int:europe_date_reported_id>/page/<int:page>') +@app_europe.route('/europe/date_reported/cases_weekly/<int:europe_date_reported_id>') def url_europe_date_reported_one_cases_weekly(europe_date_reported_id, page=1): page_info = ApplicationPage('Europe', "date_reported") europe_date_reported = EuropeDateReported.get_by_id(europe_date_reported_id) @@ -133,8 +136,8 @@ def url_europe_date_reported_one_cases_weekly(europe_date_reported_id, page=1): page_info=page_info) -@app.route('/europe/continent/all/page/<int:page>') -@app.route('/europe/continent/all') +@app_europe.route('/europe/continent/all/page/<int:page>') +@app_europe.route('/europe/continent/all') def url_europe_continent_all(page=1): page_info = ApplicationPage('Europe', "continent") page_data = EuropeContinent.get_all_as_page(page) @@ -144,8 +147,8 @@ def url_europe_continent_all(page=1): page_info=page_info) -@app.route('/europe/continent/<int:continent_id>/page/<int:page>') -@app.route('/europe/continent/<int:continent_id>') +@app_europe.route('/europe/continent/<int:continent_id>/page/<int:page>') +@app_europe.route('/europe/continent/<int:continent_id>') def url_europe_continent_one(continent_id, page=1): page_info = ApplicationPage('Europe', "continent") continent = EuropeContinent.get_by_id(continent_id) @@ -157,8 +160,8 @@ def url_europe_continent_one(continent_id, page=1): page_info=page_info) -@app.route('/europe/country/all/page/<int:page>') -@app.route('/europe/country/all') +@app_europe.route('/europe/country/all/page/<int:page>') +@app_europe.route('/europe/country/all') def url_europe_country_all(page=1): page_info = ApplicationPage('Europe', "country") page_data = EuropeCountry.get_all_as_page(page) @@ -168,8 +171,8 @@ def url_europe_country_all(page=1): page_info=page_info) -@app.route('/europe/country/<int:country_id>/page/<int:page>') -@app.route('/europe/country/<int:country_id>') +@app_europe.route('/europe/country/<int:country_id>/page/<int:page>') +@app_europe.route('/europe/country/<int:country_id>') def url_europe_country_one(country_id, page=1): page_info = ApplicationPage('Europe', "country") europe_country = EuropeCountry.get_by_id(country_id) @@ -181,8 +184,8 @@ def url_europe_country_one(country_id, page=1): page_info=page_info) -@app.route('/europe/country/germany/page/<int:page>') -@app.route('/europe/country/germany') +@app_europe.route('/europe/country/germany/page/<int:page>') +@app_europe.route('/europe/country/germany') def url_europe_country_germany(page=1): page_info = ApplicationPage('Europe', "country: Germany") europe_country = EuropeCountry.get_germany() diff --git a/covid19/oodm/rki/__init__.py b/covid19/blueprints/rki/__init__.py similarity index 100% rename from covid19/oodm/rki/__init__.py rename to covid19/blueprints/rki/__init__.py diff --git a/covid19/oodm/rki/rki_model.py b/covid19/blueprints/rki/rki_model.py similarity index 100% rename from covid19/oodm/rki/rki_model.py rename to covid19/blueprints/rki/rki_model.py diff --git a/covid19/oodm/rki/rki_model_import.py b/covid19/blueprints/rki/rki_model_import.py similarity index 100% rename from covid19/oodm/rki/rki_model_import.py rename to covid19/blueprints/rki/rki_model_import.py diff --git a/covid19/oodm/rki/rki_service.py b/covid19/blueprints/rki/rki_service.py similarity index 92% rename from covid19/oodm/rki/rki_service.py rename to covid19/blueprints/rki/rki_service.py index f8934da7..3ed8bd55 100644 --- a/covid19/oodm/rki/rki_service.py +++ b/covid19/blueprints/rki/rki_service.py @@ -1,8 +1,8 @@ from database import app -from covid19.oodm.rki.rki_service_download import RkiServiceDownload -from covid19.oodm.rki.rki_service_import import RkiServiceImport -from covid19.oodm.rki.rki_service_update import RkiServiceUpdate +from covid19.blueprints.rki.rki_service_download import RkiServiceDownload +from covid19.blueprints.rki.rki_service_import import RkiServiceImport +from covid19.blueprints.rki.rki_service_update import RkiServiceUpdate class RkiService: diff --git a/covid19/oodm/rki/rki_service_download.py b/covid19/blueprints/rki/rki_service_download.py similarity index 100% rename from covid19/oodm/rki/rki_service_download.py rename to covid19/blueprints/rki/rki_service_download.py diff --git a/covid19/oodm/rki/rki_service_import.py b/covid19/blueprints/rki/rki_service_import.py similarity index 97% rename from covid19/oodm/rki/rki_service_import.py rename to covid19/blueprints/rki/rki_service_import.py index e5f8a164..e7151fa3 100644 --- a/covid19/oodm/rki/rki_service_import.py +++ b/covid19/blueprints/rki/rki_service_import.py @@ -5,7 +5,7 @@ import psycopg2 from database import db, app -from covid19.oodm.who.who_model_import import WhoGlobalDataImportTable +from covid19.blueprints.who.who_model_import import WhoGlobalDataImportTable class RkiServiceImport: diff --git a/covid19/oodm/rki/rki_service_update.py b/covid19/blueprints/rki/rki_service_update.py similarity index 98% rename from covid19/oodm/rki/rki_service_update.py rename to covid19/blueprints/rki/rki_service_update.py index cacd89ce..a013049f 100644 --- a/covid19/oodm/rki/rki_service_update.py +++ b/covid19/blueprints/rki/rki_service_update.py @@ -1,7 +1,7 @@ from database import db, app -from covid19.oodm.rki.rki_model import RkiRegion, RkiDateReported, RkiCountry, RkiGermanyData -from covid19.oodm.rki.rki_model import RkiGermanyDataImportTable +from covid19.blueprints.rki.rki_model import RkiRegion, RkiDateReported, RkiCountry, RkiGermanyData +from covid19.blueprints.rki.rki_model import RkiGermanyDataImportTable rki_service_update = None diff --git a/covid19/oodm/rki/views_rki.py b/covid19/blueprints/rki/views_rki.py similarity index 69% rename from covid19/oodm/rki/views_rki.py rename to covid19/blueprints/rki/views_rki.py index 2355250c..8d1bc2b7 100644 --- a/covid19/oodm/rki/views_rki.py +++ b/covid19/blueprints/rki/views_rki.py @@ -1,20 +1,23 @@ -from flask import render_template, redirect, url_for, flash +from flask import render_template, redirect, url_for, flash, Blueprint from sqlalchemy.exc import OperationalError from database import app -from covid19.oodm.who.who_model_import import WhoGlobalDataImportTable -from covid19.oodm.common.common_model_transient import ApplicationPage +from covid19.blueprints.who.who_model_import import WhoGlobalDataImportTable +from covid19.blueprints.common.common_model_transient import ApplicationPage drop_and_create_data_again = True +app_rki = Blueprint('rki', __name__, template_folder='templates', static_folder='static') + + ################################################################################################################## # # RKI # ################################################################################################################## -@app.route('/rki/info') +@app_rki.route('/rki/info') def url_rki_info(): page_info = ApplicationPage('RKI', "Info") return render_template( @@ -22,7 +25,7 @@ def url_rki_info(): page_info=page_info) -@app.route('/rki/tasks') +@app_rki.route('/rki/tasks') def url_rki_tasks(): page_info = ApplicationPage('RKI', "Tasks") return render_template( @@ -30,8 +33,8 @@ def url_rki_tasks(): page_info=page_info) -@app.route('/rki/imported/page/<int:page>') -@app.route('/rki/imported') +@app_rki.route('/rki/imported/page/<int:page>') +@app_rki.route('/rki/imported') def url_rki_imported(page=1): page_info = ApplicationPage('RKI', "Last Import") try: diff --git a/covid19/oodm/vaccination/__init__.py b/covid19/blueprints/vaccination/__init__.py similarity index 100% rename from covid19/oodm/vaccination/__init__.py rename to covid19/blueprints/vaccination/__init__.py diff --git a/covid19/oodm/vaccination/vaccination_model.py b/covid19/blueprints/vaccination/vaccination_model.py similarity index 100% rename from covid19/oodm/vaccination/vaccination_model.py rename to covid19/blueprints/vaccination/vaccination_model.py diff --git a/covid19/oodm/vaccination/vaccination_model_import.py b/covid19/blueprints/vaccination/vaccination_model_import.py similarity index 100% rename from covid19/oodm/vaccination/vaccination_model_import.py rename to covid19/blueprints/vaccination/vaccination_model_import.py diff --git a/covid19/oodm/vaccination/vaccination_service.py b/covid19/blueprints/vaccination/vaccination_service.py similarity index 83% rename from covid19/oodm/vaccination/vaccination_service.py rename to covid19/blueprints/vaccination/vaccination_service.py index 90e09006..e80820a5 100644 --- a/covid19/oodm/vaccination/vaccination_service.py +++ b/covid19/blueprints/vaccination/vaccination_service.py @@ -1,7 +1,7 @@ from database import app -from covid19.oodm.vaccination.vaccination_service_download import VaccinationServiceDownload -from covid19.oodm.vaccination.vaccination_service_import import VaccinationServiceImport -from covid19.oodm.vaccination.vaccination_service_config import VaccinationServiceDownloadConfig +from covid19.blueprints.vaccination.vaccination_service_download import VaccinationServiceDownload +from covid19.blueprints.vaccination.vaccination_service_import import VaccinationServiceImport +from covid19.blueprints.vaccination.vaccination_service_config import VaccinationServiceDownloadConfig class VaccinationService: diff --git a/covid19/oodm/vaccination/vaccination_service_config.py b/covid19/blueprints/vaccination/vaccination_service_config.py similarity index 100% rename from covid19/oodm/vaccination/vaccination_service_config.py rename to covid19/blueprints/vaccination/vaccination_service_config.py diff --git a/covid19/oodm/vaccination/vaccination_service_download.py b/covid19/blueprints/vaccination/vaccination_service_download.py similarity index 96% rename from covid19/oodm/vaccination/vaccination_service_download.py rename to covid19/blueprints/vaccination/vaccination_service_download.py index fd43e8f0..33b9856c 100644 --- a/covid19/oodm/vaccination/vaccination_service_download.py +++ b/covid19/blueprints/vaccination/vaccination_service_download.py @@ -2,7 +2,7 @@ import os import wget from flask import flash from database import app -from covid19.oodm.vaccination.vaccination_service_config import VaccinationServiceDownloadConfig +from covid19.blueprints.vaccination.vaccination_service_config import VaccinationServiceDownloadConfig class VaccinationServiceDownload: diff --git a/covid19/oodm/vaccination/vaccination_service_import.py b/covid19/blueprints/vaccination/vaccination_service_import.py similarity index 95% rename from covid19/oodm/vaccination/vaccination_service_import.py rename to covid19/blueprints/vaccination/vaccination_service_import.py index c0ecb49c..db605158 100644 --- a/covid19/oodm/vaccination/vaccination_service_import.py +++ b/covid19/blueprints/vaccination/vaccination_service_import.py @@ -3,8 +3,8 @@ import csv import psycopg2 from database import db, app -from covid19.oodm.vaccination.vaccination_model_import import VaccinationGermanyTimeline -from covid19.oodm.vaccination.vaccination_service_config import VaccinationServiceDownloadConfig +from covid19.blueprints.vaccination.vaccination_model_import import VaccinationGermanyTimeline +from covid19.blueprints.vaccination.vaccination_service_config import VaccinationServiceDownloadConfig class VaccinationServiceImport: diff --git a/covid19/oodm/vaccination/views_vaccination.py b/covid19/blueprints/vaccination/views_vaccination.py similarity index 86% rename from covid19/oodm/vaccination/views_vaccination.py rename to covid19/blueprints/vaccination/views_vaccination.py index f7000ca9..1ae14d77 100644 --- a/covid19/oodm/vaccination/views_vaccination.py +++ b/covid19/blueprints/vaccination/views_vaccination.py @@ -1,4 +1,4 @@ -from flask import render_template, redirect, url_for, flash +from flask import render_template, redirect, url_for, flash, Blueprint from celery import states from celery.utils.log import get_task_logger @@ -6,8 +6,11 @@ from database import app from covid19.services import vaccination_service from covid19.workers import celery -from covid19.oodm.vaccination.vaccination_model_import import VaccinationGermanyTimeline -from covid19.oodm.common.common_model_transient import ApplicationPage +from covid19.blueprints.vaccination.vaccination_model_import import VaccinationGermanyTimeline +from covid19.blueprints.common.common_model_transient import ApplicationPage + + +app_vaccination = Blueprint('vaccination', __name__, template_folder='templates', static_folder='static') ################################################################################################################## diff --git a/covid19/oodm/who/__init__.py b/covid19/blueprints/who/__init__.py similarity index 100% rename from covid19/oodm/who/__init__.py rename to covid19/blueprints/who/__init__.py diff --git a/covid19/oodm/who/views_who.py b/covid19/blueprints/who/views_who.py similarity index 83% rename from covid19/oodm/who/views_who.py rename to covid19/blueprints/who/views_who.py index 3c2f1139..bf81a8c4 100644 --- a/covid19/oodm/who/views_who.py +++ b/covid19/blueprints/who/views_who.py @@ -1,4 +1,4 @@ -from flask import render_template, redirect, url_for, flash +from flask import render_template, redirect, url_for, flash, Blueprint from sqlalchemy.exc import OperationalError from celery import states from celery.utils.log import get_task_logger @@ -7,9 +7,12 @@ from database import app from covid19.services import who_service from covid19.workers import celery -from covid19.oodm.who.who_model_import import WhoGlobalDataImportTable -from covid19.oodm.who.who_model import WhoRegion, WhoCountry, WhoDateReported, WhoGlobalData -from covid19.oodm.common.common_model_transient import ApplicationPage +from covid19.blueprints.who.who_model_import import WhoGlobalDataImportTable +from covid19.blueprints.who.who_model import WhoRegion, WhoCountry, WhoDateReported, WhoGlobalData +from covid19.blueprints.common.common_model_transient import ApplicationPage + + +app_who = Blueprint('who', __name__, template_folder='templates', static_folder='static') ################################################################################################################## @@ -58,7 +61,7 @@ def task_who_update_initial(self): return result -@app.route('/who/info') +@app_who.route('/who/info') def url_who_info(): page_info = ApplicationPage('WHO', "Info") return render_template( @@ -66,7 +69,7 @@ def url_who_info(): page_info=page_info) -@app.route('/who/tasks') +@app_who.route('/who/tasks') def url_who_tasks(): page_info = ApplicationPage('WHO', "Tasks") return render_template( @@ -74,8 +77,8 @@ def url_who_tasks(): page_info=page_info) -@app.route('/who/imported/page/<int:page>') -@app.route('/who/imported') +@app_who.route('/who/imported/page/<int:page>') +@app_who.route('/who/imported') def url_who_imported(page=1): page_info = ApplicationPage('WHO', "Last Import") try: @@ -89,8 +92,8 @@ def url_who_imported(page=1): page_info=page_info) -@app.route('/who/date_reported/all/page/<int:page>') -@app.route('/who/date_reported/all') +@app_who.route('/who/date_reported/all/page/<int:page>') +@app_who.route('/who/date_reported/all') def url_who_date_reported_all(page=1): page_info = ApplicationPage('WHO', "Date Reported", "All") try: @@ -104,8 +107,8 @@ def url_who_date_reported_all(page=1): page_info=page_info) -@app.route('/who/date_reported/<int:date_reported_id>/page/<int:page>') -@app.route('/who/date_reported/<int:date_reported_id>') +@app_who.route('/who/date_reported/<int:date_reported_id>/page/<int:page>') +@app_who.route('/who/date_reported/<int:date_reported_id>') def url_who_date_reported(date_reported_id, page=1): date_reported = WhoDateReported.get_by_id(date_reported_id) page_info = ApplicationPage( @@ -125,8 +128,8 @@ def url_who_date_reported(date_reported_id, page=1): page_info=page_info) -@app.route('/who/date_reported/<int:date_reported_id>/cases_new/page/<int:page>') -@app.route('/who/date_reported/<int:date_reported_id>/cases_new') +@app_who.route('/who/date_reported/<int:date_reported_id>/cases_new/page/<int:page>') +@app_who.route('/who/date_reported/<int:date_reported_id>/cases_new') def url_who_date_reported_cases_new(date_reported_id, page=1): date_reported = WhoDateReported.get_by_id(date_reported_id) page_info = ApplicationPage( @@ -146,8 +149,8 @@ def url_who_date_reported_cases_new(date_reported_id, page=1): page_info=page_info) -@app.route('/who/date_reported/<int:date_reported_id>/cases_cumulative/page/<int:page>') -@app.route('/who/date_reported/<int:date_reported_id>/cases_cumulative') +@app_who.route('/who/date_reported/<int:date_reported_id>/cases_cumulative/page/<int:page>') +@app_who.route('/who/date_reported/<int:date_reported_id>/cases_cumulative') def url_who_date_reported_cases_cumulative(date_reported_id, page=1): date_reported = WhoDateReported.get_by_id(date_reported_id) page_info = ApplicationPage( @@ -167,8 +170,8 @@ def url_who_date_reported_cases_cumulative(date_reported_id, page=1): page_info=page_info) -@app.route('/who/date_reported/<int:date_reported_id>/deaths_new/page/<int:page>') -@app.route('/who/date_reported/<int:date_reported_id>/deaths_new') +@app_who.route('/who/date_reported/<int:date_reported_id>/deaths_new/page/<int:page>') +@app_who.route('/who/date_reported/<int:date_reported_id>/deaths_new') def url_who_date_reported_deaths_new(date_reported_id, page=1): date_reported = WhoDateReported.get_by_id(date_reported_id) page_info = ApplicationPage( @@ -188,8 +191,8 @@ def url_who_date_reported_deaths_new(date_reported_id, page=1): page_info=page_info) -@app.route('/who/date_reported/<int:date_reported_id>/deaths_cumulative/page/<int:page>') -@app.route('/who/date_reported/<int:date_reported_id>/deaths_cumulative') +@app_who.route('/who/date_reported/<int:date_reported_id>/deaths_cumulative/page/<int:page>') +@app_who.route('/who/date_reported/<int:date_reported_id>/deaths_cumulative') def url_who_date_reported_deaths_cumulative(date_reported_id, page=1): date_reported = WhoDateReported.get_by_id(date_reported_id) page_info = ApplicationPage( @@ -209,8 +212,8 @@ def url_who_date_reported_deaths_cumulative(date_reported_id, page=1): page_info=page_info) -@app.route('/who/region/all/page/<int:page>') -@app.route('/who/region/all') +@app_who.route('/who/region/all/page/<int:page>') +@app_who.route('/who/region/all') def url_who_region_all(page=1): page_info = ApplicationPage('WHO', "Region", "All") try: @@ -224,8 +227,8 @@ def url_who_region_all(page=1): page_info=page_info) -@app.route('/who/region/<int:region_id>/page/<int:page>') -@app.route('/who/region/<int:region_id>') +@app_who.route('/who/region/<int:region_id>/page/<int:page>') +@app_who.route('/who/region/<int:region_id>') def url_who_region(region_id, page=1): who_region = None page_info = ApplicationPage("Countries", "WHO Region") @@ -245,8 +248,8 @@ def url_who_region(region_id, page=1): page_info=page_info) -@app.route('/who/country/all/page/<int:page>') -@app.route('/who/country/all') +@app_who.route('/who/country/all/page/<int:page>') +@app_who.route('/who/country/all') def url_who_country_all(page=1): page_info = ApplicationPage('WHO', "Countries", "All") try: @@ -260,8 +263,8 @@ def url_who_country_all(page=1): page_info=page_info) -@app.route('/who/country/<int:country_id>/page/<int:page>') -@app.route('/who/country/<int:country_id>') +@app_who.route('/who/country/<int:country_id>/page/<int:page>') +@app_who.route('/who/country/<int:country_id>') def url_who_country(country_id, page=1): who_country = WhoCountry.get_by_id(country_id) page_data = WhoGlobalData.get_data_for_country(who_country, page) @@ -275,8 +278,8 @@ def url_who_country(country_id, page=1): page_info=page_info) -@app.route('/who/country/<int:country_id>/cases_new/page/<int:page>') -@app.route('/who/country/<int:country_id>/cases_new') +@app_who.route('/who/country/<int:country_id>/cases_new/page/<int:page>') +@app_who.route('/who/country/<int:country_id>/cases_new') def url_who_country_cases_new(country_id, page=1): who_country = WhoCountry.get_by_id(country_id) page_data = WhoGlobalData.get_data_for_country_order_by_cases_new(who_country, page) @@ -290,8 +293,8 @@ def url_who_country_cases_new(country_id, page=1): page_info=page_info) -@app.route('/who/country/<int:country_id>/cases_cumulative/page/<int:page>') -@app.route('/who/country/<int:country_id>/cases_cumulative') +@app_who.route('/who/country/<int:country_id>/cases_cumulative/page/<int:page>') +@app_who.route('/who/country/<int:country_id>/cases_cumulative') def url_who_country_cases_cumulative(country_id, page=1): who_country = WhoCountry.get_by_id(country_id) page_data = WhoGlobalData.get_data_for_country_order_by_cases_cumulative(who_country, page) @@ -305,8 +308,8 @@ def url_who_country_cases_cumulative(country_id, page=1): page_info=page_info) -@app.route('/who/country/<int:country_id>/deaths_new/page/<int:page>') -@app.route('/who/country/<int:country_id>/deaths_new') +@app_who.route('/who/country/<int:country_id>/deaths_new/page/<int:page>') +@app_who.route('/who/country/<int:country_id>/deaths_new') def url_who_country_deaths_new(country_id, page=1): who_country = WhoCountry.get_by_id(country_id) page_data = WhoGlobalData.get_data_for_country_order_by_deaths_new(who_country, page) @@ -320,8 +323,8 @@ def url_who_country_deaths_new(country_id, page=1): page_info=page_info) -@app.route('/who/country/<int:country_id>/deaths_cumulative/page/<int:page>') -@app.route('/who/country/<int:country_id>/deaths_cumulative') +@app_who.route('/who/country/<int:country_id>/deaths_cumulative/page/<int:page>') +@app_who.route('/who/country/<int:country_id>/deaths_cumulative') def url_who_country_deaths_cumulative(country_id, page=1): who_country = WhoCountry.get_by_id(country_id) page_data = WhoGlobalData.get_data_for_country_order_by_deaths_cumulative(who_country, page) @@ -335,8 +338,8 @@ def url_who_country_deaths_cumulative(country_id, page=1): page_info=page_info) -@app.route('/who/germany/page/<int:page>') -@app.route('/who/germany') +@app_who.route('/who/germany/page/<int:page>') +@app_who.route('/who/germany') def url_who_germany(page=1): page_info = ApplicationPage('WHO', "Germany") who_country_germany = WhoCountry.get_germany() @@ -351,7 +354,7 @@ def url_who_germany(page=1): page_info=page_info) -@app.route('/who/update') +@app_who.route('/who/update') def url_who_update_run(): app.logger.info("url_who_update_run [start]") who_service.who_service_download.download_file() @@ -362,7 +365,7 @@ def url_who_update_run(): return redirect(url_for('url_home')) -@app.route('/who/update/short') +@app_who.route('/who/update/short') def url_who_update_short_run(): who_service.who_service_download.download_file() task_who_update_short.apply_async() @@ -371,7 +374,7 @@ def url_who_update_short_run(): return redirect(url_for('url_home')) -@app.route('/who/update/initial') +@app_who.route('/who/update/initial') def url_who_update_initial_run(): who_service.who_service_download.download_file() task_who_update_initial.apply_async() diff --git a/covid19/oodm/who/who_model.py b/covid19/blueprints/who/who_model.py similarity index 100% rename from covid19/oodm/who/who_model.py rename to covid19/blueprints/who/who_model.py diff --git a/covid19/oodm/who/who_model_import.py b/covid19/blueprints/who/who_model_import.py similarity index 100% rename from covid19/oodm/who/who_model_import.py rename to covid19/blueprints/who/who_model_import.py diff --git a/covid19/oodm/who/who_service.py b/covid19/blueprints/who/who_service.py similarity index 92% rename from covid19/oodm/who/who_service.py rename to covid19/blueprints/who/who_service.py index fbc32393..1203b27d 100644 --- a/covid19/oodm/who/who_service.py +++ b/covid19/blueprints/who/who_service.py @@ -1,7 +1,7 @@ from database import app -from covid19.oodm.who.who_service_download import WhoServiceDownload -from covid19.oodm.who.who_service_import import WhoServiceImport -from covid19.oodm.who.who_service_update import WhoServiceUpdate +from covid19.blueprints.who.who_service_download import WhoServiceDownload +from covid19.blueprints.who.who_service_import import WhoServiceImport +from covid19.blueprints.who.who_service_update import WhoServiceUpdate class WhoService: diff --git a/covid19/oodm/who/who_service_config.py b/covid19/blueprints/who/who_service_config.py similarity index 100% rename from covid19/oodm/who/who_service_config.py rename to covid19/blueprints/who/who_service_config.py diff --git a/covid19/oodm/who/who_service_download.py b/covid19/blueprints/who/who_service_download.py similarity index 97% rename from covid19/oodm/who/who_service_download.py rename to covid19/blueprints/who/who_service_download.py index 6d2553f5..25dcff0a 100644 --- a/covid19/oodm/who/who_service_download.py +++ b/covid19/blueprints/who/who_service_download.py @@ -2,7 +2,7 @@ import os import wget from flask import flash from database import app -from covid19.oodm.who.who_service_config import WhoServiceDownloadConfig +from covid19.blueprints.who.who_service_config import WhoServiceDownloadConfig class WhoServiceDownload: diff --git a/covid19/oodm/who/who_service_import.py b/covid19/blueprints/who/who_service_import.py similarity index 95% rename from covid19/oodm/who/who_service_import.py rename to covid19/blueprints/who/who_service_import.py index 5d96ff72..37a37288 100644 --- a/covid19/oodm/who/who_service_import.py +++ b/covid19/blueprints/who/who_service_import.py @@ -3,8 +3,8 @@ import sys import csv import psycopg2 from database import db, app -from covid19.oodm.who.who_model_import import WhoGlobalDataImportTable -from covid19.oodm.who.who_service_download import WhoServiceDownloadConfig +from covid19.blueprints.who.who_model_import import WhoGlobalDataImportTable +from covid19.blueprints.who.who_service_download import WhoServiceDownloadConfig class WhoServiceImport: diff --git a/covid19/oodm/who/who_service_update.py b/covid19/blueprints/who/who_service_update.py similarity index 97% rename from covid19/oodm/who/who_service_update.py rename to covid19/blueprints/who/who_service_update.py index 3ae26cc7..611a8644 100644 --- a/covid19/oodm/who/who_service_update.py +++ b/covid19/blueprints/who/who_service_update.py @@ -1,7 +1,7 @@ from database import db, app -from covid19.oodm.who.who_model import WhoRegion, WhoDateReported, WhoCountry, WhoGlobalData -from covid19.oodm.who.who_model_import import WhoGlobalDataImportTable -from covid19.oodm.who.who_service_download import WhoServiceDownloadConfig +from covid19.blueprints.who.who_model import WhoRegion, WhoDateReported, WhoCountry, WhoGlobalData +from covid19.blueprints.who.who_model_import import WhoGlobalDataImportTable +from covid19.blueprints.who.who_service_download import WhoServiceDownloadConfig class WhoServiceUpdate: diff --git a/covid19/services.py b/covid19/services.py index bcca44b5..382724df 100644 --- a/covid19/services.py +++ b/covid19/services.py @@ -1,11 +1,11 @@ from database import db -from covid19.oodm.common.common_service import CommonService -from covid19.oodm.who.who_service import WhoService -from covid19.oodm.europe.europe_service import EuropeService -from covid19.oodm.rki.rki_service import RkiService -from covid19.oodm.vaccination.vaccination_service import VaccinationService -from covid19.oodm.admin.admin_service import AdminService +from covid19.blueprints.common.common_service import CommonService +from covid19.blueprints.who.who_service import WhoService +from covid19.blueprints.europe.europe_service import EuropeService +from covid19.blueprints.rki.rki_service import RkiService +from covid19.blueprints.vaccination.vaccination_service import VaccinationService +from covid19.blueprints.admin.admin_service import AdminService ############################################################################################ # diff --git a/covid19/views.py b/covid19/views.py index b73918d6..0edbab50 100644 --- a/covid19/views.py +++ b/covid19/views.py @@ -1,12 +1,12 @@ from flask import render_template, redirect, url_for from database import app -from covid19.oodm.common.common_model_transient import ApplicationPage +from covid19.blueprints.common.common_model_transient import ApplicationPage -import covid19.oodm.who.views_who -import covid19.oodm.europe.views_europe -import covid19.oodm.vaccination.views_vaccination -import covid19.oodm.rki.views_rki -import covid19.oodm.admin.views_admin +import covid19.blueprints.who.views_who +import covid19.blueprints.europe.views_europe +import covid19.blueprints.vaccination.views_vaccination +import covid19.blueprints.rki.views_rki +import covid19.blueprints.admin.views_admin ############################################################################################ -- GitLab