diff --git a/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py b/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py index a8cb98c47f67dd0abae2dd4154c1bb587e755f16..2d8ec55b0ed3031a125b975d048d4cd615e3fa38 100644 --- a/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py +++ b/src/flask_covid19/blueprints/data_ecdc/ecdc_model.py @@ -130,9 +130,14 @@ class EcdcCountry(BlueprintLocation): ), ) + def __str__(self): + return " " + self.location_group.location_group \ + + " : " + self.location_code \ + + " | " + self.location \ + + " | " + self.pop_data_2019 \ + + " | " + self.geo_id + id = db.Column(db.Integer, primary_key=True) - pop_data_2019 = db.Column(db.String(255), nullable=False) - geo_id = db.Column(db.String(255), nullable=False) # country_territory_code = db.Column(db.String(255), nullable=False) location_code = db.Column(db.String(255), nullable=True) # countries_and_territories = db.Column(db.String(255), nullable=False) @@ -145,13 +150,8 @@ class EcdcCountry(BlueprintLocation): ) processed_update = db.Column(db.Boolean, nullable=False) processed_full_update = db.Column(db.Boolean, nullable=False) - - def __str__(self): - return " " + self.location_code \ - + " | " + self.location \ - + " | " + self.pop_data_2019 \ - + " | " + self.geo_id \ - + " -> " + self.location_group.location_group + pop_data_2019 = db.Column(db.String(255), nullable=False) + geo_id = db.Column(db.String(255), nullable=False) @classmethod def remove_all(cls): @@ -235,25 +235,24 @@ class EcdcData(BlueprintFactTable): __mapper_args__ = {'concrete': True} id = db.Column(db.Integer, primary_key=True) - deaths = db.Column(db.Integer, nullable=False) - cases = db.Column(db.Integer, nullable=False) - cumulative_number_for_14_days_of_covid19_cases_per_100000 = db.Column(db.Float, nullable=False) date_reported_id = db.Column(db.Integer, db.ForeignKey('ecdc_date_reported.id'), nullable=False) date_reported = db.relationship( 'EcdcDateReported', lazy='joined', cascade='save-update', - order_by='desc(EcdcDateReported.datum)' - ) + order_by='desc(OwidDateReported.datum)') location_id = db.Column(db.Integer, db.ForeignKey('ecdc_country.id'), nullable=False) location = db.relationship( 'EcdcCountry', - lazy='subquery', + lazy='joined', cascade='save-update', - order_by='asc(EcdcCountry.location)' - ) + order_by='asc(EcdcDateReported.location)') processed_update = db.Column(db.Boolean, nullable=False) processed_full_update = db.Column(db.Boolean, nullable=False) + # + deaths = db.Column(db.Integer, nullable=False) + cases = db.Column(db.Integer, nullable=False) + cumulative_number_for_14_days_of_covid19_cases_per_100000 = db.Column(db.Float, nullable=False) @classmethod def remove_all(cls): diff --git a/src/flask_covid19/blueprints/data_owid/owid_model.py b/src/flask_covid19/blueprints/data_owid/owid_model.py index a86be3787647955d4a83845a77281dc0fd1c9efa..45ea99fc4de880f169194b6bb3ce4e65cdd7bdfc 100644 --- a/src/flask_covid19/blueprints/data_owid/owid_model.py +++ b/src/flask_covid19/blueprints/data_owid/owid_model.py @@ -180,20 +180,21 @@ class OwidData(BlueprintFactTable): __mapper_args__ = {'concrete': True} id = db.Column(db.Integer, primary_key=True) - date_reported_id = db.Column(db.Integer, - db.ForeignKey('owid_date_reported.id'), nullable=False) + date_reported_id = db.Column(db.Integer, db.ForeignKey('owid_date_reported.id'), nullable=False) date_reported = db.relationship( 'OwidDateReported', lazy='joined', cascade='save-update', - order_by='desc(OwidDateReported.date_reported_import_str)') - country_id = db.Column(db.Integer, - db.ForeignKey('owid_country.id'), nullable=False) - country = db.relationship( + order_by='desc(OwidDateReported.datum)') + location_id = db.Column(db.Integer, db.ForeignKey('owid_country.id'), nullable=False) + location = db.relationship( 'OwidCountry', lazy='joined', cascade='save-update', - order_by='desc(OwidCountry.location)') + order_by='asc(OwidCountry.location)') + processed_update = db.Column(db.Boolean, nullable=False) + processed_full_update = db.Column(db.Boolean, nullable=False) + # total_cases = db.Column(db.String(255), nullable=False) new_cases = db.Column(db.String(255), nullable=False) new_cases_smoothed = db.Column(db.String(255), nullable=False) @@ -234,8 +235,6 @@ class OwidData(BlueprintFactTable): people_fully_vaccinated_per_hundred = db.Column(db.String(255), nullable=False) new_vaccinations_smoothed_per_million = db.Column(db.String(255), nullable=False) stringency_index = db.Column(db.String(255), nullable=False) - processed_update = db.Column(db.Boolean, nullable=False) - processed_full_update = db.Column(db.Boolean, nullable=False) @classmethod def delete_all_data_for_country(cls, owid_country_one): diff --git a/src/flask_covid19/blueprints/data_rki/rki_model.py b/src/flask_covid19/blueprints/data_rki/rki_model.py index 2615364b44d68e07b2705278ede751fd331fb30e..48bb7b14af066f663ff1fd52bf463d23368b7ebd 100644 --- a/src/flask_covid19/blueprints/data_rki/rki_model.py +++ b/src/flask_covid19/blueprints/data_rki/rki_model.py @@ -182,6 +182,22 @@ class RkiData(BlueprintFactTable): __mapper_args__ = {'concrete': True} id = db.Column(db.Integer, primary_key=True) + # + date_reported_id = db.Column(db.Integer, db.ForeignKey('rki_date_reported.id'), nullable=False) + date_reported = db.relationship( + 'RkiMeldedatum', + lazy='joined', + cascade='save-update', + order_by='desc(RkiMeldedatum.datum)') + location_id = db.Column(db.Integer, db.ForeignKey('rki_landkreis.id'), nullable=False) + location = db.relationship( + 'RkiLandkreis', + lazy='joined', + cascade='save-update', + order_by='asc(RkiLandkreis.location)') + processed_update = db.Column(db.Boolean, nullable=False) + processed_full_update = db.Column(db.Boolean, nullable=False) + # fid = db.Column(db.String(255), nullable=False) altersgruppe = db.Column(db.String(255), nullable=False) geschlecht = db.Column(db.String(255), nullable=False) @@ -196,20 +212,6 @@ class RkiData(BlueprintFactTable): anzahl_genesen = db.Column(db.String(255), nullable=False) ist_erkrankungsbeginn = db.Column(db.String(255), nullable=False) altersgruppe2 = db.Column(db.String(255), nullable=False) - meldedatum_id = db.Column(db.Integer, db.ForeignKey('rki_date_reported.id'), nullable=False) - meldedatum = db.relationship( - 'RkiMeldedatum', - lazy='joined', - cascade='save-update', - order_by='desc(RkiMeldedatum.datum)') - landkreis_id = db.Column(db.Integer, db.ForeignKey('rki_landkreis.id'), nullable=False) - landkreis = db.relationship( - 'RkiLandkreis', - lazy='joined', - cascade='save-update', - order_by='asc(RkiLandkreis.location)') - processed_update = db.Column(db.Boolean, nullable=False) - processed_full_update = db.Column(db.Boolean, nullable=False) @classmethod def remove_all(cls):