diff --git a/colombia/data/models.py b/colombia/data/models.py index ba8c07a..bdb4351 100644 --- a/colombia/data/models.py +++ b/colombia/data/models.py @@ -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): @@ -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): @@ -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") diff --git a/colombia/datasets.py b/colombia/datasets.py index 745e74f..44bd15c 100644 --- a/colombia/datasets.py +++ b/colombia/datasets.py @@ -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" }, @@ -370,7 +370,7 @@ def load_trade4digit_municipality(): "wages": first, "monthly_wages": first, "num_establishments": first, - "density": first, + "distance": first, "cog": first, "rca": first } @@ -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" }, @@ -427,7 +427,7 @@ def hook_industry4digit_msa(df): "employment": first, "wages": first, "monthly_wages": first, - "density": first, + "distance": first, "cog": first, "rca": first } @@ -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" }, @@ -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 } } }