From 127a34211bca568f668f4742089df09fd69374f1 Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Sat, 13 Feb 2021 15:05:24 +0100 Subject: [PATCH] ## 0.0.15 Release * ------------------------------------- * Fixed #88 rename VaccinationImport to VaccinationImport * Fixed #89 change tablename from vaccination_germany_timeline_import to vaccination_import * Fixed #86 rename VaccinationData to VaccinationData * Fixed #162 rename table vaccination_germany_timeline into vaccination_data * ------------------------------------- * Fixed #170 implement url_vaccination_task_update_star_schema_initial in vaccination_views.py * Fixed #171 implement url_vaccination_task_update_starschema_incremental in vaccination_views.py * Fixed #172 implement url_vaccination_task_import_only in vaccination_views.py * Fixed #173 implement url_vaccination_task_import_only in vaccination_views.py * Fixed #174 implement url_vaccination_task_update_dimensiontables_only in vaccination_views.py * Fixed #175 implement url_vaccination_task_update_facttable_incremental_only in vaccination_views.py * Fixed #176 implement url_vaccination_task_update_facttable_initial_only in vaccination_views.py * ------------------------------------- * Fixed #91 implement VaccinationService.run_download_only * Fixed #92 implement VaccinationService.run_import_only * Fixed #93 implement VaccinationService.run_update_dimension_tables_only * Fixed #94 implement VaccinationService.run_update_fact_table_incremental_only * Fixed #95 implement VaccinationService.run_update_fact_table_initial_only * Fixed #96 implement VaccinationService.run_update_star_schema_incremental * Fixed #97 implement VaccinationService.run_update_star_schema_initial * Fixed #101 implement VaccinationServiceUpdate.update_dimension_tables_only * Fixed #102 implement VaccinationServiceUpdate.update_fact_table_incremental_only * Fixed #103 implement VaccinationServiceUpdate.update_fact_table_initial_only * Fixed #104 implement VaccinationServiceUpdate.update_star_schema_incremental * Fixed #105 implement VaccinationServiceUpdate.update_star_schema_initial * ------------------------------------- * Fixed #90 refactor VaccinationService to new method scheme introduced 07.02.2021 * Fixed #98 refactor VaccinationServiceDownload to new method scheme introduced 07.02.2021 * Fixed #99 refactor VaccinationServiceImport to new method scheme introduced 07.02.2021 * Fixed #100 refactor VaccinationServiceUpdate to new method scheme introduced 07.02.2021 * ------------------------------------- * Fixed #87 change to: Vaccination.datum many to one VaccinationDateReported * Fixed #106 add Tasks and URLs for starting Tasks to vaccination_views * ------------------------------------- --- BACKLOG.md | 36 ++++----- src/covid19/app_services.py | 17 ++-- src/covid19/app_views.py | 2 +- src/covid19/blueprints/admin/admin_views.py | 11 +-- src/covid19/blueprints/ecdc/ecdc_model.py | 34 ++++---- .../blueprints/ecdc/ecdc_model_import.py | 14 ++-- src/covid19/blueprints/ecdc/ecdc_service.py | 28 +++---- .../blueprints/ecdc/ecdc_service_config.py | 2 +- .../blueprints/ecdc/ecdc_service_download.py | 6 +- .../blueprints/ecdc/ecdc_service_import.py | 12 +-- .../blueprints/ecdc/ecdc_service_update.py | 80 +++++++++---------- src/covid19/blueprints/ecdc/ecdc_views.py | 62 +++++++------- .../rki_vaccination/rki_vaccination_views.py | 60 +++++++------- src/covid19/blueprints/who/who_views.py | 6 +- 14 files changed, 186 insertions(+), 184 deletions(-) diff --git a/BACKLOG.md b/BACKLOG.md index 4cce36b6..9300748d 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -86,7 +86,7 @@ * Fixed #56 /vaccination/info ### 0.0.13 Release -* Fixed #49 EuropeServiceUpdate.__update_data_short() (wontfix) +* Fixed #49 EcdcServiceUpdate.__update_data_short() (wontfix) * Fixed #52 download vaccination timeline data file * Fixed #53 import vaccination timeline data file into db * Fixed #54 /vaccination/imported @@ -163,22 +163,22 @@ ### 0.0.16 Release * ------------------------------------- * Issue #82 change to ORM ClassHierarchy -* Issue #108 change to ORM ClassHierarchy in: EuropeImport.get_countries_of_continent +* Issue #108 change to ORM ClassHierarchy in: EcdcImport.get_countries_of_continent * Issue #129 change to ORM ClassHierarchy in: RkiLandkreiseImport.get_new_dates_as_array * Issue #131 change to ORM ClassHierarchy in: RkiGermanyDataImportTable.get_new_dates_as_array * ------------------------------------- * Issue #111 refactor to new method scheme itroduced 07.02.2021 -* Issue #117 refactor EuropeServiceUpdate to new method scheme introduced 07.02.2021 -* Issue #112 implement EuropeService.run_update_dimension_tables_only -* Issue #113 implement EuropeService.run_update_fact_table_incremental_only -* Issue #114 implement EuropeService.run_update_fact_table_initial_only -* Issue #115 implement EuropeService.run_update_star_schema_incremental -* Issue #116 implement EuropeService.run_update_star_schema_initial -* Issue #118 implement EuropeServiceUpdate.update_dimension_tables_only -* Issue #119 implement EuropeServiceUpdate.update_fact_table_incremental_only -* Issue #120 implement EuropeServiceUpdate.update_fact_table_initial_only -* Issue #121 implement EuropeServiceUpdate.update_star_schema_incremental -* Issue #122 implement EuropeServiceUpdate.update_star_schema_initial +* Issue #117 refactor EcdcServiceUpdate to new method scheme introduced 07.02.2021 +* Issue #112 implement EcdcService.run_update_dimension_tables_only +* Issue #113 implement EcdcService.run_update_fact_table_incremental_only +* Issue #114 implement EcdcService.run_update_fact_table_initial_only +* Issue #115 implement EcdcService.run_update_star_schema_incremental +* Issue #116 implement EcdcService.run_update_star_schema_initial +* Issue #118 implement EcdcServiceUpdate.update_dimension_tables_only +* Issue #119 implement EcdcServiceUpdate.update_fact_table_incremental_only +* Issue #120 implement EcdcServiceUpdate.update_fact_table_initial_only +* Issue #121 implement EcdcServiceUpdate.update_star_schema_incremental +* Issue #122 implement EcdcServiceUpdate.update_star_schema_initial * ------------------------------------- * Issue #163 implement url_europe_task_update_star_schema_initial in europe_views.py * Issue #164 implement url_europe_task_update_starschema_incremental in europe_views.py @@ -222,13 +222,13 @@ ### 0.0.18 Release * Issue #39 SQLalchemy instead of SQL: AllModelClasses.remove_all() -* Issue #40 SQLalchemy instead of SQL: EuropeImport.get_date_rep() -* Issue #41 SQLalchemy instead of SQL: EuropeImport.get_countries_of_continent() +* Issue #40 SQLalchemy instead of SQL: EcdcImport.get_date_rep() +* Issue #41 SQLalchemy instead of SQL: EcdcImport.get_countries_of_continent() * Issue #42 SQLalchemy instead of SQL: WhoImport.get_new_dates_as_array() * Issue #83 SQLalchemy instead of SQL in WhoImport.get_new_dates_as_array -* Issue #107 SQLalchemy instead of SQL in: EuropeImport.get_countries_of_continent -* Issue #109 SQLalchemy instead of SQL in: EuropeImport.get_date_rep -* Issue #110 SQLalchemy instead of SQL in: EuropeImport.get_continent +* Issue #107 SQLalchemy instead of SQL in: EcdcImport.get_countries_of_continent +* Issue #109 SQLalchemy instead of SQL in: EcdcImport.get_date_rep +* Issue #110 SQLalchemy instead of SQL in: EcdcImport.get_continent ### 0.0.198 Release * Issue #5 Visual Graphs for Data per Countries order by Date diff --git a/src/covid19/app_services.py b/src/covid19/app_services.py index de9e80a7..fa93ca42 100644 --- a/src/covid19/app_services.py +++ b/src/covid19/app_services.py @@ -1,22 +1,23 @@ from database import db +from covid19.blueprints.admin.admin_service import AdminService from covid19.blueprints.common.common_service import CommonService -from covid19.blueprints.who.who_service import WhoService -from covid19.blueprints.ecdc.europe_service import EuropeService +from covid19.blueprints.ecdc.ecdc_service import EcdcService from covid19.blueprints.rki_bundeslaender.rki_service import RkiBundeslaenderService from covid19.blueprints.rki_landkreise.rki_service import RkiLandkreiseService -from covid19.blueprints.rki_vaccination.vaccination_service import VaccinationService -from covid19.blueprints.admin.admin_service import AdminService +from covid19.blueprints.rki_vaccination.rki_vaccination_service import VaccinationService +from covid19.blueprints.who.who_service import WhoService + ############################################################################################ # # Services # +admin_service = AdminService(db) common_service = CommonService(db) -who_service = WhoService(db) -europe_service = EuropeService(db) +ecdc_service = EcdcService(db) rki_service_bundeslaender = RkiBundeslaenderService(db) rki_service_landkreise = RkiLandkreiseService(db) -vaccination_service = VaccinationService(db) -admin_service = AdminService(db) +rki_vaccination_service = VaccinationService(db) +who_service = WhoService(db) db.create_all() diff --git a/src/covid19/app_views.py b/src/covid19/app_views.py index 74cdaf2b..9a601027 100644 --- a/src/covid19/app_views.py +++ b/src/covid19/app_views.py @@ -3,7 +3,7 @@ from database import app from covid19.blueprints.common.common_model_transient import ApplicationPage import covid19.blueprints.admin.admin_views -import covid19.blueprints.ecdc.europe_views +import covid19.blueprints.ecdc.ecdc_views import covid19.blueprints.rki_bundeslaender.rki_views import covid19.blueprints.rki_landkreise.rki_views import covid19.blueprints.rki_vaccination.rki_vaccination_views diff --git a/src/covid19/blueprints/admin/admin_views.py b/src/covid19/blueprints/admin/admin_views.py index 2d5bad88..ae76d791 100644 --- a/src/covid19/blueprints/admin/admin_views.py +++ b/src/covid19/blueprints/admin/admin_views.py @@ -3,13 +3,14 @@ from celery import states from celery.utils.log import get_task_logger from database import app -from covid19.services import who_service, europe_service, vaccination_service, admin_service, rki_service_bundeslaender -from covid19.workers import celery +from covid19.app_services import who_service, ecdc_service, vaccination_service, admin_service +from covid19.app_services import rki_service_bundeslaender +from covid19.app_workers import celery from covid19.blueprints.common.common_model_transient import ApplicationPage drop_and_create_data_again = True -app_admin = Blueprint('admin', __name__, template_folder='templates') +app_admin = Blueprint('admin', __name__, template_folder='templates', url_prefix='/admin') ################################################################################################################# @@ -39,7 +40,7 @@ def task_admin_database_drop_create(self): logger.info(" Received: task_admin_database_drop_create [OK] ") logger.info("------------------------------------------------------------") who_service.task_database_drop_create() - europe_service.task_database_drop_create() + ecdc_service.task_database_drop_create() vaccination_service.task_database_drop_create() admin_service.task_database_drop_create() self.update_state(state=states.SUCCESS) @@ -104,7 +105,7 @@ def url_admin_database_drop(): admin_service.run_admin_database_drop() if drop_and_create_data_again: who_service.pretask_database_drop_create() - europe_service.pretask_database_drop_create() + ecdc_service.pretask_database_drop_create() vaccination_service.pretask_database_drop_create() rki_service_bundeslaender.pretask_database_drop_create() flash("task_admin_database_drop_create async started") diff --git a/src/covid19/blueprints/ecdc/ecdc_model.py b/src/covid19/blueprints/ecdc/ecdc_model.py index 97ea734b..41d4eb36 100644 --- a/src/covid19/blueprints/ecdc/ecdc_model.py +++ b/src/covid19/blueprints/ecdc/ecdc_model.py @@ -4,8 +4,8 @@ from database import db, ITEMS_PER_PAGE from covid19.blueprints.common.common_model import CommonDateReported, CommonRegion -class EuropeDateReported(CommonDateReported): - __tablename__ = 'europe_date_reported' +class EcdcDateReported(CommonDateReported): + __tablename__ = 'ecdc_date_reported' __mapper_args__ = { 'concrete': True } @@ -37,7 +37,7 @@ class EuropeDateReported(CommonDateReported): else: my_year_week += "-" my_year_week += str(week_number) - return EuropeDateReported( + return EcdcDateReported( date_reported=my_date_rep, datum=my_datum, year=my_datum.year, @@ -49,8 +49,8 @@ class EuropeDateReported(CommonDateReported): ) -class EuropeContinent(CommonRegion): - __tablename__ = 'europe_continent' +class EcdcContinent(CommonRegion): + __tablename__ = 'ecdc_continent' __mapper_args__ = {'concrete': True} __table_args__ = ( db.UniqueConstraint('region', name="uix_europe_continent"), @@ -60,8 +60,8 @@ class EuropeContinent(CommonRegion): region = db.Column(db.String(255), nullable=False, unique=True) -class EuropeCountry(db.Model): - __tablename__ = 'europe_country' +class EcdcCountry(db.Model): + __tablename__ = 'ecdc_country' __table_args__ = ( db.UniqueConstraint('countries_and_territories', 'geo_id', 'country_territory_code', name="uix_europe_country"), ) @@ -72,11 +72,11 @@ class EuropeCountry(db.Model): geo_id = db.Column(db.String(255), nullable=False) country_territory_code = db.Column(db.String(255), nullable=False) - continent_id = db.Column(db.Integer, db.ForeignKey('europe_continent.id'), nullable=False) + continent_id = db.Column(db.Integer, db.ForeignKey('ecdc_continent.id'), nullable=False) continent = db.relationship( - 'EuropeContinent', + 'EcdcContinent', lazy='subquery', - order_by='EuropeContinent.region', + order_by='EcdcContinent.region', cascade="all, delete" ) @@ -124,23 +124,23 @@ class EuropeCountry(db.Model): .one_or_none() -class EuropeData(db.Model): - __tablename__ = 'europe_data' +class EcdcData(db.Model): + __tablename__ = 'ecdc_data' id = db.Column(db.Integer, primary_key=True) deaths_weekly = db.Column(db.Integer, nullable=False) cases_weekly = db.Column(db.Integer, nullable=False) notification_rate_per_100000_population_14days = db.Column(db.Float, nullable=False) - europe_country_id = db.Column(db.Integer, db.ForeignKey('europe_country.id'), nullable=False) - europe_country = db.relationship('EuropeCountry', lazy='joined', cascade="all, delete") + europe_country_id = db.Column(db.Integer, db.ForeignKey('ecdc_country.id'), nullable=False) + europe_country = db.relationship('EcdcCountry', lazy='joined', cascade="all, delete") - europe_date_reported_id = db.Column(db.Integer, db.ForeignKey('europe_date_reported.id'), nullable=False) + europe_date_reported_id = db.Column(db.Integer, db.ForeignKey('ecdc_date_reported.id'), nullable=False) europe_date_reported = db.relationship( - 'EuropeDateReported', + 'EcdcDateReported', lazy='joined', cascade='all, delete', - order_by='desc(EuropeDateReported.date_reported)') + order_by='desc(EcdcDateReported.date_reported)') @classmethod def remove_all(cls): diff --git a/src/covid19/blueprints/ecdc/ecdc_model_import.py b/src/covid19/blueprints/ecdc/ecdc_model_import.py index cc79b0b6..8b7aec99 100644 --- a/src/covid19/blueprints/ecdc/ecdc_model_import.py +++ b/src/covid19/blueprints/ecdc/ecdc_model_import.py @@ -1,8 +1,8 @@ from database import db, ITEMS_PER_PAGE -class EuropeImport(db.Model): - __tablename__ = 'europe_import' +class EcdcImport(db.Model): + __tablename__ = 'ecdc_import' id = db.Column(db.Integer, primary_key=True) date_rep = db.Column(db.String(255), nullable=False) @@ -44,13 +44,13 @@ class EuropeImport(db.Model): @classmethod def get_date_rep(cls): - # TODO: #109 SQLalchemy instead of SQL in: EuropeImport.get_date_rep + # TODO: #109 SQLalchemy instead of SQL in: EcdcImport.get_date_rep sql = "select distinct date_rep, year_week from europe_import order by year_week desc" return db.session.execute(sql).fetchall() @classmethod def get_continent(cls): - # TODO: #110 SQLalchemy instead of SQL in: EuropeImport.get_continent + # TODO: #110 SQLalchemy instead of SQL in: EcdcImport.get_continent sql = "select distinct continent_exp from europe_import order by continent_exp asc" return db.session.execute(sql).fetchall() @@ -59,8 +59,8 @@ class EuropeImport(db.Model): my_continent_exp = my_continent.region my_params = {} my_params['my_continent_param'] = my_continent_exp - #TODO: #107 SQLalchemy instead of SQL in: EuropeImport.get_countries_of_continent - #TODO: #108 BUG: change to ORM ClassHierarchy in: EuropeImport.get_countries_of_continent + #TODO: #107 SQLalchemy instead of SQL in: EcdcImport.get_countries_of_continent + #TODO: #108 BUG: change to ORM ClassHierarchy in: EcdcImport.get_countries_of_continent sql = """ select distinct countries_and_territories, @@ -69,7 +69,7 @@ class EuropeImport(db.Model): pop_data_2019, continent_exp from - europe_import + ecdc_import group by countries_and_territories, geo_id, diff --git a/src/covid19/blueprints/ecdc/ecdc_service.py b/src/covid19/blueprints/ecdc/ecdc_service.py index e3ecfe0c..09e1483c 100644 --- a/src/covid19/blueprints/ecdc/ecdc_service.py +++ b/src/covid19/blueprints/ecdc/ecdc_service.py @@ -1,26 +1,26 @@ from flask import flash from database import app -from covid19.blueprints.ecdc.europe_service_download import EuropeServiceDownload -from covid19.blueprints.ecdc.europe_service_import import EuropeServiceImport -from covid19.blueprints.ecdc.europe_service_update import EuropeServiceUpdate +from covid19.blueprints.ecdc.ecdc_service_download import EcdcServiceDownload +from covid19.blueprints.ecdc.ecdc_service_import import EcdcServiceImport +from covid19.blueprints.ecdc.ecdc_service_update import EcdcServiceUpdate -# TODO: #111 refactor to new method scheme itroduced 07.02.2021 -class EuropeService: +# TODO: #111 refactor to new method scheme introduced 07.02.2021 +class EcdcService: def __init__(self, database): app.logger.debug("------------------------------------------------------------") app.logger.debug(" Europe Service [init]") app.logger.debug("------------------------------------------------------------") self.__database = database - self.europe_service_download = EuropeServiceDownload(database) - self.europe_service_import = EuropeServiceImport(database) - self.europe_service_update = EuropeServiceUpdate(database) + self.europe_service_download = EcdcServiceDownload(database) + self.europe_service_import = EcdcServiceImport(database) + self.europe_service_update = EcdcServiceUpdate(database) app.logger.debug("------------------------------------------------------------") app.logger.info(" Europe Service [ready] ") def pretask_database_drop_create(self): - flash("europe_service.download started") + flash("ecdc_service.download started") self.europe_service_download.download() return self @@ -37,29 +37,29 @@ class EuropeService: self.europe_service_import.import_datafile_to_db() return self - # TODO: #112 implement EuropeService.run_update_dimension_tables_only + # TODO: #112 implement EcdcService.run_update_dimension_tables_only # TODO: #111 refactor to new method scheme itroduced 07.02.2021 def run_update_dimension_tables_only(self): return self - # TODO: #113 implement EuropeService.run_update_fact_table_incremental_only + # TODO: #113 implement EcdcService.run_update_fact_table_incremental_only # TODO: #111 refactor to new method scheme itroduced 07.02.2021 def run_update_fact_table_incremental_only(self): return self - # TODO: #114 implement EuropeService.run_update_fact_table_initial_only + # TODO: #114 implement EcdcService.run_update_fact_table_initial_only # TODO: #111 refactor to new method scheme itroduced 07.02.2021 def run_update_fact_table_initial_only(self): return self - # TODO: #115 implement EuropeService.run_update_star_schema_incremental + # TODO: #115 implement EcdcService.run_update_star_schema_incremental # TODO: #111 refactor to new method scheme itroduced 07.02.2021 def run_update_star_schema_incremental(self): return self - # TODO: #116 implement EuropeService.run_update_star_schema_initial + # TODO: #116 implement EcdcService.run_update_star_schema_initial # TODO: #111 refactor to new method scheme itroduced 07.02.2021 def run_update_star_schema_initial(self): return self diff --git a/src/covid19/blueprints/ecdc/ecdc_service_config.py b/src/covid19/blueprints/ecdc/ecdc_service_config.py index 63447385..ef880381 100644 --- a/src/covid19/blueprints/ecdc/ecdc_service_config.py +++ b/src/covid19/blueprints/ecdc/ecdc_service_config.py @@ -1,7 +1,7 @@ import os -class EuropeServiceConfig: +class EcdcServiceConfig: def __init__(self): self.limit_nr = 20 self.data_path = ".."+os.sep+".."+os.sep+"data" diff --git a/src/covid19/blueprints/ecdc/ecdc_service_download.py b/src/covid19/blueprints/ecdc/ecdc_service_download.py index 0b096c50..50ffecb4 100644 --- a/src/covid19/blueprints/ecdc/ecdc_service_download.py +++ b/src/covid19/blueprints/ecdc/ecdc_service_download.py @@ -2,16 +2,16 @@ import os import wget from flask import flash from database import app -from covid19.blueprints.ecdc.europe_service_config import EuropeServiceConfig +from covid19.blueprints.ecdc.ecdc_service_config import EcdcServiceConfig -class EuropeServiceDownload: +class EcdcServiceDownload: def __init__(self, database): app.logger.debug("------------------------------------------------------------") app.logger.debug(" Europe Service Download [init]") app.logger.debug("------------------------------------------------------------") self.__database = database - self.cfg = EuropeServiceConfig() + self.cfg = EcdcServiceConfig() app.logger.debug("------------------------------------------------------------") app.logger.debug(" Europe Service Download [ready] ") diff --git a/src/covid19/blueprints/ecdc/ecdc_service_import.py b/src/covid19/blueprints/ecdc/ecdc_service_import.py index 393e2a6a..ccd2b97c 100644 --- a/src/covid19/blueprints/ecdc/ecdc_service_import.py +++ b/src/covid19/blueprints/ecdc/ecdc_service_import.py @@ -3,17 +3,17 @@ import csv import psycopg2 from database import db, app -from covid19.blueprints.ecdc.europe_model_import import EuropeImport -from covid19.blueprints.ecdc.europe_service_config import EuropeServiceConfig +from covid19.blueprints.ecdc.ecdc_model_import import EcdcImport +from covid19.blueprints.ecdc.ecdc_service_config import EcdcServiceConfig -class EuropeServiceImport: +class EcdcServiceImport: def __init__(self, database): app.logger.debug("------------------------------------------------------------") app.logger.debug(" Europe Service Import [init]") app.logger.debug("------------------------------------------------------------") self.__database = database - self.cfg = EuropeServiceConfig() + self.cfg = EcdcServiceConfig() app.logger.debug("------------------------------------------------------------") app.logger.debug(" Europe Service Import [ready] ") @@ -26,11 +26,11 @@ class EuropeServiceImport: app.logger.info("------------------------------------------------------------") k = 0 try: - EuropeImport.remove_all() + EcdcImport.remove_all() with open(src_cvsfile_name, newline='') as csv_file: file_reader = csv.DictReader(csv_file, delimiter=',', quotechar='"') for row in file_reader: - o = EuropeImport( + o = EcdcImport( date_rep=row['dateRep'], year_week=row['year_week'], cases_weekly=row['cases_weekly'], diff --git a/src/covid19/blueprints/ecdc/ecdc_service_update.py b/src/covid19/blueprints/ecdc/ecdc_service_update.py index 65fa1edf..f86ab896 100644 --- a/src/covid19/blueprints/ecdc/ecdc_service_update.py +++ b/src/covid19/blueprints/ecdc/ecdc_service_update.py @@ -1,30 +1,30 @@ from database import db, app -from covid19.blueprints.ecdc.europe_service_config import EuropeServiceConfig -from covid19.blueprints.ecdc.europe_model_import import EuropeImport -from covid19.blueprints.ecdc.europe_model import EuropeDateReported, EuropeContinent, EuropeCountry, EuropeData +from covid19.blueprints.ecdc.ecdc_service_config import EcdcServiceConfig +from covid19.blueprints.ecdc.ecdc_model_import import EcdcImport +from covid19.blueprints.ecdc.ecdc_model import EcdcDateReported, EcdcContinent, EcdcCountry, EcdcData -# TODO: #117 refactor EuropeServiceUpdate to new method scheme introduced 07.02.2021 -class EuropeServiceUpdate: +# TODO: #117 refactor EcdcServiceUpdate to new method scheme introduced 07.02.2021 +class EcdcServiceUpdate: def __init__(self, database): app.logger.debug("------------------------------------------------------------") app.logger.debug(" Europe Service Update [init]") app.logger.debug("------------------------------------------------------------") self.__database = database - self.cfg = EuropeServiceConfig() + self.cfg = EcdcServiceConfig() app.logger.debug("------------------------------------------------------------") app.logger.debug(" Europe Service Update [ready] ") def __update_date_reported(self): app.logger.info(" __update_date_reported [begin]") app.logger.info("------------------------------------------------------------") - result_date_rep = EuropeImport.get_date_rep() + result_date_rep = EcdcImport.get_date_rep() k = 0 for result_item in result_date_rep: k += 1 my_date_rep = result_item['date_rep'] my_year_week = result_item['year_week'] - o = EuropeDateReported.create_new_object_factory( + o = EcdcDateReported.create_new_object_factory( my_date_rep=my_date_rep ) db.session.add(o) @@ -37,10 +37,10 @@ class EuropeServiceUpdate: def __update_continent(self): app.logger.info(" __update_continent [begin]") app.logger.info("------------------------------------------------------------") - result_continent = EuropeImport.get_continent() + result_continent = EcdcImport.get_continent() for result_item in result_continent: my_continent_exp = result_item['continent_exp'] - o = EuropeContinent( + o = EcdcContinent( region=my_continent_exp ) app.logger.info("| " + str(o) + " |") @@ -53,11 +53,11 @@ class EuropeServiceUpdate: def __update_country(self): app.logger.info(" __update_country [begin]") app.logger.info("------------------------------------------------------------") - all_continents = EuropeContinent.get_all() + all_continents = EcdcContinent.get_all() for my_continent in all_continents: - result_countries_of_continent = EuropeImport.get_countries_of_continent(my_continent) + result_countries_of_continent = EcdcImport.get_countries_of_continent(my_continent) for c in result_countries_of_continent: - o = EuropeCountry( + o = EcdcCountry( countries_and_territories=c['countries_and_territories'], geo_id=c['geo_id'], country_territory_code=c['country_territory_code'], @@ -73,21 +73,21 @@ class EuropeServiceUpdate: def __update_data_initial(self): app.logger.info(" __update_data_initial [begin]") app.logger.info("------------------------------------------------------------") - result_date_rep = EuropeImport.get_date_rep() + result_date_rep = EcdcImport.get_date_rep() i = 0 for item_date_rep in result_date_rep: - europe_date_reported = EuropeDateReported.find_by_date_reported( + europe_date_reported = EcdcDateReported.find_by_date_reported( i_date_reported=item_date_rep['date_rep'] ) if europe_date_reported is None: - o = EuropeDateReported.create_new_object_factory(item_date_rep['date_rep']) + o = EcdcDateReported.create_new_object_factory(item_date_rep['date_rep']) europe_date_reported = o - result_europe_data_import = EuropeImport.find_by_date_reported(europe_date_reported) + result_europe_data_import = EcdcImport.find_by_date_reported(europe_date_reported) for item_europe_data_import in result_europe_data_import: my_a = item_europe_data_import.countries_and_territories my_b = item_europe_data_import.geo_id my_c = item_europe_data_import.country_territory_code - europe_country = EuropeCountry.find_by( + europe_country = EcdcCountry.find_by( countries_and_territories=my_a, geo_id=my_b, country_territory_code=my_c @@ -98,7 +98,7 @@ class EuropeServiceUpdate: my_f = 0.0 else: my_f = float(item_europe_data_import.notification_rate_per_100000_population_14days) - o = EuropeData( + o = EcdcData( europe_country=europe_country, europe_date_reported=europe_date_reported, deaths_weekly=my_d, @@ -118,7 +118,7 @@ class EuropeServiceUpdate: app.logger.info("------------------------------------------------------------") return self - # TODO: #117 refactor EuropeServiceUpdate to new method scheme introduced 07.02.2021 + # TODO: #117 refactor EcdcServiceUpdate to new method scheme introduced 07.02.2021 def __update_data_short(self): app.logger.info(" __update_data_initial [begin]") app.logger.info("------------------------------------------------------------") @@ -127,14 +127,14 @@ class EuropeServiceUpdate: app.logger.info("------------------------------------------------------------") return self - # TODO: #117 refactor EuropeServiceUpdate to new method scheme introduced 07.02.2021 + # TODO: #117 refactor EcdcServiceUpdate to new method scheme introduced 07.02.2021 def update_db_initial(self): app.logger.info(" update_db_initial [begin]") app.logger.info("------------------------------------------------------------") - EuropeData.remove_all() - EuropeCountry.remove_all() - EuropeContinent.remove_all() - EuropeDateReported.remove_all() + EcdcData.remove_all() + EcdcCountry.remove_all() + EcdcContinent.remove_all() + EcdcDateReported.remove_all() self.__update_date_reported() self.__update_continent() self.__update_country() @@ -143,14 +143,14 @@ class EuropeServiceUpdate: app.logger.info("------------------------------------------------------------") return self - # TODO: #117 refactor EuropeServiceUpdate to new method scheme introduced 07.02.2021 + # TODO: #117 refactor EcdcServiceUpdate to new method scheme introduced 07.02.2021 def update_db_short(self): app.logger.info(" update_db_short [begin]") app.logger.info("------------------------------------------------------------") - EuropeData.remove_all() - EuropeCountry.remove_all() - EuropeContinent.remove_all() - EuropeDateReported.remove_all() + EcdcData.remove_all() + EcdcCountry.remove_all() + EcdcContinent.remove_all() + EcdcDateReported.remove_all() self.__update_date_reported() self.__update_continent() self.__update_country() @@ -160,26 +160,26 @@ class EuropeServiceUpdate: return self def update_dimension_tables_only(self): - # TODO: #118 implement EuropeServiceUpdate.update_dimension_tables_only - # TODO: #117 refactor EuropeServiceUpdate to new method scheme introduced 07.02.2021 + # TODO: #118 implement EcdcServiceUpdate.update_dimension_tables_only + # TODO: #117 refactor EcdcServiceUpdate to new method scheme introduced 07.02.2021 return self def update_fact_table_incremental_only(self): - # TODO: #119 implement EuropeServiceUpdate.update_fact_table_incremental_only - # TODO: #117 refactor EuropeServiceUpdate to new method scheme introduced 07.02.2021 + # TODO: #119 implement EcdcServiceUpdate.update_fact_table_incremental_only + # TODO: #117 refactor EcdcServiceUpdate to new method scheme introduced 07.02.2021 return self def update_fact_table_initial_only(self): - # TODO: #120 implement EuropeServiceUpdate.update_fact_table_initial_only - # TODO: #117 refactor EuropeServiceUpdate to new method scheme introduced 07.02.2021 + # TODO: #120 implement EcdcServiceUpdate.update_fact_table_initial_only + # TODO: #117 refactor EcdcServiceUpdate to new method scheme introduced 07.02.2021 return self def update_star_schema_incremental(self): - # TODO: #121 implement EuropeServiceUpdate.update_star_schema_incremental - # TODO: #117 refactor EuropeServiceUpdate to new method scheme introduced 07.02.2021 + # TODO: #121 implement EcdcServiceUpdate.update_star_schema_incremental + # TODO: #117 refactor EcdcServiceUpdate to new method scheme introduced 07.02.2021 return self def update_star_schema_initial(self): - # TODO: #122 implement EuropeServiceUpdate.update_star_schema_initial - # TODO: #117 refactor EuropeServiceUpdate to new method scheme introduced 07.02.2021 + # TODO: #122 implement EcdcServiceUpdate.update_star_schema_initial + # TODO: #117 refactor EcdcServiceUpdate to new method scheme introduced 07.02.2021 return self diff --git a/src/covid19/blueprints/ecdc/ecdc_views.py b/src/covid19/blueprints/ecdc/ecdc_views.py index 15aa821a..e8b622c8 100644 --- a/src/covid19/blueprints/ecdc/ecdc_views.py +++ b/src/covid19/blueprints/ecdc/ecdc_views.py @@ -3,11 +3,11 @@ from celery import states from celery.utils.log import get_task_logger from database import app -from covid19.app_services import europe_service +from covid19.app_services import ecdc_service from covid19.app_workers import celery -from covid19.blueprints.ecdc.ecdc_model_import import EuropeImport -from covid19.blueprints.ecdc.ecdc_model import EuropeDateReported, EuropeContinent, EuropeCountry, EuropeData +from covid19.blueprints.ecdc.ecdc_model_import import EcdcImport +from covid19.blueprints.ecdc.ecdc_model import EcdcDateReported, EcdcContinent, EcdcCountry, EcdcData from covid19.blueprints.common.common_model_transient import ApplicationPage @@ -29,7 +29,7 @@ def task_ecdc_update_initial_DEPRECATED(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_ecdc_update_initial [OK] ") logger.info("------------------------------------------------------------") - europe_service.run_update_initial_DEPRECATED() + ecdc_service.run_update_initial_DEPRECATED() self.update_state(state=states.SUCCESS) result = "OK (task_ecdc_update_initial)" return result @@ -43,7 +43,7 @@ def task_ecdc_update_short_DEPRECATED(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_ecdc_update_short [OK] ") logger.info("------------------------------------------------------------") - europe_service.run_update_short_DEPRECATED() + ecdc_service.run_update_short_DEPRECATED() self.update_state(state=states.SUCCESS) result = "OK (task_ecdc_update_short)" return result @@ -56,7 +56,7 @@ def task_ecdc_download_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_ecdc_download_only [OK] ") logger.info("------------------------------------------------------------") - europe_service.task_download_only() # TODO + ecdc_service.task_download_only() # TODO self.update_state(state=states.SUCCESS) result = "OK (task_ecdc_download_only)" return result @@ -69,7 +69,7 @@ def task_ecdc_import_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_ecdc_import_only [OK] ") logger.info("------------------------------------------------------------") - europe_service.task_import_only() # TODO + ecdc_service.task_import_only() # TODO self.update_state(state=states.SUCCESS) result = "OK (task_ecdc_import_only)" return result @@ -82,7 +82,7 @@ def task_ecdc_update_dimension_tables_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_ecdc_update_dimension_tables_only [OK] ") logger.info("------------------------------------------------------------") - europe_service.task_update_dimension_tables_only() # TODO + ecdc_service.task_update_dimension_tables_only() # TODO self.update_state(state=states.SUCCESS) result = "OK (task_ecdc_update_dimension_tables_only)" return result @@ -95,7 +95,7 @@ def task_ecdc_update_fact_table_incremental_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_ecdc_update_fact_table_incremental_only [OK] ") logger.info("------------------------------------------------------------") - europe_service.task_update_fact_table_incremental_only() # TODO + ecdc_service.task_update_fact_table_incremental_only() # TODO self.update_state(state=states.SUCCESS) result = "OK (task_ecdc_update_fact_table_incremental_only)" return result @@ -108,7 +108,7 @@ def task_ecdc_update_fact_table_initial_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_ecdc_update_fact_table_initial_only [OK] ") logger.info("------------------------------------------------------------") - europe_service.task_update_fact_table_initial_only() # TODO + ecdc_service.task_update_fact_table_initial_only() # TODO self.update_state(state=states.SUCCESS) result = "OK (task_ecdc_update_fact_table_initial_only)" return result @@ -121,7 +121,7 @@ def task_ecdc_update_fact_table_initial_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_ecdc_update_fact_table_initial_only [OK] ") logger.info("------------------------------------------------------------") - europe_service.task_update_fact_table_initial_only() # TODO + ecdc_service.task_update_fact_table_initial_only() # TODO self.update_state(state=states.SUCCESS) result = "OK (task_ecdc_update_fact_table_initial_only)" return result @@ -134,7 +134,7 @@ def task_ecdc_update_star_schema_incremental(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_ecdc_update_star_schema_incremental [OK] ") logger.info("------------------------------------------------------------") - europe_service.task_update_star_schema_incremental() # TODO + ecdc_service.task_update_star_schema_incremental() # TODO self.update_state(state=states.SUCCESS) result = "OK (task_ecdc_update_star_schema_incremental)" return result @@ -147,7 +147,7 @@ def task_ecdc_update_star_schema_initial(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_ecdc_update_star_schema_initial [OK] ") logger.info("------------------------------------------------------------") - europe_service.task_update_star_schema_initial() # TODO + ecdc_service.task_update_star_schema_initial() # TODO self.update_state(state=states.SUCCESS) result = "OK (task_ecdc_update_star_schema_initial)" return result @@ -175,7 +175,7 @@ def url_ecdc_tasks(): @app_ecdc.route('/imported') def url_ecdc_data_imported(page=1): page_info = ApplicationPage('Europe', "Last Import") - page_data = EuropeImport.get_all_as_page(page) + page_data = EcdcImport.get_all_as_page(page) return render_template( 'ecdc/europe_imported.html', page_data=page_data, @@ -186,7 +186,7 @@ def url_ecdc_data_imported(page=1): @app_ecdc.route('/date_reported/all') def url_ecdc_date_reported_all(page=1): page_info = ApplicationPage('Europe', "date_reported") - page_data = EuropeDateReported.get_all_as_page(page) + page_data = EcdcDateReported.get_all_as_page(page) return render_template( 'ecdc/date_reported/europe_date_reported_all.html', page_data=page_data, @@ -199,8 +199,8 @@ def url_ecdc_date_reported_all(page=1): @app_ecdc.route('/date_reported/notification_rate/<int:europe_date_reported_id>') def url_ecdc_date_reported_one_notification_rate(europe_date_reported_id, page=1): page_info = ApplicationPage('Europe', "date_reported") - europe_date_reported = EuropeDateReported.get_by_id(europe_date_reported_id) - page_data = EuropeData.find_by_date_reported_notification_rate(europe_date_reported, page) + europe_date_reported = EcdcDateReported.get_by_id(europe_date_reported_id) + page_data = EcdcData.find_by_date_reported_notification_rate(europe_date_reported, page) return render_template( 'ecdc/date_reported/europe_date_reported_one_notification_rate.html', europe_date_reported=europe_date_reported, @@ -212,8 +212,8 @@ def url_ecdc_date_reported_one_notification_rate(europe_date_reported_id, page=1 @app_ecdc.route('/date_reported/deaths_weekly/<int:europe_date_reported_id>') def url_ecdc_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) - page_data = EuropeData.find_by_date_reported_deaths_weekly(europe_date_reported, page) + europe_date_reported = EcdcDateReported.get_by_id(europe_date_reported_id) + page_data = EcdcData.find_by_date_reported_deaths_weekly(europe_date_reported, page) return render_template( 'ecdc/date_reported/europe_date_reported_one_deaths_weekly.html', europe_date_reported=europe_date_reported, @@ -225,8 +225,8 @@ def url_ecdc_date_reported_one_deaths_weekly(europe_date_reported_id, page=1): @app_ecdc.route('/date_reported/cases_weekly/<int:europe_date_reported_id>') def url_ecdc_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) - page_data = EuropeData.find_by_date_reported_cases_weekly(europe_date_reported, page) + europe_date_reported = EcdcDateReported.get_by_id(europe_date_reported_id) + page_data = EcdcData.find_by_date_reported_cases_weekly(europe_date_reported, page) return render_template( 'ecdc/date_reported/europe_date_reported_one_cases_weekly.html', europe_date_reported=europe_date_reported, @@ -238,7 +238,7 @@ def url_ecdc_date_reported_one_cases_weekly(europe_date_reported_id, page=1): @app_ecdc.route('/continent/all') def url_ecdc_continent_all(page=1): page_info = ApplicationPage('Europe', "continent") - page_data = EuropeContinent.get_all_as_page(page) + page_data = EcdcContinent.get_all_as_page(page) return render_template( 'ecdc/continent/europe_continent_all.html', page_data=page_data, @@ -249,8 +249,8 @@ def url_ecdc_continent_all(page=1): @app_ecdc.route('/continent/<int:continent_id>') def url_ecdc_continent_one(continent_id, page=1): page_info = ApplicationPage('Europe', "continent") - continent = EuropeContinent.get_by_id(continent_id) - page_data = EuropeCountry.find_by_continent(continent, page) + continent = EcdcContinent.get_by_id(continent_id) + page_data = EcdcCountry.find_by_continent(continent, page) return render_template( 'ecdc/continent/europe_continent_one.html', continent=continent, @@ -262,7 +262,7 @@ def url_ecdc_continent_one(continent_id, page=1): @app_ecdc.route('/country/all') def url_ecdc_country_all(page=1): page_info = ApplicationPage('Europe', "country") - page_data = EuropeCountry.get_all_as_page(page) + page_data = EcdcCountry.get_all_as_page(page) return render_template( 'ecdc/country/europe_country_all.html', page_data=page_data, @@ -273,8 +273,8 @@ def url_ecdc_country_all(page=1): @app_ecdc.route('/country/<int:country_id>') def url_ecdc_country_one(country_id, page=1): page_info = ApplicationPage('Europe', "country") - europe_country = EuropeCountry.get_by_id(country_id) - page_data = EuropeData.find_by_country(europe_country, page) + europe_country = EcdcCountry.get_by_id(country_id) + page_data = EcdcData.find_by_country(europe_country, page) return render_template( 'ecdc/country/europe_country_one.html', europe_country=europe_country, @@ -286,11 +286,11 @@ def url_ecdc_country_one(country_id, page=1): @app_ecdc.route('/country/germany') def url_ecdc_country_germany(page=1): page_info = ApplicationPage('Europe', "country: Germany") - europe_country = EuropeCountry.get_germany() + europe_country = EcdcCountry.get_germany() if europe_country is None: flash('country: Germany not found in Database', category='error') return redirect(url_for('url_ecdc_tasks')) - page_data = EuropeData.find_by_country(europe_country, page) + page_data = EcdcData.find_by_country(europe_country, page) return render_template( 'ecdc/country/europe_country_germany.html', europe_country=europe_country, @@ -301,7 +301,7 @@ def url_ecdc_country_germany(page=1): # TODO remove DEPRECATED @app_ecdc.route('/update/initial') def url_ecdc_task_update_data_DEPRECATED(): - europe_service.download_DEPRECATED() + ecdc_service.download_DEPRECATED() task_ecdc_update_initial_DEPRECATED.apply_async() flash("task_ecdc_update_initial started") return redirect(url_for('url_ecdc_tasks')) @@ -310,7 +310,7 @@ def url_ecdc_task_update_data_DEPRECATED(): # TODO remove DEPRECATED @app_ecdc.route('/update/short') def url_ecdc_task_update_data_short_DEPRECATED(): - europe_service.download_DEPRECATED() + ecdc_service.download_DEPRECATED() task_ecdc_update_short_DEPRECATED.apply_async() flash("task_ecdc_update_short started") return redirect(url_for('url_ecdc_tasks')) diff --git a/src/covid19/blueprints/rki_vaccination/rki_vaccination_views.py b/src/covid19/blueprints/rki_vaccination/rki_vaccination_views.py index 540d7737..d0548d22 100644 --- a/src/covid19/blueprints/rki_vaccination/rki_vaccination_views.py +++ b/src/covid19/blueprints/rki_vaccination/rki_vaccination_views.py @@ -3,11 +3,11 @@ from celery import states from celery.utils.log import get_task_logger from database import app -from covid19.app_services import vaccination_service +from covid19.app_services import rki_vaccination_service from covid19.app_workers import celery -from covid19.blueprints.rki_vaccination.vaccination_model import VaccinationData, VaccinationDateReported -from covid19.blueprints.rki_vaccination.vaccination_model_import import VaccinationImport +from covid19.blueprints.rki_vaccination.rki_vaccination_model import VaccinationData, VaccinationDateReported +from covid19.blueprints.rki_vaccination.rki_vaccination_model_import import VaccinationImport from covid19.blueprints.common.common_model_transient import ApplicationPage @@ -28,7 +28,7 @@ def task_vaccination_download_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_europe_download_only [OK] ") logger.info("------------------------------------------------------------") - vaccination_service.run_download_only() + rki_vaccination_service.run_download_only() self.update_state(state=states.SUCCESS) result = "OK (task_europe_download_only)" return result @@ -41,7 +41,7 @@ def task_vaccination_import_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_europe_import_only [OK] ") logger.info("------------------------------------------------------------") - vaccination_service.run_import_only() + rki_vaccination_service.run_import_only() self.update_state(state=states.SUCCESS) result = "OK (task_europe_import_only)" return result @@ -54,7 +54,7 @@ def task_vaccination_update_dimension_tables_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_europe_update_dimension_tables_only [OK] ") logger.info("------------------------------------------------------------") - vaccination_service.run_update_dimension_tables_only() + rki_vaccination_service.run_update_dimension_tables_only() self.update_state(state=states.SUCCESS) result = "OK (task_europe_update_dimension_tables_only)" return result @@ -67,7 +67,7 @@ def task_vaccination_update_facttable_incremental_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_europe_update_fact_table_incremental_only [OK] ") logger.info("------------------------------------------------------------") - vaccination_service.run_update_fact_table_incremental_only() + rki_vaccination_service.run_update_fact_table_incremental_only() self.update_state(state=states.SUCCESS) result = "OK (task_europe_update_fact_table_incremental_only)" return result @@ -80,7 +80,7 @@ def task_vaccination_update_facttable_initial_only(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_europe_update_fact_table_initial_only [OK] ") logger.info("------------------------------------------------------------") - vaccination_service.run_update_fact_table_initial_only() + rki_vaccination_service.run_update_fact_table_initial_only() self.update_state(state=states.SUCCESS) result = "OK (task_europe_update_fact_table_initial_only)" return result @@ -93,7 +93,7 @@ def task_vaccination_update_starschema_incremental(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_europe_update_star_schema_incremental [OK] ") logger.info("------------------------------------------------------------") - vaccination_service.run_update_star_schema_incremental() + rki_vaccination_service.run_update_star_schema_incremental() self.update_state(state=states.SUCCESS) result = "OK (task_europe_update_star_schema_incremental)" return result @@ -106,13 +106,13 @@ def task_vaccination_task_update_starschema_initial(self): logger.info("------------------------------------------------------------") logger.info(" Received: task_europe_update_star_schema_initial [OK] ") logger.info("------------------------------------------------------------") - vaccination_service.run_update_star_schema_initial() + rki_vaccination_service.run_update_star_schema_initial() self.update_state(state=states.SUCCESS) result = "OK (task_europe_update_star_schema_initial)" return result -@app_rki_vaccination('/info') +@app_rki_vaccination.route('/info') def url_vaccination_info(): page_info = ApplicationPage('Vaccination', "Info") return render_template( @@ -120,7 +120,7 @@ def url_vaccination_info(): page_info=page_info) -@app_rki_vaccination('/tasks') +@app_rki_vaccination.route('/tasks') def url_vaccination_tasks(): page_info = ApplicationPage('Vaccination', "Tasks") return render_template( @@ -128,8 +128,8 @@ def url_vaccination_tasks(): page_info=page_info) -@app_rki_vaccination('/imported/page/<int:page>') -@app_rki_vaccination('/imported') +@app_rki_vaccination.route('/imported/page/<int:page>') +@app_rki_vaccination.route('/imported') def url_vaccination_imported(page=1): page_info = ApplicationPage('Vaccination', "Data: Germany Timeline imported") page_data = VaccinationImport.get_all_as_page(page) @@ -139,8 +139,8 @@ def url_vaccination_imported(page=1): page_info=page_info) -@app_rki_vaccination('/data/page/<int:page>') -@app_rki_vaccination('/data') +@app_rki_vaccination.route('/data/page/<int:page>') +@app_rki_vaccination.route('/data') def url_vaccination_data(page=1): page_info = ApplicationPage('Vaccination', "Data: Germany Timeline") page_data = VaccinationData.get_all_as_page(page) @@ -150,8 +150,8 @@ def url_vaccination_data(page=1): page_info=page_info) -@app_rki_vaccination('/date-reported/all/page/<int:page>') -@app_rki_vaccination('/date-reported/all') +@app_rki_vaccination.route('/date-reported/all/page/<int:page>') +@app_rki_vaccination.route('/date-reported/all') def url_vaccination_datereported_all(page=1): page_info = ApplicationPage('Vaccination', "Germany Timeline") page_data = VaccinationDateReported.get_all_as_page(page) @@ -161,8 +161,8 @@ def url_vaccination_datereported_all(page=1): page_info=page_info) -@app_rki_vaccination('/date-reported/<int:vaccination_date_reported_id>/page/<int:page>') -@app_rki_vaccination('/date-reported/<int:vaccination_date_reported_id>') +@app_rki_vaccination.route('/date-reported/<int:vaccination_date_reported_id>/page/<int:page>') +@app_rki_vaccination.route('/date-reported/<int:vaccination_date_reported_id>') def url_vaccination_datereported_one(page=1, vaccination_date_reported_id=0): page_info = ApplicationPage('Vaccination', "Germany Timeline") datereported = VaccinationDateReported.find_by_id(vaccination_date_reported_id) @@ -174,52 +174,52 @@ def url_vaccination_datereported_one(page=1, vaccination_date_reported_id=0): page_info=page_info) -@app_rki_vaccination('/task/download/only') +@app_rki_vaccination.route('/task/download/only') def url_vaccination_task_download_only(): flash("url_vaccination_task_download_only started") - vaccination_service.run_download_only() + rki_vaccination_service.run_download_only() return redirect(url_for('vaccination.url_vaccination_tasks')) -@app_rki_vaccination('/task/import/only') +@app_rki_vaccination.route('/task/import/only') def url_vaccination_task_import_only(): flash("url_vaccination_task_import_only started") task_vaccination_import_only.apply_async() return redirect(url_for('vaccination.url_vaccination_tasks')) -@app_rki_vaccination('/task/update/dimension-tables/only') +@app_rki_vaccination.route('/task/update/dimension-tables/only') def url_vaccination_task_update_dimensiontables_only(): flash("url_vaccination_task_update_dimensiontables_only started") task_vaccination_update_dimension_tables_only.apply_async() return redirect(url_for('vaccination.url_vaccination_tasks')) -@app_rki_vaccination('/task/update/fact-table/incremental/only') +@app_rki_vaccination.route('/task/update/fact-table/incremental/only') def url_vaccination_task_update_facttable_incremental_only(): flash("url_vaccination_task_update_facttable_incremental_only started") task_vaccination_update_facttable_incremental_only.apply_async() return redirect(url_for('vaccination.url_vaccination_tasks')) -@app_rki_vaccination('/task/update/fact-table/initial/only') +@app_rki_vaccination.route('/task/update/fact-table/initial/only') def url_vaccination_task_update_facttable_initial_only(): flash("url_vaccination_task_update_facttable_initial_only started") task_vaccination_update_facttable_initial_only.apply_async() return redirect(url_for('vaccination.url_vaccination_tasks')) -@app_rki_vaccination('/task/update/star_schema/initial') +@app_rki_vaccination.route('/task/update/star_schema/initial') def url_vaccination_task_update_starschema_initial(): flash("url_vaccination_task_update_star_schemainitial started") - vaccination_service.run_download_only() + rki_vaccination_service.run_download_only() task_vaccination_task_update_starschema_initial.apply_async() return redirect(url_for('vaccination.url_vaccination_tasks')) -@app_rki_vaccination('/task/update/star_schema/incremental') +@app_rki_vaccination.route('/task/update/star_schema/incremental') def url_vaccination_task_update_starschema_incremental(): flash("url_vaccination_task_update_starschema_incremental started") - vaccination_service.run_download_only() + rki_vaccination_service.run_download_only() task_vaccination_update_starschema_incremental.apply_async() return redirect(url_for('vaccination.url_vaccination_tasks')) diff --git a/src/covid19/blueprints/who/who_views.py b/src/covid19/blueprints/who/who_views.py index bea5b920..825dc332 100644 --- a/src/covid19/blueprints/who/who_views.py +++ b/src/covid19/blueprints/who/who_views.py @@ -4,15 +4,15 @@ from celery import states from celery.utils.log import get_task_logger from database import app -from covid19.services import who_service -from covid19.workers import celery +from covid19.app_services import who_service +from covid19.app_workers import celery from covid19.blueprints.who.who_model_import import WhoImport from covid19.blueprints.who.who_model import WhoRegion, WhoCountry, WhoDateReported, WhoData from covid19.blueprints.common.common_model_transient import ApplicationPage -app_who = Blueprint('who', __name__, template_folder='templates') +app_who = Blueprint('who', __name__, template_folder='templates', url_prefix='/who') ################################################################################################################## -- GitLab