From 4c5ec9984ab680cf5321aca7abbbcca217b93fe6 Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Wed, 17 Feb 2021 18:55:43 +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 --- BACKLOG.md | 14 +++++++------- src/covid19/blueprints/ecdc/ecdc_model_import.py | 12 +++++------- src/covid19/blueprints/ecdc/ecdc_service_import.py | 4 +++- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/BACKLOG.md b/BACKLOG.md index 786ba2cf..d6a95c1f 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -186,7 +186,13 @@ ### 0.0.17 Release * ------------------------------------- * Issue #82 change to ORM ClassHierarchy -* Issue #108 change to ORM ClassHierarchy in: EcdcImport.get_countries_of_continent +* 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 @@ -221,12 +227,6 @@ * Issue #155 refactor RkiBundeslaenderServiceUpdate.update_db_initial ### 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 * 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 diff --git a/src/covid19/blueprints/ecdc/ecdc_model_import.py b/src/covid19/blueprints/ecdc/ecdc_model_import.py index 010e1b12..59080e1b 100644 --- a/src/covid19/blueprints/ecdc/ecdc_model_import.py +++ b/src/covid19/blueprints/ecdc/ecdc_model_import.py @@ -6,7 +6,9 @@ class EcdcImport(db.Model): id = db.Column(db.Integer, primary_key=True) date_rep = db.Column(db.String(255), nullable=False) - year_week = db.Column(db.String(255), nullable=False) + day = db.Column(db.String(255), nullable=False) + month = db.Column(db.String(255), nullable=False) + year = db.Column(db.String(255), nullable=False) cases_weekly = db.Column(db.String(255), nullable=False) deaths_weekly = db.Column(db.String(255), nullable=False) pop_data_2019 = db.Column(db.String(255), nullable=False) @@ -26,14 +28,14 @@ class EcdcImport(db.Model): @classmethod def get_all_as_page(cls, page: int): return db.session.query(cls).order_by( - cls.year_week, + #cls.year_week, cls.countries_and_territories ).paginate(page, per_page=ITEMS_PER_PAGE) @classmethod def get_all(cls): return db.session.query(cls).order_by( - cls.year_week, + #cls.year_week, cls.countries_and_territories ).all() @@ -43,7 +45,6 @@ class EcdcImport(db.Model): @classmethod def get_date_rep(cls): - # TODO: #109 SQLalchemy instead of SQL in: EcdcImport.get_date_rep # sql = "select distinct date_rep, year_week from edcd_import order by year_week desc" #return db.session.execute(sql).fetchall() return db.session.query(cls.date_rep) \ @@ -54,7 +55,6 @@ class EcdcImport(db.Model): @classmethod def get_continent(cls): - # TODO: #110 SQLalchemy instead of SQL in: EcdcImport.get_continent # sql = "select distinct continent_exp from edcd_import order by continent_exp asc" #return db.session.execute(sql).fetchall() return db.session.query(cls.continent_exp) \ @@ -68,8 +68,6 @@ class EcdcImport(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: EcdcImport.get_countries_of_continent - #TODO: #108 BUG: change to ORM ClassHierarchy in: EcdcImport.get_countries_of_continent return db.session.query( cls.countries_and_territories, cls.pop_data_2019, diff --git a/src/covid19/blueprints/ecdc/ecdc_service_import.py b/src/covid19/blueprints/ecdc/ecdc_service_import.py index 0f354c5b..c555898d 100644 --- a/src/covid19/blueprints/ecdc/ecdc_service_import.py +++ b/src/covid19/blueprints/ecdc/ecdc_service_import.py @@ -31,7 +31,9 @@ class EcdcServiceImport: for row in file_reader: o = EcdcImport( date_rep=row['dateRep'], - year_week=row['year_week'], + day=row['day'], + month=row['month'], + year=row['year'], cases_weekly=row['cases_weekly'], deaths_weekly=row['deaths_weekly'], countries_and_territories=row['countriesAndTerritories'], -- GitLab