diff --git a/data b/data index 0c36437db80b435a30df37911b6ca241295c17e8..0996f5d2122468fdcab368abd2175701b2307bbf 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 0c36437db80b435a30df37911b6ca241295c17e8 +Subproject commit 0996f5d2122468fdcab368abd2175701b2307bbf diff --git a/src/flask_covid19/blueprints/app_all/all_model.py b/src/flask_covid19/blueprints/app_all/all_model.py index 2085e5fd6b9d04cf35b436f151e30b3e7eee74d6..15f9b5daabc80f5850dad5e9afaf31a63c6b9713 100644 --- a/src/flask_covid19/blueprints/app_all/all_model.py +++ b/src/flask_covid19/blueprints/app_all/all_model.py @@ -151,7 +151,7 @@ class BlueprintDateReported(BlueprintEntity): @classmethod def get_joungest_datum(cls): return db.session.query(cls)\ - .order_by(cls.date_reported_import_str.desc())\ + .order_by(cls.datum.desc())\ .first() @classmethod @@ -161,6 +161,10 @@ class BlueprintDateReported(BlueprintEntity): db.session.commit() return None + @classmethod + def find_all(cls): + return db.session.query(cls).order_by(cls.datum.desc()).all() + @classmethod def find_all_as_dict(cls): dates_reported = {} @@ -201,6 +205,23 @@ class BlueprintLocationGroup(BlueprintEntity): .filter(cls.location_group == location_group) \ .one_or_none() + @classmethod + def get_all_as_page(cls, page: int): + return db.session.query(cls)\ + .order_by(cls.location_group)\ + .paginate(page, per_page=ITEMS_PER_PAGE) + + @classmethod + def find_all(cls): + return db.session.query(cls).order_by(cls.location_group).all() + + @classmethod + def find_all_as_dict(cls): + dates_reported = {} + for my_location_group in cls.find_all(): + dates_reported[my_location_group.location_group] = my_location_group + return dates_reported + class BlueprintLocation(BlueprintEntity): __tablename__ = 'all_location' @@ -226,42 +247,39 @@ class BlueprintLocation(BlueprintEntity): @classmethod def find_by_location_code(cls, location_code: str): - return db.session.query(cls).filter( - cls.location_code == location_code - ).one_or_none() + return db.session.query(cls).filter(cls.location_code == location_code)\ + .one_or_none() @classmethod def get_by_location_code(cls, location_code: str): - return db.session.query(cls).filter( - cls.location_code == location_code - ).one() + return db.session.query(cls).filter(cls.location_code == location_code)\ + .one() @classmethod def find_by_location(cls, location: str): - return db.session.query(cls).filter( - cls.location == location - ).one_or_none() + return db.session.query(cls).filter(cls.location == location)\ + .one_or_none() @classmethod def get_by_location(cls, location: str): - return db.session.query(cls).filter( - cls.location == location - ).one() + return db.session.query(cls).filter(cls.location == location)\ + .one() @classmethod def find_by_location_group(cls, location_group: BlueprintLocationGroup): - return db.session.query(cls).filter( - cls.location_group == location_group - ).order_by(cls.location).all() + return db.session.query(cls).filter(cls.location_group == location_group)\ + .order_by(cls.location)\ + .all() @classmethod def get_by_location_group(cls, location_group: BlueprintLocationGroup, page: int): - return db.session.query(cls).filter( - cls.location_group == location_group - ).order_by(cls.location).paginate(page, per_page=ITEMS_PER_PAGE) + return db.session.query(cls).filter(cls.location_group == location_group)\ + .order_by(cls.location)\ + .paginate(page, per_page=ITEMS_PER_PAGE) @classmethod - def find_by_location_code_and_location_and_location_group(cls, location_code: str, location: str, location_group: BlueprintLocationGroup): + def find_by_location_code_and_location_and_location_group(cls, location_code: str, location: str, + location_group: BlueprintLocationGroup): return db.session.query(cls).filter( and_( cls.location_code == location_code, @@ -271,7 +289,8 @@ class BlueprintLocation(BlueprintEntity): ).one_or_none() @classmethod - def get_by_location_code_and_location_and_location_group(cls, location_code: str, location: str, location_group: BlueprintLocationGroup): + def get_by_location_code_and_location_and_location_group(cls, location_code: str, location: str, + location_group: BlueprintLocationGroup): return db.session.query(cls).filter( and_( cls.location_code == location_code, @@ -282,21 +301,32 @@ class BlueprintLocation(BlueprintEntity): @classmethod def find_by_location_code_and_location(cls, location_code: str, location: str): - return db.session.query(cls).filter( - and_( - cls.location_code == location_code, - cls.location == location - ) - ).one_or_none() + return db.session.query(cls)\ + .filter(and_(cls.location_code == location_code, cls.location == location))\ + .order_by(cls.location)\ + .one_or_none() @classmethod def get_by_location_code_and_location(cls, location_code: str, location: str): - return db.session.query(cls).filter( - and_( - cls.location_code == location_code, - cls.location == location - ) - ).one() + return db.session.query(cls).filter(and_(cls.location_code == location_code, cls.location == location)) \ + .one() + + @classmethod + def find_all(cls): + return db.session.query(cls).order_by(cls.location).all() + + @classmethod + def find_all_as_dict(cls): + dates_reported = {} + for my_location in cls.find_all(): + dates_reported[my_location.location] = my_location + return dates_reported + + @classmethod + def get_all_as_page(cls, page: int): + return db.session.query(cls)\ + .order_by(cls.location)\ + .paginate(page, per_page=ITEMS_PER_PAGE) class BlueprintFactTableTimeSeries(BlueprintEntity): diff --git a/src/flask_covid19/blueprints/app_web/web_model_factory.py b/src/flask_covid19/blueprints/app_web/web_model_factory.py index 4480b35ed9419fe8be8d656a54343f60b2cd497b..683e5e7ef08f090be34fc275d8aec61a8d801ed3 100644 --- a/src/flask_covid19/blueprints/app_web/web_model_factory.py +++ b/src/flask_covid19/blueprints/app_web/web_model_factory.py @@ -3,7 +3,7 @@ from flask_covid19.blueprints.app_all.all_model import BlueprintDateReported from flask_covid19.blueprints.data_divi.divi_model import DiviDateReported from flask_covid19.blueprints.data_ecdc.ecdc_model import EcdcDateReported from flask_covid19.blueprints.data_owid.owid_model import OwidDateReported -from flask_covid19.blueprints.data_rki.rki_model import RkiMeldedatum +from flask_covid19.blueprints.data_rki.rki_model import RkiMeldedatum, RkiDatenstand, RkiRefDatum from flask_covid19.blueprints.data_vaccination.vaccination_model import VaccinationDateReported from flask_covid19.blueprints.data_who.who_model import WhoDateReported @@ -51,6 +51,17 @@ class BlueprintDateReportedFactory: datum_parts = (my_year, my_month, my_day) return datum_parts + @classmethod + def __get_datetime_german_parts(cls, my_datetime: str): + my_datetime_parts = my_datetime.split(",") + my_date_rep = my_datetime_parts[0] + my_date_parts = my_date_rep.split('.') + my_day = int(my_date_parts[0]) + my_month = int(my_date_parts[1]) + my_year = int(my_date_parts[2]) + datum_parts = (my_year, my_month, my_day) + return datum_parts + @classmethod def __get_datum_parts(cls, my_date_rep: str): my_date_parts = my_date_rep.split("-") @@ -168,6 +179,42 @@ class BlueprintDateReportedFactory: processed_full_update=False, ) + @classmethod + def __get_rki_date_datenstand(cls, o: BlueprintDateReported): + return RkiDatenstand( + date_reported_import_str=o.date_reported_import_str, + datum=o.datum, + year_day_of_year=o.year_day_of_year, + year_month=o.year_month, + year_week=o.year_week, + year=o.year, + month=o.month, + day_of_month=o.day_of_month, + day_of_week=o.day_of_week, + day_of_year=o.day_of_year, + week_of_year=o.week_of_year, + processed_update=False, + processed_full_update=False, + ) + + @classmethod + def __get_rki_ref_datum(cls, o: BlueprintDateReported): + return RkiRefDatum( + date_reported_import_str=o.date_reported_import_str, + datum=o.datum, + year_day_of_year=o.year_day_of_year, + year_month=o.year_month, + year_week=o.year_week, + year=o.year, + month=o.month, + day_of_month=o.day_of_month, + day_of_week=o.day_of_week, + day_of_year=o.day_of_year, + week_of_year=o.week_of_year, + processed_update=False, + processed_full_update=False, + ) + @classmethod def __get_vaccination(cls, o: BlueprintDateReported): return VaccinationDateReported( @@ -226,6 +273,20 @@ class BlueprintDateReportedFactory: o = cls.__create_new_object_factory(date_reported_import_str=my_date_rep, my_datum=my_datum) return cls.__get_rki(o) + @classmethod + def create_new_object_for_rki_date_datenstand(cls, my_date_rep: str): + (my_year, my_month, my_day) = cls.__get_datetime_german_parts(my_datetime=my_date_rep) + my_datum = date(my_year, my_month, my_day) + o = cls.__create_new_object_factory(date_reported_import_str=my_date_rep, my_datum=my_datum) + return cls.__get_rki_date_datenstand(o) + + @classmethod + def create_new_object_for_rki_ref_datum(cls, my_date_rep: str): + (my_year, my_month, my_day) = cls.__get_datetime_parts(my_date_rep) + my_datum = date(my_year, my_month, my_day) + o = cls.__create_new_object_factory(date_reported_import_str=my_date_rep, my_datum=my_datum) + return cls.__get_rki_ref_datum(o) + @classmethod def create_new_object_for_vaccination(cls, my_date_rep: str): o = cls.__create_new_object_factory_for_isoformat(my_date_rep) diff --git a/src/flask_covid19/blueprints/data_rki/rki_model.py b/src/flask_covid19/blueprints/data_rki/rki_model.py index cde40c2e59ee55ec9b1dd08d8f59c022c16a88ee..4e9e7a6c66b82e1c2c150a17ca0ed90a7a242f39 100644 --- a/src/flask_covid19/blueprints/data_rki/rki_model.py +++ b/src/flask_covid19/blueprints/data_rki/rki_model.py @@ -2,7 +2,7 @@ from sqlalchemy import and_ from database import db, ITEMS_PER_PAGE from flask_covid19.blueprints.app_all.all_model import BlueprintDateReported, BlueprintLocationGroup -from flask_covid19.blueprints.app_all.all_model import BlueprintLocation, BlueprintFactTable +from flask_covid19.blueprints.app_all.all_model import BlueprintLocation, BlueprintFactTable, BlueprintEntity class RkiMeldedatum(BlueprintDateReported): @@ -36,6 +36,68 @@ class RkiMeldedatum(BlueprintDateReported): processed_full_update = db.Column(db.Boolean, nullable=False) +class RkiDatenstand(BlueprintDateReported): + __tablename__ = 'rki_date_datenstand' + __mapper_args__ = {'concrete': True} + __table_args__ = ( + db.UniqueConstraint( + 'date_reported_import_str', + 'datum', + 'year_day_of_year', + name="uix_rki_date_datenstand" + ), + ) + + id = db.Column(db.Integer, primary_key=True) + # + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) + datum = db.Column(db.Date, nullable=False, unique=True) + year_day_of_year = db.Column(db.String(255), nullable=False, unique=True) + year_month = db.Column(db.String(255), nullable=False) + year_week = db.Column(db.String(255), nullable=False) + # + 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) + day_of_year = db.Column(db.Integer, nullable=True) + week_of_year = db.Column(db.Integer, nullable=False) + # + processed_update = db.Column(db.Boolean, nullable=False) + processed_full_update = db.Column(db.Boolean, nullable=False) + + +class RkiRefDatum(BlueprintDateReported): + __tablename__ = 'rki_date_ref_datum' + __mapper_args__ = {'concrete': True} + __table_args__ = ( + db.UniqueConstraint( + 'date_reported_import_str', + 'datum', + 'year_day_of_year', + name="uix_rki_date_ref_datum" + ), + ) + + id = db.Column(db.Integer, primary_key=True) + # + date_reported_import_str = db.Column(db.String(255), nullable=False, unique=True) + datum = db.Column(db.Date, nullable=False, unique=True) + year_day_of_year = db.Column(db.String(255), nullable=False, unique=True) + year_month = db.Column(db.String(255), nullable=False) + year_week = db.Column(db.String(255), nullable=False) + # + 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) + day_of_year = db.Column(db.Integer, nullable=True) + week_of_year = db.Column(db.Integer, nullable=False) + # + processed_update = db.Column(db.Boolean, nullable=False) + processed_full_update = db.Column(db.Boolean, nullable=False) + + class RkiBundesland(BlueprintLocationGroup): __tablename__ = 'rki_landkreis_bundesland' __mapper_args__ = {'concrete': True} @@ -74,6 +136,7 @@ class RkiLandkreis(BlueprintLocation): cascade='save-update', order_by='RkiBundesland.location_group') id_landkreis = db.Column(db.String(255), nullable=False) + location_type = db.Column(db.String(255), nullable=False) @classmethod def get_bochum(cls): @@ -81,6 +144,10 @@ class RkiLandkreis(BlueprintLocation): .filter(cls.location == 'SK Bochum')\ .one() + @classmethod + def find_all(cls): + return db.session.query(cls).order_by(cls.location).all() + @classmethod def find_by_location_group(cls, location_group: RkiBundesland, page: int): return db.session.query(cls).filter( @@ -101,6 +168,46 @@ class RkiLandkreis(BlueprintLocation): return rki_landkreis_dict +class RkiAltersgruppe(BlueprintEntity): + __tablename__ = 'rki_altersgruppe' + __mapper_args__ = {'concrete': True} + + def __str__(self): + return " " + self.altersgruppe + " " + + id = db.Column(db.Integer, primary_key=True) + processed_update = db.Column(db.Boolean, nullable=False) + processed_full_update = db.Column(db.Boolean, nullable=False) + altersgruppe = db.Column(db.String(255), nullable=False) + + @classmethod + def get_all_as_page(cls, page: int): + return db.session.query(cls) \ + .order_by(cls.altersgruppe)\ + .paginate(page, per_page=ITEMS_PER_PAGE) + + @classmethod + def get_all(cls, page: int): + return db.session.query(cls).order_by(cls.altersgruppe).paginate(page, per_page=ITEMS_PER_PAGE) + + @classmethod + def find_all(cls): + return db.session.query(cls).order_by(cls.altersgruppe).all() + + @classmethod + def find_all_as_dict(cls): + altersgruppe_dict = {} + for my_altersgruppe in cls.find_all(): + altersgruppe_dict[my_altersgruppe.altersgruppe] = my_altersgruppe + return altersgruppe_dict + + +association_table_rki_to_altersgruppe = db.Table('rki_to_altersgruppe', db.Model.metadata, + db.Column('rki_id', db.Integer, db.ForeignKey('rki.id')), + db.Column('rki_altersgruppe_id', db.Integer, db.ForeignKey('rki_altersgruppe.id')) +) + + class RkiData(BlueprintFactTable): __tablename__ = 'rki' __mapper_args__ = {'concrete': True} @@ -123,15 +230,34 @@ class RkiData(BlueprintFactTable): 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) + # altersgruppe = db.Column(db.String(255), nullable=False) + altersgruppen = db.relationship( + 'RkiAltersgruppe', + secondary=association_table_rki_to_altersgruppe, + lazy='joined', + cascade='save-update', + order_by='desc(RkiAltersgruppe.altersgruppe)') + neuer_fall = db.Column(db.String(255), nullable=False) geschlecht = db.Column(db.String(255), nullable=False) anzahl_fall = db.Column(db.String(255), nullable=False) anzahl_todesfall = db.Column(db.String(255), nullable=False) # meldedatum = db.Column(db.String(255), nullable=False) - datenstand = db.Column(db.String(255), nullable=False) + # datenstand = db.Column(db.String(255), nullable=False) + datenstand_id = db.Column(db.Integer, db.ForeignKey('rki_date_datenstand.id'), nullable=False) + datenstand = db.relationship( + 'RkiDatenstand', + lazy='joined', + cascade='save-update', + order_by='desc(RkiDatenstand.datum)') neuer_fall = db.Column(db.String(255), nullable=False) neuer_todesfall = db.Column(db.String(255), nullable=False) - ref_datum = db.Column(db.String(255), nullable=False) + # ref_datum = db.Column(db.String(255), nullable=False) + ref_datum_id = db.Column(db.Integer, db.ForeignKey('rki_date_ref_datum.id'), nullable=False) + ref_datum = db.relationship( + 'RkiRefDatum', + lazy='joined', + cascade='save-update', + order_by='desc(RkiRefDatum.datum)') neu_genesen = db.Column(db.String(255), nullable=False) anzahl_genesen = db.Column(db.String(255), nullable=False) ist_erkrankungsbeginn = db.Column(db.String(255), nullable=False) diff --git a/src/flask_covid19/blueprints/data_rki/rki_model_import.py b/src/flask_covid19/blueprints/data_rki/rki_model_import.py index a8d2bb468912b38d84b8f43c74f209f4e1ab48c8..abc5f6d140a6325b3dd6c1d395b227de67425a04 100644 --- a/src/flask_covid19/blueprints/data_rki/rki_model_import.py +++ b/src/flask_covid19/blueprints/data_rki/rki_model_import.py @@ -63,6 +63,26 @@ class RkiImport(AllImport): def get_new_aktualisierungen_as_array(cls): return [] + @classmethod + def get_date_datenstand_of_all_import(cls): + dates_reported = [] + bu = Bundle('datenstand', cls.datenstand) + for meldedatum in db.session.query(bu).distinct().order_by(cls.datenstand.desc()): + item = meldedatum[0][0] + if not item in dates_reported: + dates_reported.append(item) + return dates_reported + + @classmethod + def get_date_ref_datum_of_all_import(cls): + dates_reported = [] + bu = Bundle('ref_datum', cls.ref_datum) + for meldedatum in db.session.query(bu).distinct().order_by(cls.ref_datum.desc()): + item = meldedatum[0][0] + if not item in dates_reported: + dates_reported.append(item) + return dates_reported + @classmethod def get_datum_of_all_import(cls): dates_reported = [] @@ -83,6 +103,16 @@ class RkiImport(AllImport): bundesland_list.append(item) return bundesland_list + @classmethod + def get_altersgruppe_list(cls): + altersgruppe_list = [] + bu = Bundle('altersgruppe', cls.altersgruppe) + for altersgruppe_row in db.session.query(bu).distinct().order_by(cls.altersgruppe.asc()): + item = altersgruppe_row[0] + if not item in altersgruppe_list: + altersgruppe_list.append(item) + return altersgruppe_list + @classmethod def find_by_datun(cls, datum: date): return db.session.query(cls)\ diff --git a/src/flask_covid19/blueprints/data_rki/rki_service_import.py b/src/flask_covid19/blueprints/data_rki/rki_service_import.py index b672d5ef1085333a37f82e24cd5d336e4b5e7ebe..3bd4ec4642cf1f526df52f442a1351d6f5764523 100644 --- a/src/flask_covid19/blueprints/data_rki/rki_service_import.py +++ b/src/flask_covid19/blueprints/data_rki/rki_service_import.py @@ -101,6 +101,8 @@ class RkiServiceImport: if (k % 2000) == 0: db.session.commit() app.logger.info(" import RKI ... " + str(k) + " rows") + if k == 120000: + break db.session.commit() app.logger.info(" import RKI ... " + str(k) + " rows total") except KeyError as error: diff --git a/src/flask_covid19/blueprints/data_rki/rki_service_update.py b/src/flask_covid19/blueprints/data_rki/rki_service_update.py index 701802f09d9a8a35aae0653e813f3e242b87297d..5de88b7f16549b19676c9da071c149bdb9cb5631 100644 --- a/src/flask_covid19/blueprints/data_rki/rki_service_update.py +++ b/src/flask_covid19/blueprints/data_rki/rki_service_update.py @@ -2,7 +2,7 @@ from database import db, app from flask_covid19.blueprints.app_all.all_config import BlueprintConfig from flask_covid19.blueprints.app_web.web_model_factory import BlueprintDateReportedFactory -from flask_covid19.blueprints.data_rki.rki_model import RkiData, RkiMeldedatum, RkiBundesland, RkiLandkreis +from flask_covid19.blueprints.data_rki.rki_model import RkiData, RkiMeldedatum, RkiDatenstand, RkiRefDatum, RkiAltersgruppe, RkiBundesland, RkiLandkreis from flask_covid19.blueprints.data_rki.rki_model_import import RkiImport @@ -19,6 +19,46 @@ class RkiServiceUpdateBase: class RkiServiceUpdateFull(RkiServiceUpdateBase): + def __full_update_date_datenstand(self): + app.logger.info(" RkiServiceUpdateFull.__full_update_date_datenstand [begin]") + app.logger.info("------------------------------------------------------------") + RkiDatenstand.remove_all() + i = 0 + output_lines = [] + for datum_of_import in RkiImport.get_date_datenstand_of_all_import(): + i += 1 + o = BlueprintDateReportedFactory.create_new_object_for_rki_date_datenstand(my_date_rep=datum_of_import) + db.session.add(o) + output = " [ " + str(i) + " ] full update RKI date_datenstand ... " + str(o) + output_lines.append(output) + db.session.commit() + for output in output_lines: + app.logger.info(output) + app.logger.info("") + app.logger.info(" RkiServiceUpdateFull.__full_update_date_datenstand [done]") + app.logger.info("------------------------------------------------------------") + return self + + def __full_update_date_ref_datum(self): + app.logger.info(" RkiServiceUpdateFull.__full_update_date_ref_datum [begin]") + app.logger.info("------------------------------------------------------------") + RkiRefDatum.remove_all() + i = 0 + output_lines = [] + for datum_of_import in RkiImport.get_date_ref_datum_of_all_import(): + i += 1 + o = BlueprintDateReportedFactory.create_new_object_for_rki_ref_datum(my_date_rep=datum_of_import) + db.session.add(o) + output = " [ " + str(i) + " ] full update RKI date_ref_datum ... " + str(o) + output_lines.append(output) + db.session.commit() + for output in output_lines: + app.logger.info(output) + app.logger.info("") + app.logger.info(" RkiServiceUpdateFull.__full_update_date_ref_datum [done]") + app.logger.info("------------------------------------------------------------") + return self + def __full_update_date_reported(self): app.logger.info(" RkiServiceUpdateFull.__full_update_date_reported [begin]") app.logger.info("------------------------------------------------------------") @@ -39,6 +79,31 @@ class RkiServiceUpdateFull(RkiServiceUpdateBase): app.logger.info("------------------------------------------------------------") return self + def __full_update_altersgruppe(self): + app.logger.info(" RkiServiceUpdateFull.__full_update_altersgruppe [begin]") + app.logger.info("------------------------------------------------------------") + RkiAltersgruppe.remove_all() + app.logger.info("") + i = 0 + output_lines = [] + for altersgruppe_of_import in RkiImport.get_altersgruppe_list(): + i += 1 + my_altersgruppe = altersgruppe_of_import[0] + o = RkiAltersgruppe( + altersgruppe=my_altersgruppe, + processed_update=False, + processed_full_update=False, + ) + db.session.add(o) + output = " [ " + str(i) + " ] full update RKI altersgruppe ... " + str(o) + output_lines.append(output) + db.session.commit() + for output in output_lines: + app.logger.info(output) + app.logger.info(" RkiServiceUpdateFull.__full_update_altersgruppe [done]") + app.logger.info("------------------------------------------------------------") + return self + def __full_update_bundesland(self): app.logger.info(" RkiServiceUpdateFull.__full_update_bundesland [begin]") app.logger.info("------------------------------------------------------------") @@ -77,9 +142,14 @@ class RkiServiceUpdateFull(RkiServiceUpdateBase): for landkreis_from_import in RkiImport.get_landkreis_for_bundesland(bundesland=bundesland.location_group): i += 1 # app.logger.info("landkreis_from_import: "+str(landkreis_from_import)) + my_location_tmp = landkreis_from_import[0].split(" ") + my_id_landkreis = landkreis_from_import[1] + my_location_type = my_location_tmp[0] + my_location = my_location_tmp[1] o = RkiLandkreis( - location=landkreis_from_import[0], - id_landkreis=landkreis_from_import[1], + location=my_location, + id_landkreis=my_id_landkreis, + location_type=my_location_type, location_group=bundesland, processed_update=False, processed_full_update=True, @@ -118,7 +188,8 @@ class RkiServiceUpdateFull(RkiServiceUpdateBase): # app.logger.info("------------------------------------------------------------") for o_import in l_imports: # app.logger.info("o_import.landkreis " + o_import.landkreis) - landkreis=locations[o_import.landkreis] + location_key = o_import.landkreis.split(" ")[1] + landkreis=locations[location_key] # app.logger.info(str(landkreis)) o = RkiData( date_reported=d_meldedatum, @@ -154,12 +225,15 @@ class RkiServiceUpdateFull(RkiServiceUpdateBase): def full_update_dimension_tables(self): RkiData.remove_all() self.__full_update_date_reported() + self.__full_update_date_datenstand() + self.__full_update_date_ref_datum() + self.__full_update_altersgruppe() self.__full_update_landkreis() return self def full_update_fact_table(self): - RkiData.remove_all() - self.__full_update_data() + #RkiData.remove_all() + #self.__full_update_data() return self def full_update_star_schema(self): diff --git a/src/flask_covid19/blueprints/data_rki/rki_views.py b/src/flask_covid19/blueprints/data_rki/rki_views.py index e6dc965e700edcb6148a16520dd6c44cc8a8b2b3..56167f30ab8668b458060e07fce9c89df163da89 100644 --- a/src/flask_covid19/blueprints/data_rki/rki_views.py +++ b/src/flask_covid19/blueprints/data_rki/rki_views.py @@ -58,7 +58,22 @@ def url_rki_imported(page=1): flash("No data in the database.") page_data = None return render_template( - 'rki/rki_imported.html', + 'rki/imported/rki_imported.html', + page_data=page_data, + page_info=page_info) + + +@app_rki.route('/flat/page/<int:page>') +@app_rki.route('/flat') +def url_rki_flat(page=1): + page_info = WebPageContent('RKI', "flat") + try: + page_data = RkiFlat.get_all_as_page(page) + except OperationalError: + flash("No data in the database.") + page_data = None + return render_template( + 'rki/flat/rki_flat.html', page_data=page_data, page_info=page_info) @@ -88,11 +103,43 @@ def url_rki_date_reported_all(page: int = 1): flash("No date_reported in the database.") page_data = None return render_template( - 'rki/date_reported/rki_date_reported_all.html', + 'rki/date_reported/all/rki_date_reported_all.html', + page_data=page_data, + page_info=page_info) + + +@app_rki.route('/bundesland/all/page/<int:page>') +@app_rki.route('/bundesland/all') +def url_rki_bundesland_all(page: int = 1): + page_info = WebPageContent('RKI', "Bundesland", "All") + try: + page_data = RkiBundesland.get_all_as_page(page) + except OperationalError: + flash("No date_reported in the database.") + page_data = None + return render_template( + 'rki/bundesland/all/rki_bundesland_all.html', page_data=page_data, page_info=page_info) +@app_rki.route('/bundesland/<int:bundesland_id>/page/<int:page>') +@app_rki.route('/bundesland/<int:bundesland_id>') +def url_rki_bundesland_one(bundesland_id: int, page: int = 1): + page_info = WebPageContent('RKI', "Bundesland", "One") + try: + location_group = RkiBundesland.get_by_id(bundesland_id) + page_data = RkiLandkreis.get_by_location_group(location_group, page) + page_info = WebPageContent('RKI', "Bundesland", location_group.location_group) + except OperationalError: + flash("No date_reported in the database.") + page_data = None + return render_template( + 'rki/bundesland/one/rki_bundesland_one.html', + location_group=location_group, + page_data=page_data, + page_info=page_info) + # ------------------------------------------------------------------------ # Celery TASKS # ------------------------------------------------------------------------ diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/rki_bundesland_all.html b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/all/rki_bundesland_all.html similarity index 55% rename from src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/rki_bundesland_all.html rename to src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/all/rki_bundesland_all.html index 7316897d39ac94609806bc4bff955b18a92e1ab2..0d2d97ea8d3b9d9efca3e54dcc5330dfc8528e20 100644 --- a/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/rki_bundesland_all.html +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/all/rki_bundesland_all.html @@ -4,29 +4,26 @@ {{super()}} {% include 'rki/navigation/rki_navtabs.html' %} - <div class="container-fluid"> + <div class="container"> <div class="row"> <div class="col"> - {% include 'rki/bundesland/rki_bundesland_all_pagination.html' %} + {% include 'rki/bundesland/all/rki_bundesland_all_pagination.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'rki/bundesland/rki_bundesland_all_table.html' %} + {% include 'rki/bundesland/all/rki_bundesland_all_table.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'rki/bundesland/rki_bundesland_all_pagination.html' %} + {% include 'rki/bundesland/all/rki_bundesland_all_pagination.html' %} </div> </div> </div> {% endblock %} + {% block footer_container %} - <div> - {% for error in errors %} - <h4>{{ error }}</h4> - {% endfor %} - </div> + {% endblock %} diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/rki_bundesland_all_pagination.html b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/all/rki_bundesland_all_pagination.html similarity index 71% rename from src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/rki_bundesland_all_pagination.html rename to src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/all/rki_bundesland_all_pagination.html index 6eb53384c6362c6d76cf053d6dc378894a298636..5939619c977c0abdfa58ddac50b27e465f45813a 100644 --- a/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/rki_bundesland_all_pagination.html +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/all/rki_bundesland_all_pagination.html @@ -1,9 +1,10 @@ {% if page_data.pages > 1 %} - <!-- previous page --> + <!-- previous page --> <ul class="pagination"> {% if page_data.has_prev %} <li class="page-item"> - <a class="page-link" href="{{ url_for('rki.url_rki_date_reported_all', page=page_data.prev_num) }}">Previous</a> + <a class="page-link" + href="{{ url_for('rki.url_rki_bundesland_all', page=page_data.prev_num) }}">Previous</a> </li> {% endif %} <!-- all page numbers --> @@ -11,7 +12,8 @@ {% if page_num %} {% if page_num != page_data.page %} <li class="page-item"> - <a class="page-link" href="{{ url_for('rki.url_rki_date_reported_all', page=page_num) }}">{{ page_num }}</a> + <a class="page-link" + href="{{ url_for('rki.url_rki_bundesland_all', page=page_num) }}">{{ page_num }}</a> </li> {% else %} <li class="page-item active"> @@ -27,7 +29,8 @@ <!-- next page --> {% if page_data.has_next %} <li class="page-item"> - <a class="page-link" href="{{ url_for('rki.url_rki_date_reported_all', page=page_data.next_num) }}">Next</a> + <a class="page-link" + href="{{ url_for('rki.url_rki_bundesland_all', page=page_data.next_num) }}">Next</a> </li> {% endif %} </ul> diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/all/rki_bundesland_all_table.html b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/all/rki_bundesland_all_table.html new file mode 100644 index 0000000000000000000000000000000000000000..e289ed705dae1396cf6b292538e4f44881317105 --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/all/rki_bundesland_all_table.html @@ -0,0 +1,26 @@ + <div class="table-responsive"> + <table class="table table-hover table-striped table-dark"> + <thead> + <tr> + <th scope="col">bundesland</th> + </tr> + </thead> + <tbody> + {% for data_item in page_data.items %} + <tr> + <td> + <a href="{{ url_for('rki.url_rki_bundesland_one', bundesland_id=data_item.id) }}"> + {{ data_item.location_group }} + </a> + </td> + </tr> + {% endfor %} + </tbody> + <tfoot> + <tr> + <th scope="col">bundesland</th> + </tr> + </tfoot> + </table> + </div> + diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/one/rki_bundesland_one.html b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/one/rki_bundesland_one.html new file mode 100644 index 0000000000000000000000000000000000000000..f0d0aad34201953513610a162773297e98ec21a6 --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/one/rki_bundesland_one.html @@ -0,0 +1,29 @@ +{% extends 'app_application/layout/page_layout.html' %} + +{% block content %} + {{super()}} + {% include 'rki/navigation/rki_navtabs.html' %} + + <div class="container"> + <div class="row"> + <div class="col"> + {% include 'rki/bundesland/one/rki_bundesland_one_pagination.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'rki/landkreis/all/rki_landkreis_all_table.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'rki/bundesland/one/rki_bundesland_one_pagination.html' %} + </div> + </div> + </div> +{% endblock %} + + +{% block footer_container %} + +{% endblock %} diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/one/rki_bundesland_one_pagination.html b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/one/rki_bundesland_one_pagination.html new file mode 100644 index 0000000000000000000000000000000000000000..9b76bab3d8a8094a7862f74734ec8806cdc706cb --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/one/rki_bundesland_one_pagination.html @@ -0,0 +1,37 @@ + {% if page_data.pages > 1 %} + <!-- previous page --> + <ul class="pagination"> + {% if page_data.has_prev %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('rki.url_rki_bundesland_one', bundesland_id=location_group.id, page=page_data.prev_num) }}">Previous</a> + </li> + {% endif %} + <!-- all page numbers --> + {% for page_num in page_data.iter_pages() %} + {% if page_num %} + {% if page_num != page_data.page %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('rki.url_rki_bundesland_one', bundesland_id=location_group.id, page=page_num) }}">{{ page_num }}</a> + </li> + {% else %} + <li class="page-item active"> + <a class="page-link" href="#">{{ page_num }}</a> + </li> + {% endif %} + {% else %} + <li class="page-item"> + <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> + </li> + {% endif %} + {% endfor %} + <!-- next page --> + {% if page_data.has_next %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('rki.url_rki_bundesland_one', bundesland_id=location_group.id, page=page_data.next_num) }}">Next</a> + </li> + {% endif %} + </ul> + {% endif %} diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/rki_bundesland_all_table.html b/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/rki_bundesland_all_table.html deleted file mode 100644 index a1f42f4794a3e69fa54d2acd719f1c1ec2baa63d..0000000000000000000000000000000000000000 --- a/src/flask_covid19/blueprints/data_rki/templates/rki/bundesland/rki_bundesland_all_table.html +++ /dev/null @@ -1,41 +0,0 @@ - <table class="table table-hover table-striped table-dark"> - <thead class="table-secondary"> - <tr> - <th scope="col" class="text-right">day of week</th> - <th scope="col" class="text-left">date reported</th> - <th scope="col" class="text-right">week of year</th> - <th scope="col" class="text-left">year</th> - <th scope="col" class="text-left">day of year</th> - </tr> - </thead> - <tbody> - {% for owid_date_reported in page_data.items %} - <tr> - <td class="text-right"> - {{ owid_date_reported.get_name_for_weekday() }} - </td> - <td class="text-left"> - {{ owid_date_reported }} - </td> - <td class="text-right"> - {{ owid_date_reported.week_of_year }} - </td> - <td class="text-left"> - {{ owid_date_reported.year }} - </td> - <td class="text-left"> - {{ owid_date_reported.day_of_year }} - </td> - </tr> - {% endfor %} - </tbody> - <tfoot class="table-secondary"> - <tr> - <th scope="col" class="text-right">day of week</th> - <th scope="col" class="text-left">date reported</th> - <th scope="col" class="text-right">week of year</th> - <th scope="col" class="text-left">year</th> - <th scope="col" class="text-left">day of year</th> - </tr> - </tfoot> - </table> \ No newline at end of file diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/rki_date_reported_all.html b/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all.html similarity index 66% rename from src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/rki_date_reported_all.html rename to src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all.html index d221dfcaf37d1408c9ac29930a0e872ab849d584..6e8a3bdc192b8a7ce81a0d36eccacfefc105c176 100644 --- a/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/rki_date_reported_all.html +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all.html @@ -4,20 +4,20 @@ {{super()}} {% include 'rki/navigation/rki_navtabs.html' %} - <div class="container-fluid"> + <div class="container"> <div class="row"> <div class="col"> - {% include 'rki/date_reported/rki_date_reported_all_pagination.html' %} + {% include 'rki/date_reported/all/rki_date_reported_all_pagination.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'rki/date_reported/rki_date_reported_all_table.html' %} + {% include 'rki/date_reported/all/rki_date_reported_all_table.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'rki/date_reported/rki_date_reported_all_pagination.html' %} + {% include 'rki/date_reported/all/rki_date_reported_all_pagination.html' %} </div> </div> </div> diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/rki_date_reported_all_pagination.html b/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all_pagination.html similarity index 100% rename from src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/rki_date_reported_all_pagination.html rename to src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all_pagination.html diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/rki_date_reported_all_table.html b/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all_table.html similarity index 56% rename from src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/rki_date_reported_all_table.html rename to src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all_table.html index a1f42f4794a3e69fa54d2acd719f1c1ec2baa63d..08e6175434d2970032791e2f5e42ce53b2755d7c 100644 --- a/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/rki_date_reported_all_table.html +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all_table.html @@ -1,12 +1,7 @@ + <div class="table-responsive"> <table class="table table-hover table-striped table-dark"> <thead class="table-secondary"> - <tr> - <th scope="col" class="text-right">day of week</th> - <th scope="col" class="text-left">date reported</th> - <th scope="col" class="text-right">week of year</th> - <th scope="col" class="text-left">year</th> - <th scope="col" class="text-left">day of year</th> - </tr> + {% include 'rki/date_reported/all/rki_date_reported_all_table_head.html' %} </thead> <tbody> {% for owid_date_reported in page_data.items %} @@ -30,12 +25,7 @@ {% endfor %} </tbody> <tfoot class="table-secondary"> - <tr> - <th scope="col" class="text-right">day of week</th> - <th scope="col" class="text-left">date reported</th> - <th scope="col" class="text-right">week of year</th> - <th scope="col" class="text-left">year</th> - <th scope="col" class="text-left">day of year</th> - </tr> + {% include 'rki/date_reported/all/rki_date_reported_all_table_head.html' %} </tfoot> - </table> \ No newline at end of file + </table> + </div> \ No newline at end of file diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all_table_head.html b/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all_table_head.html new file mode 100644 index 0000000000000000000000000000000000000000..a423c3ad6042dd40373aec651fe6d0650a912a9a --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/date_reported/all/rki_date_reported_all_table_head.html @@ -0,0 +1,7 @@ + <tr> + <th scope="col" class="text-right">day of week</th> + <th scope="col" class="text-left">date reported</th> + <th scope="col" class="text-right">week of year</th> + <th scope="col" class="text-left">year</th> + <th scope="col" class="text-left">day of year</th> + </tr> diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat.html b/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat.html new file mode 100644 index 0000000000000000000000000000000000000000..aa36fea5c0f130a506f0cbf7c3882d990a062f96 --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat.html @@ -0,0 +1,32 @@ +{% extends 'app_application/layout/page_layout.html' %} + +{% block content %} + {{super()}} + {% include 'rki/navigation/rki_navtabs.html' %} + + <div class="container"> + <div class="row"> + <div class="col"> + {% include 'rki/flat/rki_flat_pagination.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'rki/flat/rki_flat_table.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'rki/flat/rki_flat_pagination.html' %} + </div> + </div> + </div> +{% endblock %} + + +{% block footer_container %} + +{% endblock %} + + + diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat_pagination.html b/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat_pagination.html new file mode 100644 index 0000000000000000000000000000000000000000..597319895ee843a804e27ad0524d254e0108bd6c --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat_pagination.html @@ -0,0 +1,46 @@ + {% if page_data.pages > 1 %} + <!-- previous page --> + <ul class="pagination"> + {% if page_data.has_prev %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('rki.url_rki_imported', page=page_data.prev_num) }}"> + Previous + </a> + </li> + {% endif %} + <!-- all page numbers --> + {% for page_num in page_data.iter_pages() %} + {% if page_num %} + {% if page_num != page_data.page %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('rki.url_rki_imported', page=page_num) }}"> + {{ page_num }} + </a> + </li> + {% else %} + <li class="page-item active"> + <a class="page-link" href="#">{{ page_num }}</a> + </li> + {% endif %} + {% else %} + <li class="page-item"> + <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> + </li> + {% endif %} + {% endfor %} + <!-- next page --> + {% if page_data.has_next %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('rki.url_rki_imported', page=page_data.next_num) }}"> + Next + </a> + </li> + {% endif %} + </ul> + {% endif %} + + + diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat_table.html b/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat_table.html new file mode 100644 index 0000000000000000000000000000000000000000..779440627e94a0d39ee7223ca225eaa1a1a4ad38 --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat_table.html @@ -0,0 +1,33 @@ + <div class="table-responsive"> + <table class="table table-hover table-striped table-dark"> + <thead class="table-secondary"> + {% include 'rki/imported/rki_imported_table_head.html' %} + </thead> + <tbody> + {% for who_flat in page_data.items %} + <tr> + <td>{{ who_flat.bundesland }}</td> + <td>{{ who_flat.landkreis }}</td> + <td>{{ who_flat.altersgruppe }}</td> + <td>{{ who_flat.geschlecht }}</td> + <td>{{ who_flat.anzahl_fall }}</td> + <td>{{ who_flat.anzahl_todesfall }}</td> + <td>{{ who_flat.meldedatum }}</td> + <td>{{ who_flat.neuer_fall }}</td> + <td>{{ who_flat.neuer_todesfall }}</td> + <td>{{ who_flat.neu_genesen }}</td> + <td>{{ who_flat.anzahl_genesen }}</td> + <td>{{ who_flat.ist_erkrankungsbeginn }}</td> + <td>{{ who_flat.altersgruppe2 }}</td> + </tr> + {% endfor %} + </tbody> + <tfoot class="table-secondary"> + {% include 'rki/imported/rki_imported_table_head.html' %} + </tfoot> + </table> + </div> + + + + diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat_table_head.html b/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat_table_head.html new file mode 100644 index 0000000000000000000000000000000000000000..1ac7591207391e8d851951a472293dde72ff3104 --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/flat/rki_flat_table_head.html @@ -0,0 +1,16 @@ + <tr> + <th scope="col">bundesland</th> + <th scope="col">landkreis</th> + <th scope="col">altersgruppe</th> + <th scope="col">geschlecht</th> + <th scope="col">anzahl fall</th> + <th scope="col">anzahl todesfall</th> + <th scope="col">meldedatum</th> + <th scope="col">neuer fall</th> + <th scope="col">neuer todesfall</th> + <th scope="col">neu genesen</th> + <th scope="col">anzahl genesen</th> + <th scope="col">ist erkrankungsbeginn</th> + <th scope="col">altersgruppe2</th> + </tr> + diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported.html b/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported.html new file mode 100644 index 0000000000000000000000000000000000000000..d239f464acdb1cf72328a1d34ce8d53405317841 --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported.html @@ -0,0 +1,32 @@ +{% extends 'app_application/layout/page_layout.html' %} + +{% block content %} + {{super()}} + {% include 'rki/navigation/rki_navtabs.html' %} + + <div class="container"> + <div class="row"> + <div class="col"> + {% include 'rki/imported/rki_imported_pagination.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'rki/imported/rki_imported_table.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'rki/imported/rki_imported_pagination.html' %} + </div> + </div> + </div> +{% endblock %} + + +{% block footer_container %} + +{% endblock %} + + + diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported_pagination.html b/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported_pagination.html new file mode 100644 index 0000000000000000000000000000000000000000..91d655a2c5a9ac1f81f2a4b1aa28d34a56e0156a --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported_pagination.html @@ -0,0 +1,44 @@ + {% if page_data.pages > 1 %} + <!-- previous page --> + <ul class="pagination"> + {% if page_data.has_prev %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('rki.url_rki_imported', page=page_data.prev_num) }}"> + Previous + </a> + </li> + {% endif %} + <!-- all page numbers --> + {% for page_num in page_data.iter_pages() %} + {% if page_num %} + {% if page_num != page_data.page %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('rki.url_rki_imported', page=page_num) }}"> + {{ page_num }} + </a> + </li> + {% else %} + <li class="page-item active"> + <a class="page-link" href="#">{{ page_num }}</a> + </li> + {% endif %} + {% else %} + <li class="page-item"> + <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> + </li> + {% endif %} + {% endfor %} + <!-- next page --> + {% if page_data.has_next %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('rki.url_rki_imported', page=page_data.next_num) }}"> + Next + </a> + </li> + {% endif %} + </ul> + {% endif %} + diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported_table.html b/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported_table.html new file mode 100644 index 0000000000000000000000000000000000000000..5ccb32dff2020dbe6750c5bad5a71a4ef9fddd23 --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported_table.html @@ -0,0 +1,32 @@ + <div class="table-responsive"> + <table class="table table-hover table-striped table-dark""> + <thead class="table-secondary"> + {% include 'rki/imported/rki_imported_table_head.html' %} + </thead> + <tbody> + {% for who_import in page_data.items %} + <tr> + <td>{{ who_import.bundesland }}</td> + <td>{{ who_import.landkreis }}</td> + <td>{{ who_import.altersgruppe }}</td> + <td>{{ who_import.geschlecht }}</td> + <td>{{ who_import.anzahl_fall }}</td> + <td>{{ who_import.anzahl_todesfall }}</td> + <td>{{ who_import.meldedatum }}</td> + <td>{{ who_import.neuer_fall }}</td> + <td>{{ who_import.neuer_todesfall }}</td> + <td>{{ who_import.neu_genesen }}</td> + <td>{{ who_import.anzahl_genesen }}</td> + <td>{{ who_import.ist_erkrankungsbeginn }}</td> + <td>{{ who_import.altersgruppe2 }}</td> + </tr> + {% endfor %} + </tbody> + <tfoot class="table-secondary"> + {% include 'rki/imported/rki_imported_table_head.html' %} + </tfoot> + </table> + </div> + + + diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported_table_head.html b/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported_table_head.html new file mode 100644 index 0000000000000000000000000000000000000000..1ac7591207391e8d851951a472293dde72ff3104 --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/imported/rki_imported_table_head.html @@ -0,0 +1,16 @@ + <tr> + <th scope="col">bundesland</th> + <th scope="col">landkreis</th> + <th scope="col">altersgruppe</th> + <th scope="col">geschlecht</th> + <th scope="col">anzahl fall</th> + <th scope="col">anzahl todesfall</th> + <th scope="col">meldedatum</th> + <th scope="col">neuer fall</th> + <th scope="col">neuer todesfall</th> + <th scope="col">neu genesen</th> + <th scope="col">anzahl genesen</th> + <th scope="col">ist erkrankungsbeginn</th> + <th scope="col">altersgruppe2</th> + </tr> + diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/landkreis/all/rki_landkreis_all_table.html b/src/flask_covid19/blueprints/data_rki/templates/rki/landkreis/all/rki_landkreis_all_table.html new file mode 100644 index 0000000000000000000000000000000000000000..0f7ecca4b3512c26314714e2b9afa5b6403c9fb8 --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/landkreis/all/rki_landkreis_all_table.html @@ -0,0 +1,30 @@ + <div class="table-responsive"> + <table class="table table-hover table-striped table-dark"> + <thead class="table-secondary"> + {% include 'rki/landkreis/all/rki_landkreis_all_table_head.html' %} + </thead> + <tbody> + {% for rki_landkreis in page_data.items %} + <tr> + <td> + <a href="{{ url_for( 'rki.url_rki_bundesland_all' ) }}"> + {{ rki_landkreis.location_group.location_group }} + </a> + </td> + <td> + {{ rki_landkreis.location }} + </td> + <td> + {{ rki_landkreis.location_type }} + </td> + <td> + {{ rki_landkreis.id_landkreis }} + </td> + </tr> + {% endfor %} + </tbody> + <tfoot> + {% include 'rki/landkreis/all/rki_landkreis_all_table_head.html' %} + </tfoot> + </table> + </div> \ No newline at end of file diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/landkreis/all/rki_landkreis_all_table_head.html b/src/flask_covid19/blueprints/data_rki/templates/rki/landkreis/all/rki_landkreis_all_table_head.html new file mode 100644 index 0000000000000000000000000000000000000000..78dc13c39603e354910eb1546f1918df0edbefee --- /dev/null +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/landkreis/all/rki_landkreis_all_table_head.html @@ -0,0 +1,6 @@ + <tr> + <th scope="col">bundesland</th> + <th scope="col">landkreis</th> + <th scope="col">typ</th> + <th scope="col">id landkreis</th> + </tr> diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/navigation/rki_navtabs.html b/src/flask_covid19/blueprints/data_rki/templates/rki/navigation/rki_navtabs.html index 00d483b1749b5868e3482faf9ab3c812ebff8916..e7bbdade892753d0211530ef1d9258e8c6635632 100644 --- a/src/flask_covid19/blueprints/data_rki/templates/rki/navigation/rki_navtabs.html +++ b/src/flask_covid19/blueprints/data_rki/templates/rki/navigation/rki_navtabs.html @@ -25,11 +25,21 @@ </a> </li> {% endif %} + <li class="nav-item"> + <a class="nav-link" href="{{ url_for('rki.url_rki_flat') }}"> + RKI flat + </a> + </li> <li class="nav-item"> <a class="nav-link" href="{{ url_for( 'rki.url_rki_date_reported_all') }}"> RKI Date Reported </a> </li> + <li class="nav-item"> + <a class="nav-link" href="{{ url_for( 'rki.url_rki_bundesland_all') }}"> + RKI Bundesland + </a> + </li> </ul> </nav> </div> diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/rki_imported.html b/src/flask_covid19/blueprints/data_rki/templates/rki/rki_imported.html deleted file mode 100644 index 9dac483ea7d81541a0f91fa9572bab9b82905ecc..0000000000000000000000000000000000000000 --- a/src/flask_covid19/blueprints/data_rki/templates/rki/rki_imported.html +++ /dev/null @@ -1,106 +0,0 @@ -{% extends 'app_application/layout/page_layout.html' %} - -{% block content %} - {{super()}} - {% include 'rki/navigation/rki_navtabs.html' %} - - <div class="container"> - <div class="row"> - <div class="col"> - {% if page_data.pages > 1 %} - <!-- previous page --> - <ul class="pagination"> - {% if page_data.has_prev %} - <li class="page-item"> - <a class="page-link" - href="{{ url_for('rki.url_rki_imported', page=page_data.prev_num) }}"> - Previous - </a> - </li> - {% endif %} - <!-- all page numbers --> - {% for page_num in page_data.iter_pages() %} - {% if page_num %} - {% if page_num != page_data.page %} - <li class="page-item"> - <a class="page-link" - href="{{ url_for('rki.url_rki_imported', page=page_num) }}"> - {{ page_num }} - </a> - </li> - {% else %} - <li class="page-item active"> - <a class="page-link" href="#">{{ page_num }}</a> - </li> - {% endif %} - {% else %} - <li class="page-item"> - <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> - </li> - {% endif %} - {% endfor %} - <!-- next page --> - {% if page_data.has_next %} - <li class="page-item"> - <a class="page-link" - href="{{ url_for('rki.url_rki_imported', page=page_data.next_num) }}"> - Next - </a> - </li> - {% endif %} - </ul> - {% endif %} - </div> - </div> - <div class="row"> - <div class="col"> - <table class="table table-hover table-striped"> - <thead> - <tr> - <th scope="col">bundesland</th> - <th scope="col">landkreis</th> - <th scope="col">altersgruppe</th> - <th scope="col">geschlecht</th> - <th scope="col">anzahl fall</th> - <th scope="col">anzahl todesfall</th> - <th scope="col">meldedatum</th> - <th scope="col">neuer fall</th> - <th scope="col">neuer todesfall</th> - <th scope="col">neu genesen</th> - <th scope="col">anzahl genesen</th> - <th scope="col">ist erkrankungsbeginn</th> - <th scope="col">altersgruppe2</th> - </tr> - </thead> - <tbody> - {% for who_global_data_import in page_data.items %} - <tr> - <td>{{ who_global_data_import.bundesland }}</td> - <td>{{ who_global_data_import.landkreis }}</td> - <td>{{ who_global_data_import.altersgruppe }}</td> - <td>{{ who_global_data_import.geschlecht }}</td> - <td>{{ who_global_data_import.anzahl_fall }}</td> - <td>{{ who_global_data_import.anzahl_todesfall }}</td> - <td>{{ who_global_data_import.meldedatum }}</td> - <td>{{ who_global_data_import.neuer_fall }}</td> - <td>{{ who_global_data_import.neuer_todesfall }}</td> - <td>{{ who_global_data_import.neu_genesen }}</td> - <td>{{ who_global_data_import.anzahl_genesen }}</td> - <td>{{ who_global_data_import.ist_erkrankungsbeginn }}</td> - <td>{{ who_global_data_import.altersgruppe2 }}</td> - </tr> - {% endfor %} - </tbody> - </table> - </div> - </div> - </div> -{% endblock %} - - -{% block footer_container %} - -{% endblock %} - - - diff --git a/src/flask_covid19/blueprints/data_rki/templates/rki/rki_test/rki_tests.html b/src/flask_covid19/blueprints/data_rki/templates/rki_test/rki_tests.html similarity index 76% rename from src/flask_covid19/blueprints/data_rki/templates/rki/rki_test/rki_tests.html rename to src/flask_covid19/blueprints/data_rki/templates/rki_test/rki_tests.html index a983246994c4e27acf534a01d2027caadb6275ac..a8241b9a3a509b80649036a1268c2f89cf8b1b0f 100644 --- a/src/flask_covid19/blueprints/data_rki/templates/rki/rki_test/rki_tests.html +++ b/src/flask_covid19/blueprints/data_rki/templates/rki_test/rki_tests.html @@ -2,7 +2,7 @@ {% block content %} {{super()}} - {% include 'owid/navigation/owid_navtabs.html' %} + {% include 'rki/navigation/rki_navtabs.html' %} <div class="container"> <p> @@ -24,14 +24,14 @@ <div class="col"> <div class="btn-group-vertical" role="group" aria-label="Views"> <a class="btn btn-primary btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_task_rki_test_update_star_schema') }}" + href="{{ url_for( 'rki.url_task_rki_test_update_star_schema') }}" role="button">url_task_rki_test update_star_schema</a> </div> </div> <div class="col"> <div class="btn-group-vertical" role="group" aria-label="Views"> <a class="btn btn-danger btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_rki_test_service_full_update_dimension_tables') }}" + href="{{ url_for( 'rki.url_rki_test_rki_test_service_full_update_dimension_tables') }}" role="button">url_rki_test rki_test_service full_update_dimension_tables</a> </div> </div> @@ -44,13 +44,13 @@ </p> <div class="btn-group-vertical" role="group" aria-label="Views"> <a class="btn btn-primary btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_rki_test_service_delete_last_day') }}" + href="{{ url_for( 'rki.url_rki_test_rki_test_service_delete_last_day') }}" role="button">url_rki_test rki_test_service delete_last_day</a> </div> <p> </p> <div class="btn-group-vertical" role="group" aria-label="Views"> <a class="btn btn-primary btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_rki_test_service_delete_last_continent') }}" + href="{{ url_for( 'rki.url_rki_test_rki_test_service_delete_last_continent') }}" role="button">url_rki_test_rki test_service delete_last_continent</a> </div> </div> @@ -58,22 +58,22 @@ <p><h4>countries</h4></p> <div class="btn-group-vertical" role="group" aria-label="Views"> <a class="btn btn-danger btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_rki_import_countries') }}" + href="{{ url_for( 'rki.url_rki_test_rki_import_countries') }}" role="button">url_rki_test rki_import countries</a> </div> <p><h4>dates_reported</h4></p> <div class="btn-group-vertical" role="group" aria-label="Views"> <a class="btn btn-primary btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_rki_import_get_new_dates_reported_as_array') }}" + href="{{ url_for( 'rki.url_rki_test_rki_import_get_new_dates_reported_as_array') }}" role="button">url_rki_test rki_import get_new_dates_reported_as_array</a> <a class="btn btn-danger btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_rki_data_get_datum_of_all_data') }}" + href="{{ url_for( 'rki.url_rki_test_rki_data_get_datum_of_all_data') }}" role="button">url_rki_test rki_data get_datum_of_all_data</a> <a class="btn btn-primary btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_rki_import_get_datum_of_all_import') }}" + href="{{ url_for( 'rki.url_rki_test_rki_import_get_datum_of_all_import') }}" role="button">url_rki_test rki_import get_datum_of_all_import</a> <a class="btn btn-danger btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_rki_service_service_update_rki_import_get_new_dates_as_array') }}" + href="{{ url_for( 'rki.url_rki_test_rki_service_service_update_rki_import_get_new_dates_as_array') }}" role="button">url_rki_test rki_service service_update rki_import_get_new_dates_as_array</a> </div> </div> @@ -86,13 +86,13 @@ </p> <div class="btn-group-vertical" role="group" aria-label="Views"> <a class="btn btn-danger btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_full_update_dimension_tables') }}" + href="{{ url_for( 'rki.url_rki_test_full_update_dimension_tables') }}" role="button">url_rki_test full_update_dimension_tables</a> <a class="btn btn-primary btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_full_update_fact_table') }}" + href="{{ url_for( 'rki.url_rki_test_full_update_fact_table') }}" role="button">url_rki_test full_update_fact_table</a> <a class="btn btn-secondary btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_full_update_star_schema') }}" + href="{{ url_for( 'rki.url_rki_test_full_update_star_schema') }}" role="button">url_rki_test full_update_star_schema</a> </div> </div> @@ -102,13 +102,13 @@ </p> <div class="btn-group-vertical" role="group" aria-label="Views"> <a class="btn btn-danger btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_update_dimension_tables') }}" + href="{{ url_for( 'rki.url_rki_test_update_dimension_tables') }}" role="button">url_rki_test update_dimension_tables</a> <a class="btn btn-primary btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_update_fact_table') }}" + href="{{ url_for( 'rki.url_rki_test_update_fact_table') }}" role="button">url_rki_test update_fact_table</a> <a class="btn btn-secondary btn-lg btn-block text-left" - href="{{ url_for( 'rki_test.url_rki_test_update_star_schema') }}" + href="{{ url_for( 'rki.url_rki_test_update_star_schema') }}" role="button">url_rki_test update_star_schema</a> </div> </div> diff --git a/src/flask_covid19/blueprints/data_vaccination/templates/vaccination/navigation/vaccination_navbar_dropdown.html b/src/flask_covid19/blueprints/data_vaccination/templates/vaccination/navigation/vaccination_navbar_dropdown.html index c97ad941439dbe74c870c5441bc63719f55b89e5..132bf4882ef53cac61df1a8315586db573f8d54d 100644 --- a/src/flask_covid19/blueprints/data_vaccination/templates/vaccination/navigation/vaccination_navbar_dropdown.html +++ b/src/flask_covid19/blueprints/data_vaccination/templates/vaccination/navigation/vaccination_navbar_dropdown.html @@ -1,11 +1,11 @@ <li class="dropdown"> <a class="dropdown-toggle nav-link" data-toggle="dropdown" href="javascript:void(0)"> - RKI Vaccination<i class="glyphicon glyphicon-chevron-down small"></i> + Vaccination<i class="glyphicon glyphicon-chevron-down small"></i> </a> <ul class="dropdown-menu"> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_vaccination_info') }}"> - RKI Vaccination + Vaccination </a> </li> <li> @@ -13,12 +13,12 @@ </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_vaccination_tasks') }}"> - RKI Vaccination tasks + Vaccination tasks </a> </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_vaccination_info') }}"> - RKI Vaccination Info + Vaccination Info </a> </li> <li> @@ -26,32 +26,32 @@ </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_task_vaccination_download') }}"> - RKI Vaccination :: TASK:: url_vaccination_task_download_only + Vaccination :: TASK:: url_vaccination_task_download_only </a> </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_task_vaccination_import') }}"> - RKI Vaccination :: TASK:: url_vaccination_task_download_only + Vaccination :: TASK:: url_vaccination_task_download_only </a> </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_task_vaccination_full_update_dimension_tables') }}"> - RKI Vaccination :: TASK:: url_task_vaccination_full_update_dimension_tables + Vaccination :: TASK:: url_task_vaccination_full_update_dimension_tables </a> </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_task_vaccination_update_dimension_tables') }}"> - RKI Vaccination :: TASK:: url_task_vaccination_update_dimension_tables + Vaccination :: TASK:: url_task_vaccination_update_dimension_tables </a> </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_task_vaccination_full_update_facttable') }}"> - RKI Vaccination :: TASK:: url_task_vaccination_full_update_facttable + Vaccination :: TASK:: url_task_vaccination_full_update_facttable </a> </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_task_vaccination_update_facttable') }}"> - RKI Vaccination :: TASK:: url_task_vaccination_update_facttable + Vaccination :: TASK:: url_task_vaccination_update_facttable </a> </li> <li> @@ -59,12 +59,12 @@ </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_task_vaccination_full_update_starschema') }}"> - RKI Vaccination :: TASK:: url_task_vaccination_full_update_starschema + Vaccination :: TASK:: url_task_vaccination_full_update_starschema </a> </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_task_vaccination_update_starschema') }}"> - RKI Vaccination :: TASK:: url_task_vaccination_update_starschema + Vaccination :: TASK:: url_task_vaccination_update_starschema </a> </li> <li> @@ -72,12 +72,12 @@ </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_vaccination_data') }}"> - RKI Vaccination :: Data (Timeline Germany) + Vaccination :: Data (Timeline Germany) </a> </li> <li> <a class="dropdown-item" href="{{ url_for( 'vaccination.url_vaccination_imported') }}"> - RKI Vaccination :: imported (Timeline Germany) + Vaccination :: imported (Timeline Germany) </a> </li> </ul>