Skip to content

Commit

Permalink
Neave data update changes COL-528
Browse files Browse the repository at this point in the history
  • Loading branch information
makmanalp committed Aug 17, 2015
1 parent 9bd3dd6 commit aa69ef7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 41 deletions.
36 changes: 3 additions & 33 deletions colombia/data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,20 +223,10 @@ class DepartmentIndustryYear(BaseModel, IDMixin):
num_establishments = db.Column(db.Integer)

rca = db.Column(db.Integer)
density = db.Column(db.Float)
distance = db.Column(db.Float)
cog = db.Column(db.Float)
coi = db.Column(db.Float)

@hybrid_property
def distance(self):
if self.density is None:
return None
return 1.0 - self.density

@distance.expression
def distance(cls):
return (1.0 - cls.density).label("distance")


class MSAIndustryYear(BaseModel, IDMixin):

Expand All @@ -256,20 +246,10 @@ class MSAIndustryYear(BaseModel, IDMixin):
num_establishments = db.Column(db.Integer)

rca = db.Column(db.Integer)
density = db.Column(db.Float)
distance = db.Column(db.Float)
cog = db.Column(db.Float)
coi = db.Column(db.Float)

@hybrid_property
def distance(self):
if self.density is None:
return None
return 1.0 - self.density

@distance.expression
def distance(cls):
return (1.0 - cls.density).label("distance")


class MunicipalityIndustryYear(BaseModel, IDMixin):

Expand All @@ -289,16 +269,6 @@ class MunicipalityIndustryYear(BaseModel, IDMixin):
num_establishments = db.Column(db.Integer)

rca = db.Column(db.Integer)
density = db.Column(db.Float)
distance = db.Column(db.Float)
cog = db.Column(db.Float)
coi = db.Column(db.Float)

@hybrid_property
def distance(self):
if self.density is None:
return None
return 1.0 - self.density

@distance.expression
def distance(cls):
return (1.0 - cls.density).label("distance")
16 changes: 8 additions & 8 deletions colombia/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def load_trade4digit_municipality():
"state_p_wagemonth": "monthly_wages",
"state_p_est": "num_establishments",
"state_p_rca": "rca",
"state_p_distance_ps_pred": "density",
"state_p_distance_ps": "distance",
"state_p_cog_ps_pred1": "cog",
"all_p_pci": "complexity"
},
Expand Down Expand Up @@ -370,7 +370,7 @@ def load_trade4digit_municipality():
"wages": first,
"monthly_wages": first,
"num_establishments": first,
"density": first,
"distance": first,
"cog": first,
"rca": first
}
Expand All @@ -395,7 +395,7 @@ def hook_industry4digit_msa(df):
"msa_p_wage": "wages",
"msa_p_wagemonth": "monthly_wages",
"msa_p_rca": "rca",
"msa_p_distance_hybrid": "density",
"msa_p_distance_hybrid": "distance",
"msa_p_cog_ps_pred1": "cog",
"all_p_pci": "complexity"
},
Expand Down Expand Up @@ -427,7 +427,7 @@ def hook_industry4digit_msa(df):
"employment": first,
"wages": first,
"monthly_wages": first,
"density": first,
"distance": first,
"cog": first,
"rca": first
}
Expand Down Expand Up @@ -532,8 +532,8 @@ def hook_industry4digit_msa(df):
"state_d3_wage": "wages",
"state_d3_wagemonth": "monthly_wages",
"state_d3_emp": "employment",
#"state_d3_rca": "rca",
"state_d3_distance_ps_pred1": "density",
"state_d3_rca": "rca",
"state_d3_distance_ps_pred1": "distance",
"state_d3_cog_ps_pred1": "cog",
"all_d3_pci": "complexity"
},
Expand Down Expand Up @@ -566,9 +566,9 @@ def hook_industry4digit_msa(df):
"monthly_wages": first,
"employment": first,
"num_establishments": first,
"density": first,
"distance": first,
"cog": first,
#"rca": first
"rca": first
}
}
}

0 comments on commit aa69ef7

Please sign in to comment.