From d782e7c765b6a07e0bae91616bdc800c11105a13 Mon Sep 17 00:00:00 2001
From: thomaswoehlke <thomas.woehlke@gmail.com>
Date: Wed, 17 Feb 2021 20:26:45 +0100
Subject: [PATCH] ### 0.0.17 Release * ------------------------------------- *
 Issue #82 change to ORM ClassHierarchy * Fixed #108 change to ORM
 ClassHierarchy in: EcdcImport.get_countries_of_continent * Fixed #39
 SQLalchemy instead of SQL: AllModelClasses.remove_all() * Fixed #40
 SQLalchemy instead of SQL: EcdcImport.get_date_rep() * Fixed #41 SQLalchemy
 instead of SQL: EcdcImport.get_countries_of_continent() * Fixed #107
 SQLalchemy instead of SQL in: EcdcImport.get_countries_of_continent * Fixed
 #109 SQLalchemy instead of SQL in: EcdcImport.get_date_rep * Fixed #110
 SQLalchemy instead of SQL in: EcdcImport.get_continent *
 ------------------------------------- * Fixed #123 split
 RkiBundeslaenderService into two Services, one for bundeslaender and one for
 landkreise * Fixed #128 add fields from csv to RkiLandkreiseImport * Fixed
 #139 refactor RkiBundeslaenderServiceDownload to new method scheme introduced
 07.02.2021 * Fixed #140 move WhoImport to RKI in: rk_service_import.py *
 Fixed #125 implement RkiLandkreise * Fixed #126 implement
 RkiBundeslaenderImport * 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
 #146 add Tasks and URLs for starting Tasks to rki_views * Issue #127
 implement RkiBundeslaenderImport.get_dates_reported * Issue #132 refactor
 RkiBundeslaenderService to new method scheme introduced 07.02.2021 * Issue
 #133 implement RkiBundeslaenderService.task_database_drop_create * Issue #134
 implement RkiBundeslaenderService.run_update_dimension_tables_only * Issue
 #135 implement RkiBundeslaenderService.run_update_fact_table_incremental_only
 * Issue #136 implement
 RkiBundeslaenderService.run_update_fact_table_initial_only * Issue #137
 implement RkiBundeslaenderService.run_update_star_schema_incremental * Issue
 #138 implement RkiBundeslaenderService.run_update_star_schema_initial * Issue
 #141 implement RkiBundeslaenderServiceUpdate.update_dimension_tables_only *
 Issue #142 implement
 RkiBundeslaenderServiceUpdate.update_fact_table_incremental_only * Issue #143
 implement RkiBundeslaenderServiceUpdate.update_fact_table_initial_only *
 Issue #144 implement
 RkiBundeslaenderServiceUpdate.update_star_schema_incremental * Issue #145
 implement RkiBundeslaenderServiceUpdate.update_star_schema_initial * Issue
 #147 refactor RkiBundeslaenderServiceUpdate.__update_who_date_reported *
 Issue #148 refactor RkiBundeslaenderServiceUpdate.__update_who_region * Issue
 #149 refactor RkiBundeslaenderServiceUpdate.__update_who_country * Issue #150
 refactor RkiBundeslaenderServiceUpdate.__update_who_global_data * Issue #151
 refactor RkiBundeslaenderServiceUpdate.__update_who_global_data_short * Issue
 #152 refactor RkiBundeslaenderServiceUpdate.__update_who_global_data_initial
 * Issue #153 refactor RkiBundeslaenderServiceUpdate.update_db * Issue #154
 refactor RkiBundeslaenderServiceUpdate.update_db_short * Issue #155 refactor
 RkiBundeslaenderServiceUpdate.update_db_initial

### 0.0.18 Release
* 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
---
 src/covid19/blueprints/admin/admin_views.py   | 48 +++++++++++++++----
 .../admin/templates/admin/admin_tasks.html    | 12 +++--
 src/covid19/blueprints/ecdc/ecdc_service.py   |  6 ++-
 .../rki_bundeslaender/rki_service.py          |  6 ++-
 .../blueprints/rki_landkreise/rki_service.py  |  5 +-
 .../rki_vaccination_service.py                |  6 ++-
 src/covid19/blueprints/who/who_service.py     |  6 ++-
 7 files changed, 72 insertions(+), 17 deletions(-)

