Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
When it comes to picking a restaurant, we tend to use our past experiences, peer recommendations, and social media as our guide.  But have you ever looked at their inspection history?

If you're like me, you probably have no clue if the restaurant that you're eating at has a long history of employees not washing their hands, leaving food out too long, or a rodent infestation.  To improve the quality and safety of restaurant, the New York City Health Department conducts unannounced inspections of restaurants at least once a year.  Each violation gets a certain number of points and the points are calculated to form an inspection score - the lower the score, the better the Grade.  Thanks to NYC Open Data, the city publishes this data for us to gain better transparency into their services. But while they do an excellent job delivering raw data, they provide very little analytics and insight into this data.  Until now...


Just Show Me the Numbers

Each year, the NYC Health Department inspects over 30,000 restaurants and finds over 100,000 violations in these inspections.

The most common inspections are initial inspections and routine re-inspections.

Of all of the inspections, 54.7% of these citations found were deemed "critical" and 91.5% of all restaurants inspected have some sort of citations


What Types Of Violations Occur?

The NYC inspectors check for compliance in food handling, food temperature, personal hygiene and vermin control. The most common violations is the food temperature, how they store and handle food, and food surfaces that are used to prepare the food.

If we drill down into the critical violations, the two big ones that catch my attention are "Facility not vermin proof" and "Evidence of mice".  Yikes.


Who Are the Worst Offenders?

Not surprisingly, fast food restaurants appear to be the worst offenders with the most "critical" violations.  To be fair to them, these establishments have many restaurants across the city and naturally they're going to accumulate the most citations.  But if you just look at the average number, the data can be skewed the other way - for those smaller restaurants that have only had one inspection.


If we drill down further, we see that their issues range from temperature, hand washing, food storage, and rodents.

Rodents?  Who Has Rodents?

If we filter on Vermin and Rodents, the fast food chains tend to dominate this list.


Is the NYC Health Department Helping These Restaurants to Get "Better"

The goal of these health inspections is for restaurants to improve their health quality and safety.  Since they started collecting statistics (2014), over the past 5 years, 2,041 restaurants have been closed and 400 have been re-closed.  On the positive side, 2,037 have been "re-opened" meaning that they improved their overall quality.

If we trend this over time, we can see that while the average scores haven't changed much, the number of restaurants that have received an "A" grade have increased.  This can be attributed to new restaurants opening (new restaurants have worse scores than existing) and inspections that have lead to the closure of restaurants.


What Predictive Factors Influences a Restaurant's Score?

This is where advanced analytics can provide us with some additional insights.  The algorithm below shows all of the key influencers that impacts the score of a restaurant.  "Grade" is obvious (the better the grade, the lower the score), but some of the less obvious ones are the violations, inspection type, and building.

The violation that most commonly lead to higher scores seem like some of the easier ones to fix.  05F is related to the temperature of prepared and unprepared food, 05C is the construction of the food surface, 05E is the toilet facilities, and 05H is improper hand washing.  Despite the signs that you see at every restaurant, not all of your employees follow it.

Also, the type of inspection seems to reveal a lot.  Initial inspections have a much worse scores and grades than re-inspections.


What Does This All Mean?

For me, the analytics told me the following:

(1)  Sometime It's Better Not to Know.  Do you really want to know what's happening in the kitchen or behind the walls?  Almost every restaurant has some sort of issues and very few go without a single violations.  The key is to avoid those with a recent history of many critical violations.  I also had a strong suspicion that the fast food restaurants were not the cleanest restaurants in NYC and the data validated this.

(2)  The NYC Department of Health is helping.  Despite restaurant managers dreading these guys, the number of Grade A restaurants increase each year and the number of restaurants that are being closed are decreasing.  The initial inspections seem to be the worst, but they seem to get better with each subsequent one, which is a good thing.

(3)  People Need Analytics not Data.  While NYC Open Data does an excellent job providing timely and updated "raw data", they provide very little analytics and insight into this data, like we're seeing above.  This type of analytics let's us see the whole story in the data.


Got an analytics questions or just want to know more?

Follow or message me on LinkedIn or drop a comment below?