itsahsiao / breadcrumbs

A full-stack Flask web app that lets foodies search restaurants, track their eating history, while also connecting with friends
28 stars 10 forks source link

Dataset: Restaurants (Yelp API) #3

Open itsahsiao opened 8 years ago

itsahsiao commented 8 years ago

In reference to project planning (Issue #1) re: dataset

itsahsiao commented 8 years ago

Yelp API for Python documentation: https://github.com/Yelp/yelp-python

API parameters and specifications: https://www.yelp.ca/developers/documentation/v2/search_api

itsahsiao commented 8 years ago

Tested Yelp API yesterday and was able to get the info needed to populate the tables (restaurants and categories).

Had some issues understanding that the Yelp API provided a Python wrapper and response was not a JSON file but a SearchResponse object, making it easy to access the attributes and information.

Need to complete model.py and set up tables to test if data can be generated into the database.

itsahsiao commented 8 years ago

Completed model.py, but need to create server.py in order to run model.py, or else get ImportError:

Traceback (most recent call last):
  File "model.py", line 196, in <module>
    from server import app
ImportError: cannot import name app
itsahsiao commented 8 years ago

Model.py and server.py working properly - When running model.py in interactive mode and running db.create_all(), tables get populated in psql database

Need to create seed.py to populate the data from Yelp into database

itsahsiao commented 8 years ago

Ran into many issues #8 #9 when starting seed.py file, so decided to make sure that model.py was storing the objects into psql database properly.

Can finally start seed.py by making an API request to store the restaurant information into database.

itsahsiao commented 8 years ago

Able to make Yelp API request and seed information into database (Restaurants and Cities table). Tested for two cities and worked.

Had some confusion regarding what seed.py actually does and what we can do to store information from API request - Data can be stored all at once in the beginning when we make the API request(s), or call on API each time during user's browser session. Seed.py is just the starting dataset (no need for seed.py if you call on API each time during user's browser session, or you could have seed.py with original dataset and add to database during user's browser session).

For now, use current data as test data. Eventually, need to get all restaurants for a city from Yelp and store into database (Note that Yelp may only give X number of results each time, so may need to use limit/offset). Added point to todo list above.

Recommended by Bonnie to store help functions outside of seed.py and call on function to load restaurants into seed.py. Added point to todo list above.

Per code review with Rachel, data design is up to us what we want in our database. Could exclude restaurants from database that do not have coordinates/address, could exclude restaurants that do not have image url's. Think about data design further. Added point to todo list above.