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 404575d1cb9b9338b4309c9630c2157f69827003..c3c0636b31ad5faab5483a9c9e2febe8365589e2 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 36a4f91b3231edfd85ac3e1d56f232612aea8bf5..f81e1fe021a2ec5edbb9d2962056e06f7b18cacb 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 d61443478630c93e8750fec9093abecafe14ccd0..57f91f5835cc04f8fc381a0c91eabb5847a9e852 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 bbc41fe2302c4db87d36e53e8f291ba12141c309..85b8522423fecc5b9f7ca4d236dea51122abf7bb 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 5fa70eb63f6ae4cc87d1140ce3406937efb0d292..c3da65cb899c3f9939c614ad5d676839153dff61 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 bf14483f4ec9e77afa5512e1f216f99321c9a4fa..47b9399da9e8366426cc49727fb8f22bcbea912b 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 f8934da754587f1e080a4148d53433698e217e14..3ed8bd55a2013663bcfa88d89885c2ec5adbedea 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 e5f8a16406dfd441d419ae1dced247fdf5201a64..e7151fa34c15cbac5ff211a1f8cae2ab25e8ec38 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 cacd89ce41c5579cb43c53ea1b99d46fb54c8427..a013049f18eb77626b47181ae5e974aa0e981336 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 2355250ce9b38668321c7a7a0b501e482420bfac..8d1bc2b7ea757b3d061903445e55b68481625a27 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 90e090069f874243ae817e987edb3ebf7acbd3ac..e80820a59cc5b20b9ecb1daa530b3c717316bd22 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 fd43e8f0c4c7b3e91d22c34b75ee26880e9a7fc2..33b9856c552bc31d96412a3926ab21b0c276e729 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 c0ecb49c8a657993a8368664427c5704d877dd1e..db605158faff536bb01af3270775ba9aa7dee56f 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 f7000ca9da1938d31c995a81f0207aeb51b49230..1ae14d773cc119b642a45f97e2c43e7ea7ace5f5 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 3c2f1139514a00c136d6f6d749325595ab5c40ce..bf81a8c40720094b0d8b3bf7eb65a3db9ee70465 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 fbc323936b67abc4c11fa9c807ae26ea4b8b3303..1203b27d36e7dcc75650940f2016072f109c717a 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 6d2553f5e38b7a4b8997b7093d73e2c76ec6dc23..25dcff0a0db3277fc29a4a68de5e54e10d5cc6cc 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 5d96ff721a6d5d6017431e174e305bed006a98c6..37a37288f3f718b4bc5cf73de7b4be7cdb21d3b5 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 3ae26cc7f010bbbc2cb7e848c0fe0bdb0e5cb5f2..611a86442026ac6614c2922f87259dfad8e37b73 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 bcca44b55860dc1ed2626295015886dcfa20b2af..382724dfd204dd3be5f0f7f0200b3f9ab6b487e0 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 b73918d60f62672fcbbc0a37d782aa30b57c8353..0edbab50b831e180579214083ab487e54b5a10b5 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 ############################################################################################