From 8b631bb5d34586aa6d66dcc0aa0f796e1acbee0b Mon Sep 17 00:00:00 2001
From: thomaswoehlke <thomas.woehlke@gmail.com>
Date: Mon, 15 Feb 2021 00:12:19 +0100
Subject: [PATCH] ### 0.0.17 Release * 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

### 0.0.18 Release
* 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
---
 .../rki_vaccination_service_update.py         | 59 +++++++++----------
 1 file changed, 29 insertions(+), 30 deletions(-)

diff --git a/src/covid19/blueprints/rki_vaccination/rki_vaccination_service_update.py b/src/covid19/blueprints/rki_vaccination/rki_vaccination_service_update.py
index 3935b8f7..2d5db204 100644
--- a/src/covid19/blueprints/rki_vaccination/rki_vaccination_service_update.py
+++ b/src/covid19/blueprints/rki_vaccination/rki_vaccination_service_update.py
@@ -84,47 +84,46 @@ class RkiVaccinationServiceUpdate:
         return self
 
     def __update_fact_table_incremental(self):
-        app.logger.info(" __update_data_initial Vaccination [begin]")
+        app.logger.info(" __update_fact_table_incremental Vaccination [begin]")
         app.logger.info("------------------------------------------------------------")
         result_date_rep = RkiVaccinationImport.get_daterep_missing_in_vaccination_data()
         i = 0
         for item_date_rep in result_date_rep:
-            europe_date_reported = RkiVaccinationDateReported.create_new_object_factory(item_date_rep)
-            result_europe_data_import = RkiVaccinationImport.find_by_datum(europe_date_reported)
-            for item_europe_data_import in result_europe_data_import:
+            date_reported = RkiVaccinationDateReported.find_by_date_reported(item_date_rep)
+            #date_reported = RkiVaccinationDateReported.create_new_object_factory(item_date_rep)
+            result_data_import = RkiVaccinationImport.find_by_datum(item_date_rep)
+            for item_data_import in result_data_import:
                 o = RkiVaccinationData(
-                    date_reported=europe_date_reported,
-                    dosen_kumulativ=item_europe_data_import.dosen_kumulativ,
-                    dosen_differenz_zum_vortag=item_europe_data_import.dosen_differenz_zum_vortag,
-                    dosen_biontech_kumulativ=item_europe_data_import.dosen_biontech_kumulativ,
-                    dosen_moderna_kumulativ=item_europe_data_import.dosen_moderna_kumulativ,
-                    personen_erst_kumulativ=item_europe_data_import.personen_erst_kumulativ,
-                    personen_voll_kumulativ=item_europe_data_import.personen_voll_kumulativ,
-                    impf_quote_erst=item_europe_data_import.impf_quote_erst,
-                    impf_quote_voll=item_europe_data_import.impf_quote_voll,
-                    indikation_alter_dosen=item_europe_data_import.indikation_alter_dosen,
-                    indikation_beruf_dosen=item_europe_data_import.indikation_beruf_dosen,
-                    indikation_medizinisch_dosen=item_europe_data_import.indikation_medizinisch_dosen,
-                    indikation_pflegeheim_dosen=item_europe_data_import.indikation_pflegeheim_dosen,
-                    indikation_alter_erst=item_europe_data_import.indikation_alter_erst,
-                    indikation_beruf_erst=item_europe_data_import.indikation_beruf_erst,
-                    indikation_medizinisch_erst=item_europe_data_import.indikation_medizinisch_erst,
-                    indikation_pflegeheim_erst=item_europe_data_import.indikation_pflegeheim_erst,
-                    indikation_alter_voll=item_europe_data_import.indikation_alter_voll,
-                    indikation_beruf_voll=item_europe_data_import.indikation_beruf_voll,
-                    indikation_medizinisch_voll=item_europe_data_import.indikation_medizinisch_voll,
-                    indikation_pflegeheim_voll=item_europe_data_import.indikation_pflegeheim_voll
+                    date_reported=date_reported,
+                    dosen_kumulativ=item_data_import.dosen_kumulativ,
+                    dosen_differenz_zum_vortag=item_data_import.dosen_differenz_zum_vortag,
+                    dosen_biontech_kumulativ=item_data_import.dosen_biontech_kumulativ,
+                    dosen_moderna_kumulativ=item_data_import.dosen_moderna_kumulativ,
+                    personen_erst_kumulativ=item_data_import.personen_erst_kumulativ,
+                    personen_voll_kumulativ=item_data_import.personen_voll_kumulativ,
+                    impf_quote_erst=item_data_import.impf_quote_erst,
+                    impf_quote_voll=item_data_import.impf_quote_voll,
+                    indikation_alter_dosen=item_data_import.indikation_alter_dosen,
+                    indikation_beruf_dosen=item_data_import.indikation_beruf_dosen,
+                    indikation_medizinisch_dosen=item_data_import.indikation_medizinisch_dosen,
+                    indikation_pflegeheim_dosen=item_data_import.indikation_pflegeheim_dosen,
+                    indikation_alter_erst=item_data_import.indikation_alter_erst,
+                    indikation_beruf_erst=item_data_import.indikation_beruf_erst,
+                    indikation_medizinisch_erst=item_data_import.indikation_medizinisch_erst,
+                    indikation_pflegeheim_erst=item_data_import.indikation_pflegeheim_erst,
+                    indikation_alter_voll=item_data_import.indikation_alter_voll,
+                    indikation_beruf_voll=item_data_import.indikation_beruf_voll,
+                    indikation_medizinisch_voll=item_data_import.indikation_medizinisch_voll,
+                    indikation_pflegeheim_voll=item_data_import.indikation_pflegeheim_voll
                 )
                 db.session.add(o)
-                item_europe_data_import.row_imported = True
-                db.session.add(item_europe_data_import)
                 i += 1
                 if i % 500 == 0:
-                    app.logger.info(" update Vaccination initial ... " + str(i) + " rows")
+                    app.logger.info(" update Vaccination incremental ... " + str(i) + " rows")
                     db.session.commit()
         db.session.commit()
-        app.logger.info(" update Vaccination initial ... " + str(i) + " rows total")
-        app.logger.info(" __update_data_initial Vaccination [done]")
+        app.logger.info(" update Vaccination incremental ... " + str(i) + " rows total")
+        app.logger.info(" __update_fact_table_incremental Vaccination [done]")
         app.logger.info("------------------------------------------------------------")
         return self
 
-- 
GitLab