From 4b2428783e2ae8a56faffbbf0c6fb711d062f2cc Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Tue, 25 May 2021 12:22:25 +0200 Subject: [PATCH] Refactoring: vaccination --- .../blueprints/app_all/all_service_download.py | 7 +++---- src/flask_covid19/blueprints/data_divi/divi_service.py | 3 +-- src/flask_covid19/blueprints/data_divi/divi_views.py | 2 +- src/flask_covid19/blueprints/data_ecdc/ecdc_service.py | 2 +- src/flask_covid19/blueprints/data_owid/owid_service.py | 2 +- src/flask_covid19/blueprints/data_rki/rki_service.py | 2 +- .../blueprints/data_vaccination/vaccination_service.py | 2 +- src/flask_covid19/blueprints/data_who/who_service.py | 4 ++-- 8 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/flask_covid19/blueprints/app_all/all_service_download.py b/src/flask_covid19/blueprints/app_all/all_service_download.py index 899c705e..58f45646 100644 --- a/src/flask_covid19/blueprints/app_all/all_service_download.py +++ b/src/flask_covid19/blueprints/app_all/all_service_download.py @@ -18,7 +18,6 @@ class BlueprintDownloadService: def __prepare_download(self): os.makedirs(self.cfg.data_path, exist_ok=True) if os.path.isfile(self.cfg.cvsfile_path): - # TODO make backup of oldfile os.remove(self.cfg.cvsfile_path) return self @@ -46,8 +45,8 @@ class BlueprintDownloadService: os.chdir(orig_workdir) return self - def download_file(self): - app.logger.info(" download_file - [begin] ") + def download(self): + app.logger.info(" download - [begin] ") app.logger.info("------------------------------------------------------------") app.logger.info(self.cfg.msg_job) app.logger.info(os.getcwd()) @@ -72,5 +71,5 @@ class BlueprintDownloadService: app.logger.error(exception) finally: app.logger.info("------------------------------------------------------------") - app.logger.info(" download_file - [done] ") + app.logger.info(" download - [done] ") return self diff --git a/src/flask_covid19/blueprints/data_divi/divi_service.py b/src/flask_covid19/blueprints/data_divi/divi_service.py index 0eae3748..bf79aa99 100644 --- a/src/flask_covid19/blueprints/data_divi/divi_service.py +++ b/src/flask_covid19/blueprints/data_divi/divi_service.py @@ -25,8 +25,7 @@ class DiviService: def download(self): flash("DiviService.download [start]") - # TODO self.service_download.download() - self.service_download.download_file() + self.service_download.download() flash("DiviService.download [done]") return self diff --git a/src/flask_covid19/blueprints/data_divi/divi_views.py b/src/flask_covid19/blueprints/data_divi/divi_views.py index 6171d9a3..a4b4335c 100644 --- a/src/flask_covid19/blueprints/data_divi/divi_views.py +++ b/src/flask_covid19/blueprints/data_divi/divi_views.py @@ -561,7 +561,7 @@ def url_task_divi_update_fact_table(): def url_task_divi_full_update_star_schema(): app.logger.info("url_task_divi_full_update_star_schema [start]") divi_service.download() - flash("divi_service.service_download.download_file ok") + flash("divi_service.service_download.download ok") task_divi_full_update_star_schema.apply_async() flash("task_divi_full_update_star_schema started") flash(message="long running background task started", category="warning") diff --git a/src/flask_covid19/blueprints/data_ecdc/ecdc_service.py b/src/flask_covid19/blueprints/data_ecdc/ecdc_service.py index dab6625a..a0b0ae95 100644 --- a/src/flask_covid19/blueprints/data_ecdc/ecdc_service.py +++ b/src/flask_covid19/blueprints/data_ecdc/ecdc_service.py @@ -25,7 +25,7 @@ class EcdcService: def download(self): flash("EcdcService.download [start]") # TODO self.service_download.download() - self.service_download.download_file() + self.service_download.download() flash("EcdcService.download [start]") return self diff --git a/src/flask_covid19/blueprints/data_owid/owid_service.py b/src/flask_covid19/blueprints/data_owid/owid_service.py index 33dcb49b..f80b3539 100644 --- a/src/flask_covid19/blueprints/data_owid/owid_service.py +++ b/src/flask_covid19/blueprints/data_owid/owid_service.py @@ -25,7 +25,7 @@ class OwidService: def download(self): flash("OwidService.download [start]") # TODO self.service_download.download() - self.service_download.download_file() + self.service_download.download() flash("OwidService.download [done]") return self diff --git a/src/flask_covid19/blueprints/data_rki/rki_service.py b/src/flask_covid19/blueprints/data_rki/rki_service.py index 6e16cee6..82dc89bd 100644 --- a/src/flask_covid19/blueprints/data_rki/rki_service.py +++ b/src/flask_covid19/blueprints/data_rki/rki_service.py @@ -23,7 +23,7 @@ class RkiService: def download(self): flash("RkiService.download [start]") - self.service_download.download_file() + self.service_download.download() flash("RkiService.download [done]") return self diff --git a/src/flask_covid19/blueprints/data_vaccination/vaccination_service.py b/src/flask_covid19/blueprints/data_vaccination/vaccination_service.py index 9d9d30fc..6d7332c5 100644 --- a/src/flask_covid19/blueprints/data_vaccination/vaccination_service.py +++ b/src/flask_covid19/blueprints/data_vaccination/vaccination_service.py @@ -24,7 +24,7 @@ class VaccinationService: def download(self): flash("VaccinationService.download [start]") - self.service_download.download_file() + self.service_download.download() flash("VaccinationService.download [done]") return self diff --git a/src/flask_covid19/blueprints/data_who/who_service.py b/src/flask_covid19/blueprints/data_who/who_service.py index c4c23ae6..c81f46a0 100644 --- a/src/flask_covid19/blueprints/data_who/who_service.py +++ b/src/flask_covid19/blueprints/data_who/who_service.py @@ -24,7 +24,7 @@ class WhoService: def database_drop_create_pretask(self): flash("WhoService.database_drop_create_pretask [start]") app.logger.info("WhoService.pretask_database_drop_create [start]") - self.service_download.download_file() + self.service_download.download() app.logger.info("WhoService.pretask_database_drop_create [done]") flash("WhoService.database_drop_create_pretask [done]") return self @@ -39,7 +39,7 @@ class WhoService: def download(self): flash("WhoService.download [start]") - self.service_download.download_file() + self.service_download.download() flash("WhoService.download [done]") return self -- GitLab