From e25695a1e7f06cbd19101a742f1373f03dfe5b63 Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Thu, 20 May 2021 15:25:49 +0200 Subject: [PATCH] Refactoring: rename covid19 to flask_covid19 --- src/flask_covid19/blueprints/data_divi/divi_model.py | 6 ++++-- src/flask_covid19/blueprints/data_ecdc/ecdc_model.py | 6 ++++-- .../blueprints/data_ecdc/ecdc_model_import.py | 4 ++-- src/flask_covid19/blueprints/data_owid/owid_model.py | 7 ++++--- .../blueprints/data_owid/owid_model_import.py | 4 ++-- src/flask_covid19/blueprints/data_rki_cases/rki_model.py | 6 ++++-- .../blueprints/data_rki_cases/rki_model_import.py | 4 ++-- .../data_rki_vaccination/rki_vaccination_model.py | 6 ++++-- .../data_rki_vaccination/rki_vaccination_model_import.py | 4 ++-- src/flask_covid19/blueprints/data_who/who_model.py | 6 ++++-- src/flask_covid19/blueprints/data_who/who_model_import.py | 4 ++-- 11 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/flask_covid19/blueprints/data_divi/divi_model.py b/src/flask_covid19/blueprints/data_divi/divi_model.py index 91d62b3c..01a5c500 100644 --- a/src/flask_covid19/blueprints/data_divi/divi_model.py +++ b/src/flask_covid19/blueprints/data_divi/divi_model.py @@ -13,14 +13,16 @@ class DiviDateReported(BlueprintDateReported): ) id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) day_of_month = db.Column(db.Integer, nullable=False) day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) + day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) + year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) @classmethod def create_new_object_factory(cls, my_date_rep): diff --git a/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py b/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py index 5cab360b..7202a44b 100644 --- a/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py +++ b/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py @@ -11,14 +11,16 @@ class EcdcDateReported(BlueprintDateReported): ) id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) day_of_month = db.Column(db.Integer, nullable=False) day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) + day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) + year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) def get_name_for_datum(self): return self.date_reported_import_str diff --git a/src/flask_covid19/blueprints/data_ecdc/ecdc_model_import.py b/src/flask_covid19/blueprints/data_ecdc/ecdc_model_import.py index a4db66af..dd7b231d 100644 --- a/src/flask_covid19/blueprints/data_ecdc/ecdc_model_import.py +++ b/src/flask_covid19/blueprints/data_ecdc/ecdc_model_import.py @@ -124,8 +124,6 @@ class EcdcFlat(db.Model): __tablename__ = 'application__import__ecdc_flat' id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) @@ -133,7 +131,9 @@ class EcdcFlat(db.Model): day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) location = db.Column(db.String(255), nullable=False) location_group = db.Column(db.String(255), nullable=False) date_rep = db.Column(db.String(255), nullable=False) diff --git a/src/flask_covid19/blueprints/data_owid/owid_model.py b/src/flask_covid19/blueprints/data_owid/owid_model.py index 23add262..d48a8707 100644 --- a/src/flask_covid19/blueprints/data_owid/owid_model.py +++ b/src/flask_covid19/blueprints/data_owid/owid_model.py @@ -29,15 +29,16 @@ class OwidDateReported(BlueprintDateReported): id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) day_of_month = db.Column(db.Integer, nullable=False) day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) - processed = db.Column(db.BOOLEAN, nullable=False) + day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) + year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) def get_sql_notion(self): result = str(self.year) diff --git a/src/flask_covid19/blueprints/data_owid/owid_model_import.py b/src/flask_covid19/blueprints/data_owid/owid_model_import.py index 28304e75..25aedb3a 100644 --- a/src/flask_covid19/blueprints/data_owid/owid_model_import.py +++ b/src/flask_covid19/blueprints/data_owid/owid_model_import.py @@ -284,8 +284,6 @@ class OwidFlat(db.Model): __tablename__ = 'application__import__owid_flat' id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) @@ -293,7 +291,9 @@ class OwidFlat(db.Model): day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) location = db.Column(db.String(255), nullable=False) location_group = db.Column(db.String(255), nullable=False) iso_code = db.Column(db.String(255), nullable=False) diff --git a/src/flask_covid19/blueprints/data_rki_cases/rki_model.py b/src/flask_covid19/blueprints/data_rki_cases/rki_model.py index 192e6b7f..0d843668 100644 --- a/src/flask_covid19/blueprints/data_rki_cases/rki_model.py +++ b/src/flask_covid19/blueprints/data_rki_cases/rki_model.py @@ -13,14 +13,16 @@ class RkiMeldedatum(BlueprintDateReported): ) id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) day_of_month = db.Column(db.Integer, nullable=False) day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) + day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) + year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) @classmethod def create_new_object_factory(cls, my_date_rep): diff --git a/src/flask_covid19/blueprints/data_rki_cases/rki_model_import.py b/src/flask_covid19/blueprints/data_rki_cases/rki_model_import.py index 98b8508b..6d915020 100644 --- a/src/flask_covid19/blueprints/data_rki_cases/rki_model_import.py +++ b/src/flask_covid19/blueprints/data_rki_cases/rki_model_import.py @@ -60,8 +60,6 @@ class RkiFlat(db.Model): __tablename__ = 'application__import__rki_cases_flat' id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) @@ -69,7 +67,9 @@ class RkiFlat(db.Model): day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) location = db.Column(db.String(255), nullable=False) location_group = db.Column(db.String(255), nullable=False) fid = db.Column(db.String(255), nullable=False) diff --git a/src/flask_covid19/blueprints/data_rki_vaccination/rki_vaccination_model.py b/src/flask_covid19/blueprints/data_rki_vaccination/rki_vaccination_model.py index fed40000..4f4da79f 100644 --- a/src/flask_covid19/blueprints/data_rki_vaccination/rki_vaccination_model.py +++ b/src/flask_covid19/blueprints/data_rki_vaccination/rki_vaccination_model.py @@ -14,14 +14,16 @@ class RkiVaccinationDateReported(BlueprintDateReported): ) id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) day_of_month = db.Column(db.Integer, nullable=False) day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) + day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) + year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) @classmethod def create_new_object_factory(cls, my_date_rep: str): diff --git a/src/flask_covid19/blueprints/data_rki_vaccination/rki_vaccination_model_import.py b/src/flask_covid19/blueprints/data_rki_vaccination/rki_vaccination_model_import.py index 99bc5f1e..f58d9ddc 100644 --- a/src/flask_covid19/blueprints/data_rki_vaccination/rki_vaccination_model_import.py +++ b/src/flask_covid19/blueprints/data_rki_vaccination/rki_vaccination_model_import.py @@ -125,8 +125,6 @@ class RkiVaccinationFlat(db.Model): __tablename__ = 'application__import__rki_vaccination_flat' id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) @@ -134,7 +132,9 @@ class RkiVaccinationFlat(db.Model): day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) location = db.Column(db.String(255), nullable=False) location_group = db.Column(db.String(255), nullable=False) dosen_kumulativ = db.Column(db.Integer, nullable=False) diff --git a/src/flask_covid19/blueprints/data_who/who_model.py b/src/flask_covid19/blueprints/data_who/who_model.py index e22b4fc8..e814d3e4 100644 --- a/src/flask_covid19/blueprints/data_who/who_model.py +++ b/src/flask_covid19/blueprints/data_who/who_model.py @@ -13,14 +13,16 @@ class WhoDateReported(BlueprintDateReported): ) id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) day_of_month = db.Column(db.Integer, nullable=False) day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) + day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) + year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) @classmethod def create_new_object_factory(cls, my_date_rep): diff --git a/src/flask_covid19/blueprints/data_who/who_model_import.py b/src/flask_covid19/blueprints/data_who/who_model_import.py index a8217130..50cea993 100644 --- a/src/flask_covid19/blueprints/data_who/who_model_import.py +++ b/src/flask_covid19/blueprints/data_who/who_model_import.py @@ -177,8 +177,6 @@ class WhoFlat(db.Model): __tablename__ = 'application__import__who_flat' id = db.Column(db.Integer, primary_key=True) - date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) - year_week = db.Column(db.String(255), nullable=False) datum = db.Column(db.Date, nullable=False, unique=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nullable=False) @@ -186,7 +184,9 @@ class WhoFlat(db.Model): day_of_week = db.Column(db.Integer, nullable=False) week_of_year = db.Column(db.Integer, nullable=False) day_of_year = db.Column(db.Integer, nullable=True) + year_week = db.Column(db.String(255), nullable=False) year_day_of_year = db.Column(db.String(255), nullable=True, unique=True) + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) location = db.Column(db.String(255), nullable=False) location_group = db.Column(db.String(255), nullable=False) new_cases = db.Column(db.String(255), nullable=False) -- GitLab