diff --git a/src/covid19/blueprints/admin/admin_views.py b/src/covid19/blueprints/admin/admin_views.py
index faff39d3..9efb0991 100644
--- a/src/covid19/blueprints/admin/admin_views.py
+++ b/src/covid19/blueprints/admin/admin_views.py
@@ -73,17 +73,37 @@ def task_admin_import_all_files(self):
 
 
 @celery.task(bind=True)
-def task_admin_update_all_blueprints(self):
+def task_admin_update_dimension_tables_only(self):
     logger = get_task_logger(__name__)
     self.update_state(state=states.STARTED)
     logger.info("------------------------------------------------------------")
     logger.info(" task_admin_update_all_blueprints [start] ")
     logger.info("------------------------------------------------------------")
-    who_service.task_update_all_blueprints()
-    ecdc_service.task_update_all_blueprints()
-    rki_vaccination_service.task_update_all_blueprints()
-    rki_service_bundeslaender.task_update_all_blueprints()
-    rki_service_landkreise.task_update_all_blueprints()
+    who_service.update_dimension_tables_only()
+    ecdc_service.update_dimension_tables_only()
+    rki_vaccination_service.update_dimension_tables_only()
+    rki_service_bundeslaender.update_dimension_tables_only()
+    rki_service_landkreise.update_dimension_tables_only()
+    logger.info("------------------------------------------------------------")
+    logger.info(" task_admin_update_all_blueprints [done] ")
+    logger.info("------------------------------------------------------------")
+    self.update_state(state=states.SUCCESS)
+    result = "OK (task_admin_update_all_blueprints)"
+    return result
+
+
+@celery.task(bind=True)
+def task_admin_update_fact_table_initial_only(self):
+    logger = get_task_logger(__name__)
+    self.update_state(state=states.STARTED)
+    logger.info("------------------------------------------------------------")
+    logger.info(" task_admin_update_all_blueprints [start] ")
+    logger.info("------------------------------------------------------------")
+    who_service.update_fact_table_initial_only()
+    ecdc_service.update_fact_table_initial_only()
+    rki_vaccination_service.update_fact_table_initial_only()
+    rki_service_bundeslaender.update_fact_table_initial_only()
+    rki_service_landkreise.update_fact_table_initial_only()
     logger.info("------------------------------------------------------------")
     logger.info(" task_admin_update_all_blueprints [done] ")
     logger.info("------------------------------------------------------------")
@@ -194,11 +214,21 @@ def url_admin_import_all_files():
     return redirect(url_for('app_admin.url_admin_tasks'))
 
 
-@app_admin.route('/update/all')
-def url_admin_update_all_groups():
+@app_admin.route('/update/dimension_tables/all')
+def url_admin_update_dimension_tables_only():
     app.logger.info("url_admin_update_all_groups [start]")
+    task_admin_update_dimension_tables_only.apply_async()
     flash("task_admin_import_all_files async started")
-    task_admin_update_all_blueprints.apply_async()
     app.logger.info("task_admin_update_all_blueprints async started")
     app.logger.info("url_admin_update_all_groups [done]")
     return redirect(url_for('app_admin.url_admin_tasks'))
+
+
+@app_admin.route('/update/fact_tables/all')
+def url_admin_update_fact_table_initial_only():
+    app.logger.info("url_admin_update_fact_table_initial_only [start]")
+    task_admin_update_fact_table_initial_only.apply_async()
+    flash("task_admin_update_fact_table_initial_only async started")
+    app.logger.info("task_admin_update_fact_table_initial_only async started")
+    app.logger.info("url_admin_update_fact_table_initial_only [done]")
+    return redirect(url_for('app_admin.url_admin_tasks'))
diff --git a/src/covid19/blueprints/admin/templates/admin/admin_tasks.html b/src/covid19/blueprints/admin/templates/admin/admin_tasks.html
index 91458175..fd719c5f 100644
--- a/src/covid19/blueprints/admin/templates/admin/admin_tasks.html
+++ b/src/covid19/blueprints/admin/templates/admin/admin_tasks.html
@@ -23,12 +23,18 @@
                     <a class="btn btn-primary btn-lg btn-block text-left"
                        href="{{ url_for( 'app_admin.url_admin_database_dump') }}"
                        role="button">Admin :: database :: dump</a>
-                    <a class="btn btn-warning btn-lg btn-block text-left"
+                    <a class="btn btn-success btn-lg btn-block text-left"
                        href="{{ url_for( 'app_admin.url_admin_download_all_files') }}"
