Restaurant Inspections
Contributed by John Downs, Dean and Python instructor.
----------------------------------------------------
Video:
----------------------------------------------------
Recently, my first group of students for Data Analysis with Python presented their projects. I agreed to present along with them, with a project of my own. In a sense, we are all students and presenting together is a great excuse to try new tools and technologies.
I chose something relatively simple. I was interested in restaurant health inspection data, and specifically the ability to look up the grade and violations of a place I was considering for my next meal. I have seen several applications that do an analysis of the data, but never one that answered the question "Should I eat here?".
While this project isn't very heavy on data analysis, it did rely on some tools we used in class. It provides an excellent example for how data can be presented in a useful way, once the analysis is complete.
Python 2 is officially a legacy product, so I choose Python 3.4. I am more familiar with Python 2, so I expected some challenges going forward, but I found the upgrade remarkably simple. I deployed the application to Heroku. This was also a seamless process. I selected MongoDB as my data source, hosting the database on MongoLab.
Using MongoDB was motivated by a desire to experiment with the technology. In retrospect, I found it awkward to construct queries. A relational database such as Postgres would have been a better choice.
The application itself uses a simple Model/View/Controller pattern with Flask as the web framework. There are three features I implemented.
The first is a phone number lookup to see the results of the most recent inspection for a particular restaurant. I found that the phone number is a unique key that also corresponds with the Yelp's API for business lookup.
The second feature is zipcode lookup. The zipcode is a proxy for neighborhood. This provides the inspection date and most recent grade for every establishment in the area.
The third feature is a summary for cuisine types in a borough. It allows you to view the count for each grade and see aggregate counts of each violation during the most recent round of inspections.
----------------------------------------------------
There are many features that could be added to make this more useful. Things like allowing lookup by name and integrating it with review sources would be a couple of straightforward additions that would really improve the usability of the application.
The application is available at:
http://homer-nyc.herokuapp.com
The source can be found on github:
https://github.com/jdowns/Homer
The data is hosted at:
https://nycopendata.socrata.com/Health/Restaurant-Inspection-Results/4vkw-7nck.
For example, I put 11377 zip code in my application, I got the following result back: