Ejemplo n.º 1
0
 def __init__(self, table=None, recreate=False):
     datamodel = Datamodel()
     if table is None:
         table, table_config = datamodel.zipcode_timeseries()
     else:
         _, table_config = datamodel.zipcode_timeseries()
     self.time_series_postgres = self._initialize_postgres((table, table_config), recreate=recreate)
Ejemplo n.º 2
0
    def __init__(self, recreate=False):
        datamodel = Datamodel()
        self.table, self.table_config = datamodel.population()
        self.postgres = Postgresql(user_name='postgres',
                                   password='******',
                                   host='localhost',
                                   port='5432',
                                   db='TestProject')
        self.postgres.initialize_table(self.table,
                                       recreate=False,
                                       **self.table_config)
        self.googlegeo = GoogleGeo()

        # myan: only get major cities data once per request
        self.major_cities_postgres = Postgresql(user_name='postgres',
                                                password='******',
                                                host='localhost',
                                                port='5432',
                                                db='TestProject')
        self.major_cities = self.major_cities_postgres.get(
            "select * from TestMajorCities")
        self.all_states = self.major_cities['state'].values
        self.all_cities = self.major_cities['city'].values
        self.all_lats = self.major_cities['lat'].values
        self.all_lngs = self.major_cities['lng'].values
        self.all_population = self.major_cities['population'].values
Ejemplo n.º 3
0
 def __init__(self, table=None, recreate=False):
     datamodel = Datamodel()
     if table is None:
         table, table_config = datamodel.zipcode_timeseries()
     else:
         _, table_config = datamodel.zipcode_timeseries()
     self.time_series_postgres = self._initialize_postgres(
         (table, table_config), recreate=recreate)
Ejemplo n.º 4
0
 def __init__(self, key=None):
     if key is None:
         self.api_key = _get_great_schools_api_key()
     else:
         self.api_key = key
     # myan: initialize postgresql
     datamodel = Datamodel()
     self.table, self.table_config = datamodel.great_schools()
     self.postgres = Postgresql(user_name='postgres',
                                password='******',
                                host='localhost',
                                port='5432',
                                db='TestProject')
     self.postgres.initialize_table(self.table, recreate=False, **self.table_config)
Ejemplo n.º 5
0
    def __init__(self, min_price=150000, max_price=300000, top_percentage=0.25, top_max_num_entries=30):
        self.MIN_PRICE = min_price
        self.MAX_PRICE = max_price
        self.TOP_PERCENTAGE = top_percentage
        self.TOP_MAX_NUM_ENTRIES = top_max_num_entries

        datamodel = Datamodel()
        self.time_series_postgres = self._initialize_postgres(datamodel.zipcode_timeseries())
        self.population_postgres = self._initialize_postgres(datamodel.population())
        self.great_schools_postgres = self._initialize_postgres(datamodel.great_schools())

        self.zipcode_timeseries = None
        self.top_zipcodes_timeseries = None
        self.rest_zipcodes_timeseries = None
        self.top_zipcodes_school_data = None
        self.top_zipcodes_population_data = None
        self.all_months_timeseries = None
Ejemplo n.º 6
0
    def __init__(self,recreate=False):
        datamodel = Datamodel()
        self.table, self.table_config = datamodel.population()
        self.postgres = Postgresql(user_name='postgres',
                                   password='******',
                                   host='localhost',
                                   port='5432',
                                   db='TestProject')
        self.postgres.initialize_table(self.table, recreate=False, **self.table_config)
        self.googlegeo = GoogleGeo()

        # myan: only get major cities data once per request
        self.major_cities_postgres = Postgresql(user_name='postgres',
                                                password='******',
                                                host='localhost',
                                                port='5432',
                                                db='TestProject')
        self.major_cities = self.major_cities_postgres.get("select * from TestMajorCities")
        self.all_states = self.major_cities['state'].values
        self.all_cities = self.major_cities['city'].values
        self.all_lats = self.major_cities['lat'].values
        self.all_lngs = self.major_cities['lng'].values
        self.all_population = self.major_cities['population'].values
Ejemplo n.º 7
0
    def __init__(self,
                 min_price=150000,
                 max_price=300000,
                 top_percentage=0.25,
                 top_max_num_entries=30):
        self.MIN_PRICE = min_price
        self.MAX_PRICE = max_price
        self.TOP_PERCENTAGE = top_percentage
        self.TOP_MAX_NUM_ENTRIES = top_max_num_entries

        datamodel = Datamodel()
        self.time_series_postgres = self._initialize_postgres(
            datamodel.zipcode_timeseries())
        self.population_postgres = self._initialize_postgres(
            datamodel.population())
        self.great_schools_postgres = self._initialize_postgres(
            datamodel.great_schools())

        self.zipcode_timeseries = None
        self.top_zipcodes_timeseries = None
        self.rest_zipcodes_timeseries = None
        self.top_zipcodes_school_data = None
        self.top_zipcodes_population_data = None
        self.all_months_timeseries = None