Combining Social media and public services to improve prevention of foodborne illnesses in Chicago.

png

Introduction

Chicago is the city that was once called Hog Butcher for its huge meat-processing industry. The city by the lake is most famous for its Chicago-style hot dogs, its deep dish pizza and 1920s gangsters like Al Capone. The food industry here is closely intertwined with the culture and makes the city truly unique.

Unfortunately, as varied and as tasty as the dishes can be they are still the subject of health concerns due to the sometimes unsanitary establishments serving them. We will try during this article to shed light on the ugly side hiding such delicious meals. We kindly invite our readers to join us in our culinary tour of the Windy City and unfortunately our first stop may be a bit nausea inducing so hold tight !

To start our data-driven journey we needed to rely on strong and reliable data sources and what better than the city itself for that ? The City of Chicago kindly makes its food inspections data available publicly, and even goes the extra mile by updating it daily. But we also quickly realized that only the word of the city officials is not enough, so we will also take the word of “Chicagoans” into account. The average American citizen talks about everything on social media and food is no exception to that, we will use that to our advantage by leveraging useful information from Yelp a crowd-sourced review forum focused on food establishments. The datasets we relied upon are briefly described here but more thorough information about them can be found in our Github repo.

  • This dataset mainly consist of facility identification and localization and the inspection characteristics. This information is derived from inspections of restaurants and other food establishments in Chicago from January 1, 2010 to the present. A more detailed description can be found here

  • Yelp is a business directory service and crowd-sourced review forum, it focuses on publishing crowd-sourced reviews about businesses.
  • To leverage useful data from the Yelp website, we use a combination of Yelp’s API - Yelp Fusion and web scraping in order to get the reviews of the restaurants in Chicago that have been labeled with “ food poisoning “ during food inspections.

Food inspections

Overview

As we all know, food inspections are the first line of defense between unwary citizens and dirty restaurants. The Chicago Department of Public Health (CDPH) is responsible for keeping restaurants honest with their food productions. They conduct routine, unannounced food inspections, also called canvass inspections, of over 15,000 retail food establishments to ensure their compliance with the Chicago food code. These inspections are considered as an important proactive measure in preventing food borne illness outbreaks.

If you are as concerned as us by your food safety, it seems pretty clear that food inspections’ result is a golden opportunity for the public to learn which restaurants adhere to public health regulations.

How did food inspection evolve from 2010 ? How many inspections are done per year ? What does the inspector look for ? Is enough being done to keep food safety ? This is the kind of questions that we are looking to answer. The Chicago food inspection dataset satisfies our hunger of response and provides some elements of answer.

png

First of all, the establishments are classified by risk, from 1 (high risk) to 3 (low risk). Risk 1 establishments propose food with more risky handling practices whereas risk 3 establishments have food with less risk such as packaged or nonperishable food. The risk doesn’t imply a greater probability of contaminated food but rather that different rules are considered. One of them is that for riskier places the inspections are more frequent.

As a general rule, Risk 1 establishments are inspected at least twice per calendar year; Risk 2 establishments are inspected at least once per calendar year; and Risk 3 establishments are inspected every two years. Don’t hesitate to click on the graphs below to get more info!

_

Article critique

We also saw that other sources of media do not shy away from publicly criticizing the city involvement in ensuring sanitary conditions. For example the Chicago Tribune said that :

“The Chicago Department of Public Health requires “high risk” food establishments, such as restaurants, school and hospital kitchens and day care centers to be inspected twice a year. In 2015, fewer than half of them got two inspections, city Inspector General Joseph Ferguson recently reported. Grocery stores are supposed to get an annual inspection, but nearly 1 in 5 were not visited by sanitarians last year. Bars and convenience stores are supposed to be inspected once every two years, but fewer than 1 in 4 got a visit from inspectors in 2014 and 2015.”

A deep analysis of this citation can be found in our Github. For now we present to you our results. We see how far off the actual inspections are from what is stated, and therefore we can conclude that CDPH has an understaffing problem to meet their requirements as mentioned in the article.

