Remove 'annual_change' table

This commit is contained in:
coolneng 2020-01-08 03:21:11 +01:00
parent 6a4af60d53
commit b7e7c3400d
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
5 changed files with 6 additions and 1061 deletions

View File

@ -45,20 +45,21 @@ CLOSED: [2019-11-01 Fri 00:34]
- [X] Black box
- [X] Entity-Relationship
** Implementation
*** TODO Backend [1/3] [33%]
*** TODO Backend [2/3] [66%]
**** DONE Database [3/3] [100%]
CLOSED: [2020-01-03 Fri 00:44]
- [X] Connection
- [X] Creation from script
- [X] Creation of tables via class
**** TODO Parser [3/4] [75%]
**** DONE Parser [3/3] [100%]
CLOSED: [2020-01-08 Wed 03:18]
- [X] Select useful fiels
- [X] Convert PU to Country (ISO 3166)
- [X] Insert into database
- [ ] Arithmetic operations for yearly changes
**** NEXT Flask framework [0/2] [0%]
- [ ] Plots with pandas
**** TODO Flask Application [0/2] [0%]
- [ ] Login for admin
- [ ] Arithmetic operations for yearly changes
- [ ] Plots with pandas
*** NEXT Documentation
*** INACTIVE Frontend [0/1] [0%]
- [ ] [[https://adminlte.io/][Adminlte]]

View File

@ -33,7 +33,6 @@ class Glacier(db.Model):
country = db.Column(db.String(60))
name = db.Column(db.String(60))
annual_data = db.relationship("Annual_Data")
annual_change = db.relationship("Annual_Change")
def __init__(self, uid, country, name):
self.uid = uid
@ -56,20 +55,6 @@ class Annual_Data(db.Model):
self.elevation = elevation
class Annual_Change(db.Model):
__tablename__ = "annual_change"
year = db.Column(db.Integer, db.ForeignKey("annual_data.year"), primary_key=True)
uid = db.Column(db.ForeignKey("glacier.uid"), primary_key=True)
surface_change = db.Column(db.Float)
length_change = db.Column(db.Float)
elevation_change = db.Column(db.Float)
def __init__(self, surface_change, length_change, elevation_change):
self.surface_change = surface_change
self.length_change = length_change
self.elevation_change = elevation_change
class User(db.Model):
uid = db.Column(db.Integer, primary_key=True)
registration_date = db.Column(

View File

@ -16,7 +16,6 @@ def create_dataframes() -> DataFrame:
files = {
"glacier": "../data/glacier.csv",
"annual_data": "../data/annual_data.csv",
"annual_change": "../data/annual_change.csv",
"user": "../data/user.csv",
}
df_list = {}

View File

@ -55,13 +55,11 @@ def create_databases(df):
files = {
"glacier": "../data/glacier.csv",
"annual_data": "../data/annual_data.csv",
"annual_change": "../data/annual_change.csv",
"user": "../data/user.csv",
}
dataframes = {
"glacier": df[["POLITICAL_UNIT", "NAME", "WGMS_ID"]].drop_duplicates(),
"annual_data": df[["WGMS_ID", "YEAR", "AREA", "MEDIAN_ELEVATION", "LENGTH"]],
"annual_change": df[["WGMS_ID", "YEAR"]],
"user": DataFrame(user),
}
renamed_dfs = rename_fields(dataframes)

File diff suppressed because it is too large Load Diff