class Yodp(db.Model, AutoSerialize): __tablename__ = 'sitc_yodp' year = db.Column(db.Integer, primary_key=True) origin_id = db.Column(db.String(5), db.ForeignKey(Country.id), primary_key=True) dest_id = db.Column(db.String(5), db.ForeignKey(Country.id), primary_key=True) sitc_id = db.Column(db.String(8), db.ForeignKey(Sitc.id), primary_key=True) export_val = db.Column(db.Numeric(16, 2)) import_val = db.Column(db.Numeric(16, 2)) export_val_growth_pct = db.Column(db.Float()) export_val_growth_pct_5 = db.Column(db.Float()) export_val_growth_val = db.Column(db.Numeric(16, 2)) export_val_growth_val_5 = db.Column(db.Numeric(16, 2)) import_val_growth_pct = db.Column(db.Float()) import_val_growth_pct_5 = db.Column(db.Float()) import_val_growth_val = db.Column(db.Numeric(16, 2)) import_val_growth_val_5 = db.Column(db.Numeric(16, 2)) def __repr__(self): return '<Yodp %d.%s.%s.%s>' % (self.year, self.origin_id, self.dest_id, self.sitc_id)
class BaseProd(db.Model, AutoSerialize): __abstract__ = True year = db.Column(db.Integer(), primary_key=True) import_val = db.Column(db.Numeric(16, 2)) export_val = db.Column(db.Numeric(16, 2)) export_val_growth_pct = db.Column(db.Float()) export_val_growth_pct_5 = db.Column(db.Float()) export_val_growth_val = db.Column(db.Numeric(16, 2)) export_val_growth_val_5 = db.Column(db.Numeric(16, 2)) import_val_growth_pct = db.Column(db.Float()) import_val_growth_pct_5 = db.Column(db.Float()) import_val_growth_val = db.Column(db.Numeric(16, 2)) import_val_growth_val_5 = db.Column(db.Numeric(16, 2))
class Yo(db.Model, AutoSerialize): __tablename__ = 'attr_yo' year = db.Column(db.Integer, primary_key=True) origin_id = db.Column(db.String(5), db.ForeignKey(Country.id), primary_key=True) eci = db.Column(db.Float()) neci = db.Column(db.Float()) eci_rank = db.Column(db.Integer) eci_rank_delta = db.Column(db.Integer) opp_value = db.Column(db.Float()) population = db.Column(db.Integer) gdp = db.Column(db.Numeric(16, 2)) gdp_pc_constant = db.Column(db.Numeric(16, 2)) gdp_pc_current = db.Column(db.Numeric(16, 2)) gdp_pc_constant_ppp = db.Column(db.Numeric(16, 2)) gdp_pc_current_ppp = db.Column(db.Numeric(16, 2)) leader = db.Column(db.String(100)) magic = db.Column(db.Float()) pc_constant = db.Column(db.Float()) pc_current = db.Column(db.Float()) notpc_constant = db.Column(db.Float()) def __repr__(self): return '<Yo %d.%s>' % (self.year, self.origin_id)
class Yp(db.Model, AutoSerialize): __tablename__ = 'sitc_yp' year = db.Column(db.Integer, primary_key=True) sitc_id = db.Column(db.String(8), db.ForeignKey(Sitc.id), primary_key=True) export_val = db.Column(db.Numeric(16, 2)) import_val = db.Column(db.Numeric(16, 2)) pci = db.Column(db.Float()) pci_rank = db.Column(db.Integer) pci_rank_delta = db.Column(db.Integer) top_exporter = db.Column(db.String(5), db.ForeignKey(Country.id)) top_importer = db.Column(db.String(5), db.ForeignKey(Country.id)) def __repr__(self): return '<Yp %d.%s>' % (self.year, self.sitc_id)
class Sitc(ProdAttr): __tablename__ = 'attr_sitc' sitc = db.Column(db.String(6)) pini = db.Column(db.Float()) pini_class = db.Column(db.Integer) name = db.relationship("Sitc_name", backref="sitc", lazy="dynamic") yodp_product = db.relationship("db_data.sitc_models.Yodp", backref='product', lazy='dynamic') yop_product = db.relationship("db_data.sitc_models.Yop", backref='product', lazy='dynamic') yp_product = db.relationship("db_data.sitc_models.Yp", backref='product', lazy='dynamic') classification = "sitc"
class Pci(object): pci = db.Column(db.Float()) pci_rank = db.Column(db.Integer) pci_rank_delta = db.Column(db.Integer)
class Rca(object): export_rca = db.Column(db.Float()) import_rca = db.Column(db.Float())