Challenges: OAuth Application, Relational Database, Map Visualization
Tools: Python, Postgresql, Tableua
The goal of the project is to use python to get data from Yelp API on Ann Arbor's restaurants information and store the data into database for query/management. There will also be an interactive map built by Tableau and HTML for users to interact with.
Yelp is an application that provides restaurants' information/reviews. It is supported by multiple languages and is widely used in many countries such as the U.S. and Japan. After users pick a location(and other possible criteria), Yelp will return satisfying restaurants search results.
Yelp @ Ann Arbor: https://www.yelp.com/search?find_desc=&find_loc=Ann+Arbor%2C+MI&ns=1
Tool to get the data: Yelp Fusion API, which uses OAuth 2.0 as Authentication.
API documentation homepage: https://www.yelp.com/developers/documentation/v3/get_started
Search API documentation: https://www.yelp.com/developers/documentation/v3/business_search
Reviews API documentation: https://www.yelp.com/developers/documentation/v3/business_reviews
IMPORTANT UPDATES: From December 8, 2017, Yelp simplifies the API process and change from using OAuth 2.0 to API key. However, this code will still work until Yelp completely stops using OAuth 2.0 starting March 1, 2018.
We will get information on 40 best restaurants in Ann Arbor ordered by some sorting function by Yelp(taking both review counts and ratings into account), plus the corresponding 3 review extracts for each restaurant we retrieved.
There are two csv files that contain the information we have gained. Each csv's column names are provided below.
restaurants.csv (saves restaurant basic information on name, category, rating, price level and location)
restaurant_id: the registered id of the restaurant
restaurant_name: the name of the restaurant
category: which categories the restaurant belongs to, eg. Coffee & Tea. can be multiple categories. stored in a list.
price_leve: range from $ to $$$$
ratings: range from 1 to 5, on a 1/2 interval
review_counts: total number of reviews
state: the location of the restauant
city
street_address
latitude
longitude
--> Search API documentation: https://www.yelp.com/developers/documentation/v3/business_search
reviews.csv
restaurant_id: the registered id of the restaurant
reiview_1: one review of the customer
review_2: one review of the customer
review_3: one review of the customer
--> Reviews API documentation: https://www.yelp.com/developers/documentation/v3/business_reviews
Note: This file only stores the three reviews extract returned by the API endpoints. At this time, the API does not return restaurants without any reviews.
There will be three tables stored in the database:
Table1: Restaurants
id: PRIMARY KEY
restaurant_name
price_level
ratings
reviews_count
logitude
latitude
category id: FOREIGN KEY points to Table2 Category(id)
review id: FOREIGN KEY points to Table3 Reviews(id)
Table2: PriceLevel
id: PRIMARY KEY
price_level
Table3: Reivews
id: PRIMARY KEY
review_1
review_2
review_3
Unlike database, this interactive map allows the users to interact with 40 restaurants' information we gained in this project!
Map is generated by Tableau, which will be displayed on the web. It shows 40 best restaurants on Yelp in Ann Arbor. User can click on point on the map to see the corresponding restaurants'information. Point size indicates the number of ratings, with bigger size meaning more number of reviews, and point color indicates the average rating.
Link: Online Interactive Map
Have fun!