Risk Interval between 2 inspections by the law Interval between 2 inspections in data Difference
Risk 1 182.5 days 364 days 181,5 days
Risk 2 365 days 471 days 106 days
Risk 3 365 days 883 days 518 days

Food chains analysis

We cannot talk about the food industry without mentioning the food chains. Food chains achieved $145bn revenue in 2019 and here we will try to draw conclusions about how they deal individually with food safety. As we have seen, there are two main types of procedures : the usual one, Canvass and Complaints. We will take those as indicators to differentiate food chains. Here we can see the evolution of food chains for the inspection Canvass and Complaints.

As shown in the plot, there seems to be clusters depending on the establishment type: they mostly behave similarly to the food inspections. You can find further extensive analysis on the notebook where you can select the desired food chain.

Alt Text

Below we have two different examples of food chains. We can see how differently they deal with food inspections. On one hand Giordanos, a local brand seems to be doing well while Dollar Tree is struggling to pass food inspections. We are comparing these on purpose as they illustrate two different standings of restaurants. This difference can also be found in the results of food inspections.

Social media

As we saw previously, inspections are done regularly ( albeit not often enough ) to ensure that the restaurants meets a certain health standard. But the first people affected are actually the customers of said restaurants, so we will analyze what people actually “think” about restaurants that have been inspected.

Since the restaurants can be inspected for basically everything we will focus our research on one specific type of inspection that directly affects customers : food poisoning. By combining the data from Yelp and the data from the City of Chicago, it appears that restaurants that are suspected of food poisoning by city officials have clear traits that differentiate them from their peers.

First we have a clear difference in pricing, we can see that restaurants that get inspected for food poisoning are more likely to be classified as “cheap eats”. This confirms the suspicion that unhealthy food is more likely to be cheap.

The second difference we can see is in terms of ratings, we see a clear difference between the distribution of ratings of both restaurant types. Those who have been inspected for food poisoning have generally worse ratings than the others. This shows us that the city officials are mostly targeting those kinds of restaurants and inspections are not done randomly. They may hear a rumor that a restaurant is serving unhygienic foods and so they decide to inspect it. And we all know that social media is the best channel for spreading rumors!

From the gathered Yelp data, it is also possible to see if a restaurant is currently closed or not and it is no surprise that a restaurant that has been suspected of food poisoning is more likely to be closed today than a restaurant who hasn’t.

png

Singling out one restaurant : Shaws Crab House Chicago

As we saw earlier, restaurants that are suspected of food poisoning have generally lower ratings. But one might ask, “ How does the rating evolve over time and does the opinion of the customer change just after an inspection ? “ To answer that we try to take a more pragmatic approach : we focus on the reviews of one restaurant Shaws Crab House Chicago.

First we start by plotting a time series of the average rating by month of the restaurant and we compare that to dates of food inspection and whether it passed or failed.

png

We observe that there is a particular trend that appears for this restaurant, it seems that each time an inspection happens the ratings spike up briefly before going down again. That means that after each inspection changes are made to the general management of the restaurant.

On the next step of our analysis we try to study the connection between words in the dataset

We picked the most common words related to the food proposed at the restaurant. We analyzed their relationship with different words written in the reviews, and we have seen a large vocabulary of negative words among which there were words justifing non-hygienic food service. We can see some negative words attached to it, in fact some people think that the food there is “ overpriced, bad and horrible “.

Final thoughts

Eating out in Chicago is not an easy task if we are even a little bit health conscious and even though the data for food inspections is available publicly people do not usually consult them before going out. Instead, more and more customers rely on Social media to choose the right restaurant to go to. We came to the conclusion that even if it is the easiest media to consume, social media can lack some reliability compared to government issued statements.

Nonetheless, from the data acquired, we saw that the restaurants that are targeted by food inspections also have bad reviews overall on Social Media so checking other people opinion can be the first step towards preventing food borne illness before eating out.