From 95ad11c4fe2269be8e677c928b36e9358dde3e09 Mon Sep 17 00:00:00 2001
From: thomaswoehlke <thomas.woehlke@gmail.com>
Date: Fri, 12 Feb 2021 17:49:44 +0100
Subject: [PATCH] * Fixed #123 split RkiBundeslaenderService into two Services,
 one for bundeslaender and one for landkreise

---
 BACKLOG.md                                    |  2 +-
 .../blueprints/rki_landkreise/rki_model.py    |  2 -
 .../rki_landkreise/rki_model_import.py        | 40 +++++++++----------
 3 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/BACKLOG.md b/BACKLOG.md
index 350d1fe2..fa19b0c6 100644
--- a/BACKLOG.md
+++ b/BACKLOG.md
@@ -193,7 +193,7 @@
 * Issue #146 add Tasks and URLs for starting Tasks to rki_views
 * Issue #140 move WhoImport to RKI in: rk_service_import.py
 * Issue #139 refactor RkiBundeslaenderServiceDownload to new method scheme introduced 07.02.2021
-* Issue #123 split RkiBundeslaenderService into two Services, one for bundeslaender and one for landkreise
+* Fixed #123 split RkiBundeslaenderService into two Services, one for bundeslaender and one for landkreise
 * Issue #125 implement RkiLandkreise
 * Issue #126 implement RkiBundeslaenderImport
 * Issue #127 implement RkiBundeslaenderImport.get_dates_reported
diff --git a/src/covid19/blueprints/rki_landkreise/rki_model.py b/src/covid19/blueprints/rki_landkreise/rki_model.py
index bf91ba6e..e75c17d2 100644
--- a/src/covid19/blueprints/rki_landkreise/rki_model.py
+++ b/src/covid19/blueprints/rki_landkreise/rki_model.py
@@ -3,8 +3,6 @@ from datetime import date
 from sqlalchemy.orm import joinedload
 
 from database import db, ITEMS_PER_PAGE
-from covid19.blueprints.common.common_model import CommonDateReported, CommonRegion
-from covid19.blueprints.rki.rki_model import RkiDateReported, RkiRegion, RkiCountry
 
 
 # TODO: #123 split RkiBundeslaenderService into two Services, one for bundeslaender and one for landkreise
diff --git a/src/covid19/blueprints/rki_landkreise/rki_model_import.py b/src/covid19/blueprints/rki_landkreise/rki_model_import.py
index f03d42ba..f883dd07 100644
--- a/src/covid19/blueprints/rki_landkreise/rki_model_import.py
+++ b/src/covid19/blueprints/rki_landkreise/rki_model_import.py
@@ -3,20 +3,31 @@ from database import db, ITEMS_PER_PAGE
 # OBJECTID_1,LAN_ew_AGS,LAN_ew_GEN,LAN_ew_BEZ,LAN_ew_EWZ,OBJECTID,Fallzahl,Aktualisierung,AGS_TXT,GlobalID,faelle_100000_EW,Death,cases7_bl_per_100k,cases7_bl,death7_bl,cases7_bl_per_100k_txt,AdmUnitId,SHAPE_Length,SHAPE_Area
 
 
-# TODO: #123 split RkiBundeslaenderService into two Services, one for bundeslaender and one for landkreise
 # TODO: #128 add fields from csv to RkiLandkreiseImport
 class RkiLandkreiseImport(db.Model):
     __tablename__ = 'rki_landkreise_import'
 
     id = db.Column(db.Integer, primary_key=True)
-    date_reported = db.Column(db.String(255), nullable=False)
-    country_code = db.Column(db.String(255), nullable=False)
-    country = db.Column(db.String(255), nullable=False)
-    who_region = db.Column(db.String(255), nullable=False)
-    new_cases = db.Column(db.String(255), nullable=False)
-    cumulative_cases = db.Column(db.String(255), nullable=False)
-    new_deaths = db.Column(db.String(255), nullable=False)
-    cumulative_deaths = db.Column(db.String(255), nullable=False)
+
+    OBJECTID_1 = db.Column(db.String(255), nullable=False)
+    LAN_ew_AGS = db.Column(db.String(255), nullable=False)
+    LAN_ew_GEN = db.Column(db.String(255), nullable=False)
+    LAN_ew_BEZ = db.Column(db.String(255), nullable=False)
+    LAN_ew_EWZ = db.Column(db.String(255), nullable=False)
+    OBJECTID = db.Column(db.String(255), nullable=False)
+    Fallzahl = db.Column(db.String(255), nullable=False)
+    Aktualisierung = db.Column(db.String(255), nullable=False)
+    AGS_TXT = db.Column(db.String(255), nullable=False)
+    GlobalID = db.Column(db.String(255), nullable=False)
+    faelle_100000_EW = db.Column(db.String(255), nullable=False)
+    Death = db.Column(db.String(255), nullable=False)
+    cases7_bl_per_100k = db.Column(db.String(255), nullable=False)
+    cases7_bl = db.Column(db.String(255), nullable=False)
+    death7_bl = db.Column(db.String(255), nullable=False)
+    cases7_bl_per_100k_txt = db.Column(db.String(255), nullable=False)
+    AdmUnitId = db.Column(db.String(255), nullable=False)
+    SHAPE_Length = db.Column(db.String(255), nullable=False)
+    SHAPE_Area = db.Column(db.String(255), nullable=False)
 
     @classmethod
     def remove_all(cls):
@@ -37,17 +48,6 @@ class RkiLandkreiseImport(db.Model):
     def get_by_id(cls, other_id):
         return db.session.query(cls).filter(cls.id == other_id).one()
 
-    @classmethod
-    def get_regions(cls):
-        return db.session.query(cls.who_region).distinct()
-
-    @classmethod
-    def get_dates_reported(cls):
-        return db.session.query(cls.date_reported).distinct()
-
-    @classmethod
-    def get_for_one_day(cls, day):
-        return db.session.query(cls).filter(cls.date_reported == day).all()
 
     @classmethod
     def get_new_dates_as_array(cls):
-- 
GitLab