-                       role="button">Admin :: url_admin_download_all_files </a>
+                       role="button">Admin :: download :: all_files </a>
                     <a class="btn btn-info btn-lg btn-block text-left"
                        href="{{ url_for( 'app_admin.url_admin_import_all_files') }}"
-                       role="button">Admin :: url_admin_import_all_files </a>
+                       role="button">Admin :: import :: all_files </a>
+                    <a class="btn btn-warning btn-lg btn-block text-left"
+                       href="{{ url_for( 'app_admin.url_admin_update_dimension_tables_only') }}"
+                       role="button">Admin :: update :: dimension_tables</a>
+                    <a class="btn btn-danger btn-lg btn-block text-left"
+                       href="{{ url_for( 'app_admin.url_admin_update_fact_table_initial_only') }}"
+                       role="button">Admin :: update :: fact_table :: initial</a>
                 </div>
             </div>
         </div>
diff --git a/src/covid19/blueprints/ecdc/ecdc_service.py b/src/covid19/blueprints/ecdc/ecdc_service.py
index 116a54d6..f6752580 100644
--- a/src/covid19/blueprints/ecdc/ecdc_service.py
+++ b/src/covid19/blueprints/ecdc/ecdc_service.py
@@ -66,6 +66,10 @@ class EcdcService:
         self.service_import.import_file()
         return self
 
-    def task_update_all_blueprints(self):
+    def update_dimension_tables_only(self):
         self.service_update.update_dimension_tables_only()
         return self
+
+    def update_fact_table_initial_only(self):
+        self.service_update.update_fact_table_initial_only()
+        return self
diff --git a/src/covid19/blueprints/rki_bundeslaender/rki_service.py b/src/covid19/blueprints/rki_bundeslaender/rki_service.py
index 5032e6ef..362562be 100644
--- a/src/covid19/blueprints/rki_bundeslaender/rki_service.py
+++ b/src/covid19/blueprints/rki_bundeslaender/rki_service.py
@@ -117,6 +117,10 @@ class RkiBundeslaenderService:
         self.service_import.import_file()
         return self
 
-    def task_update_all_blueprints(self):
+    def update_dimension_tables_only(self):
         self.service_update.update_dimension_tables_only()
         return self
+
+    def update_fact_table_initial_only(self):
+        self.service_update.update_fact_table_initial_only()
+        return self
diff --git a/src/covid19/blueprints/rki_landkreise/rki_service.py b/src/covid19/blueprints/rki_landkreise/rki_service.py
index b10e74e1..17b11e1e 100644
--- a/src/covid19/blueprints/rki_landkreise/rki_service.py
+++ b/src/covid19/blueprints/rki_landkreise/rki_service.py
@@ -116,7 +116,10 @@ class RkiLandkreiseService:
         self.service_import.import_file()
         return self
 
-    def task_update_all_blueprints(self):
+    def update_dimension_tables_only(self):
         self.service_update.update_dimension_tables_only()
         return self
 
+    def update_fact_table_initial_only(self):
+        self.service_update.update_fact_table_initial_only()
+        return self
diff --git a/src/covid19/blueprints/rki_vaccination/rki_vaccination_service.py b/src/covid19/blueprints/rki_vaccination/rki_vaccination_service.py
index 706f4c1f..a5704f46 100644
--- a/src/covid19/blueprints/rki_vaccination/rki_vaccination_service.py
+++ b/src/covid19/blueprints/rki_vaccination/rki_vaccination_service.py
@@ -67,6 +67,10 @@ class RkiVaccinationService:
         self.service_import.import_file()
         return self
 
-    def task_update_all_blueprints(self):
+    def update_dimension_tables_only(self):
         self.service_update.update_dimension_tables_only()
         return self
+
+    def update_fact_table_initial_only(self):
+        self.service_update.update_fact_table_initial_only()
+        return self
diff --git a/src/covid19/blueprints/who/who_service.py b/src/covid19/blueprints/who/who_service.py
index 7eb1ec6d..420548af 100644
--- a/src/covid19/blueprints/who/who_service.py
+++ b/src/covid19/blueprints/who/who_service.py
@@ -110,6 +110,10 @@ class WhoService:
         self.service_import.import_file()
         return self
 
-    def task_update_all_blueprints(self):
+    def update_dimension_tables_only(self):
         self.service_update.update_dimension_tables_only()
         return self
+
+    def update_fact_table_initial_only(self):
+        self.service_update.update_fact_table_initial_only()
+        return self
-- 
GitLab