Twitter Bot Helps Chicago Officials Find Dirty Restaurants

The bot led to 133 restaurant inspections and 21 shutdowns in a 10-month period.
Food Poisoning
Food Poisoning From an infographic for Foodborne Chicago by Payal Patel Designs

Those moules frites you had at the French bistro last night were delicious, but now you’re feeling kind of funny. Worse than funny. Actually, you’re trapped in your bathroom, suffering from food poisoning. Who are you going to tell about this?

Many cities have hotlines where citizens can report getting food poisoning from restaurants, but not everybody uses them. So, in a recent project, the city of Chicago sought food poisoning cases by setting an algorithm to mine Chicago-area tweets for complaints. The Chicago Department of Public Health’s Twitter bot, plus a new online complaint form, helped the department identify 133 restaurants for inspections over a 10-month period. Twenty-one of those restaurants failed inspection and 33 passed with “critical or serious” violations. Not a bad haul.

Chicago is now working with the health departments of Boston and New York to see if its system could work in those cities, according to a report city researchers published with the U.S. Centers for Disease Control and Prevention. Plus, Twitter isn’t the only social media platform cities are looking to mine for public health violations. In May, New York City’s department of health reported on using an algorithm to spot Yelp reviews that point to food poisoning cases. New York’s Yelp project led the city to discover three restaurants that had multiple violations. All the Yelp cases the city inspected had otherwise gone unreported, New York officials wrote in their own CDC report.

The Chicago bot was pretty simple, as Twitter-reading computer programs go. It searched for tweets geo-located to Chicago and its surrounding suburbs that mentioned “food poisoning.” Human staff then read the tweets to determine if they were relevant. (Sounds fun.) Staff marked tweets as relevant or not relevant, to give the algorithm data to better learn what tweets to pull in the future. Then staff members responded to relevant tweets themselves. Here’s a sample tweet and reply:

The link leads to a new online form, called Foodborne Chicago, where city residents can report problematic restaurants.

Between March 2013 and January 2014, the Chicago bot culled 2,241 tweets, of which 270 were relevant and staff replied to them. Thirty Twitter users went to Foodborne Chicago directly from the link the health department sent them. An additional 163 people submitted complaints to Foodborne Chicago, but staff don’t know if they learned about the site through Twitter or someplace else. Overall, Foodborne Chicago complaints contributed to four percent of the restaurants the city shut down for violations during the study period.

The city likely would have never caught the majority of those complaints without the Twitter bot, officials wrote to the CDC.

The city has made its Twitter bot open-source. You can see the code on GitHub.