class County(db.Model): __bind_key__ = 'wehomeproperty' id = db.Column(db.Integer(), index=True, primary_key=True) name = db.Column(db.String(255), index=True) geoid = db.Column(db.String(255), index=True, unique=True) cbsa_geoid = db.Column(db.String(255), index=True) lat = db.Column(db.Float()) lng = db.Column(db.Float()) properties = db.Column(JSON) created_at = db.Column(db.DateTime(), default=datetime.datetime.now) updated_at = db.Column(db.DateTime(), default=datetime.datetime.now, onupdate=datetime.datetime.now)
class Zipcode(db.Model): __bind_key__ = 'wehomeproperty' id = db.Column(db.Integer(), index=True, primary_key=True) geoid = db.Column(db.String(255), index=True, unique=True) city_geoid = db.Column(db.String(255), db.ForeignKey('city.geoid',onupdate="SET NULL", ondelete="SET NULL"), index=True) lat = db.Column(db.Float()) lng = db.Column(db.Float()) properties = db.Column(JSON) created_at = db.Column(db.DateTime(), default=datetime.datetime.now) updated_at = db.Column(db.DateTime(), default=datetime.datetime.now, onupdate=datetime.datetime.now)
class State(db.Model): __bind_key__ = 'wehomeproperty' id = db.Column(db.Integer(), index=True, primary_key=True) geoid = db.Column(db.String(255), index=True, unique=True) name = db.Column(db.String(255)) name_abbr = db.Column(db.String(255)) lat = db.Column(db.Float()) lng = db.Column(db.Float()) properties = db.Column(JSON) cities = db.relationship('City', backref='state') created_at = db.Column(db.DateTime(), default=datetime.datetime.now) updated_at = db.Column(db.DateTime(), default=datetime.datetime.now, onupdate=datetime.datetime.now)
class City(db.Model): __bind_key__ = 'wehomeproperty' id = db.Column(db.Integer(), index=True, primary_key=True) geoid = db.Column(db.String(255), index=True, unique=True) area_geoid = db.Column(db.String(255), db.ForeignKey('area.geoid'), index=True) state_geoid = db.Column(db.String(255), db.ForeignKey('state.geoid'),index=True) zipcodes = db.relationship('Zipcode', backref='city') neighbors = db.relationship('Neighbor', backref='city_') name = db.Column(db.String(255), index=True) lat = db.Column(db.Float()) lng = db.Column(db.Float()) properties = db.Column(JSON) created_at = db.Column(db.DateTime(), default=datetime.datetime.now) updated_at = db.Column(db.DateTime(), default=datetime.datetime.now, onupdate=datetime.datetime.now)
class TestCaseLog(db.Model): __tablename__ = "test_case_log" test_case_log_id = db.Column(db.Integer, primary_key=True) test_case_id = db.Column(db.ForeignKey('test_case.test_case_id'), index=True) job_id = db.Column(db.ForeignKey('job.job_id'), index=True) execution_status = db.Column(db.SMALLINT, nullable=False) dqi_percentage = db.Column(db.Float(precision=2), nullable=True) execution_log = db.Column(JSON, nullable=False) created_at = db.Column(db.DateTime, default=datetime.now) modified_at = db.Column(db.DateTime, default=datetime.now, index=True) test_cases = db.relationship(TestCase, back_populates='test_case_log', lazy=True) def __init__( self, test_case_id, job_id, execution_status=ExecutionStatus().get_execution_status_id_by_name( "new")): self.test_case_id = test_case_id self.job_id = job_id self.execution_status = execution_status def save_to_db(self): db.session.add(self) db.session.commit()
class RedfinMarket(db.Model): __bind_key__ = 'wehomeproperty' id = db.Column('index', db.Integer(), primary_key=True) avg_sale_to_list_mom = db.Column('Avg Sale To List Mom', db.Float()) avg_sale_to_list_yoy = db.Column('Avg Sale To List Yoy', db.Float()) avg_sale_to_list = db.Column('Avg Sale To List', db.Float()) city = db.Column('City', db.String(255)) homes_sold_mom = db.Column('Homes Sold Mom', db.Float()) homes_sold_yoy = db.Column('Homes Sold Yoy', db.Float()) homes_sold = db.Column('Homes Sold', db.Float()) inventory_mom = db.Column('Inventory Mom', db.Float()) inventory_yoy = db.Column('Inventory Yoy', db.Float()) inventory = db.Column('Inventory', db.Float()) measure_display = db.Column('Measure Display', db.String(255)) median_dom_mom = db.Column('Median Dom Mom', db.Integer()) median_dom_yoy = db.Column('Median Dom Yoy', db.Integer()) median_dom = db.Column('Median Dom', db.Integer()) median_list_ppsf_mom = db.Column('Median List Ppsf Mom', db.Float()) median_list_ppsf_yoy = db.Column('Median List Ppsf Yoy', db.Float()) median_list_ppsf = db.Column('Median List Ppsf', db.Float()) median_list_price_mom = db.Column('Median List Price Mom', db.Float()) median_list_price_yoy = db.Column('Median List Price Yoy', db.Float()) median_list_price = db.Column('Median List Price', db.Integer()) median_ppsf_mom = db.Column('Median Ppsf Mom', db.Float()) median_ppsf_yoy = db.Column('Median Ppsf Yoy', db.Float()) median_ppsf = db.Column('Median Ppsf', db.Float()) median_sale_price_mom = db.Column('Median Sale Price Mom', db.Float()) median_sale_price_yoy = db.Column('Median Sale Price Yoy', db.Float()) median_sale_price = db.Column('Median Sale Price', db.String(31)) new_listings_mom = db.Column('New Listings Mom', db.Float()) new_listings_yoy = db.Column('New Listings Yoy', db.Float()) new_listings = db.Column('New Listings', db.Integer()) number_of_records = db.Column('Number of Records', db.Integer()) period_begin = db.Column('Period Begin', db.String(255)) period_duration = db.Column('Period Duration', db.Integer()) period_end = db.Column('Period End', db.String(255)) price_drops_mom = db.Column('Price Drops Mom', db.Float()) price_drops_yoy = db.Column('Price Drops Yoy', db.Float()) price_drops = db.Column('Price Drops', db.Float()) property_type = db.Column('Property Type', db.String(255)) region_type = db.Column('Region Type', db.String(15)) region = db.Column('Region', db.String(255)) sold_above_list_mom = db.Column('Sold Above List Mom', db.Float()) sold_above_list_yoy = db.Column('Sold Above List Yoy', db.Float()) sold_above_list = db.Column('Sold Above List', db.Float()) state_code = db.Column('State Code', db.String(2)) state = db.Column('State', db.String(255)) table_id = db.Column('Table Id', db.String(255)) worksheet_filter = db.Column('Worksheet Filter', db.String(255)) months_of_supply = db.Column('Months Of Supply', db.Float()) months_of_supply_mom = db.Column('Months Of Supply Mom', db.Float()) months_of_supply_yoy = db.Column('Months Of Supply Yoy', db.Float()) __table_args__ = ( db.Index('idx_city_region_type_region_state_code', 'Region Type', 'Region', 'City', 'State Code'), )
class Area(db.Model): __bind_key__ = 'wehomeproperty' id = db.Column(db.Integer(), index=True, primary_key=True) geoid = db.Column(db.String(255), index=True, unique=True) cities = db.relationship('City', backref='area') name = db.Column(db.String(255), index=True) eng_name = db.Column(db.String(255), index=True) lat = db.Column(db.Float()) lng = db.Column(db.Float()) layer_type = db.Column(db.String(255), index=True) properties = db.Column(JSON()) # for IRR property_tax = db.Column(db.Float()) vaccancy_rate = db.Column(db.Float()) property_management_fee = db.Column(db.Float()) leasing_commission = db.Column(db.Float()) insurance_cost = db.Column(db.Float()) repair = db.Column(db.Float()) cap_ex = db.Column(db.Float()) acquisition_cost = db.Column(db.Float()) disposition_cost = db.Column(db.Float()) rent_growth = db.Column(db.Float()) # down_payment = db.Column(db.Float()) loan_interest_rate = db.Column(db.Float()) expenses = db.Column(db.Float()) closing_costs_misc = db.Column(db.Float()) # history = db.Column(db.Text()) block_villa_median = db.Column(db.Float()) block_apartment_median = db.Column(db.Float()) deal_average_price = db.Column(db.Float()) list_average_price = db.Column(db.Float()) occ_rate_long = db.Column(db.Float()) occ_rate_airbnb = db.Column(db.Float()) return_long = db.Column(db.Float()) return_airbnb = db.Column(db.Float()) created_at = db.Column(db.DateTime(), default=datetime.datetime.now) updated_at = db.Column(db.DateTime(), default=datetime.datetime.now, onupdate=datetime.datetime.now)
class Neighborhood(db.Model): __bind_key__ = 'wehomeproperty' id = db.Column(db.Integer(), index=True, primary_key=True) name = db.Column(db.String(255)) region_id = db.Column(db.Integer(), index=True, unique=True) city = db.Column(db.String(255)) state = db.Column(db.String(255)) past_rent_ratio = db.Column(db.Float()) past_increase_ratio = db.Column(db.Float()) forecast_rent_ratio = db.Column(db.Float()) forecast_increase_ratio = db.Column(db.Float()) home_value_rent_price_history = db.Column(db.Text()) home_value_sale_price_history = db.Column(db.Text()) market_health_index = db.Column(db.Float()) rent_final_point = db.Column(db.Float()) zestimate = db.Column(db.Float()) neighborhood_score = db.Column(db.Float()) area_geoid = db.Column(db.Integer(), index=True) # for IRR hoa = db.Column(db.Float()) property_tax = db.Column(db.Float()) vaccancy_rate = db.Column(db.Float()) property_management_fee = db.Column(db.Float()) leasing_commission = db.Column(db.Float()) insurance_cost = db.Column(db.Float()) repair = db.Column(db.Float()) cap_ex = db.Column(db.Float()) acquisition_cost = db.Column(db.Float()) disposition_cost = db.Column(db.Float()) rent_growth = db.Column(db.Float()) properties = db.Column(LONGTEXT()) created_at = db.Column(db.DateTime(), default=datetime.datetime.now) updated_at = db.Column(db.DateTime(), default=datetime.datetime.now, onupdate=datetime.datetime.now)