Chick-fil-A might not be the first place you’d expect to see AI and machine learning in action, but as it turns out, the fast food franchise is using algorithms to parse social media for food safety issues at its over 2,400 restaurants in 47 states. During a presentation at the ReWork Deep Learning Summit in Boston, Massachusetts this afternoon, senior principal IT leader of food safety and product quality Davis Addy detailed a custom system Chick-fil-A uses to track problematic health trends around its restaurants.

The company plans to release the code on GitHub in the future.

“For us in this journey with analytics and food safety, we’re going from a place of hindsight to insight … and eventually foresight so we can be more proactive in helping our Restaurants better identify and address food safety risks,” said Addy.

Addy noted that social media is the most common customer feedback channel for food safety-related incidents, but he pointed out that it’s fraught with peril. Posts are inconsistent grammatically and tonally. Some users are more facetious and controversial than others. And more often then not, isolated posts are difficult to correlate with real-world events.

Chick-fil-A’s goal, then, was to develop an AI framework that could reliably identify keywords, phrases, and customer sentiment from posts to help spot emerging foodborne illness. Its AWS-hosted solution processes Restaurant review data every 10 minutes from a range of social platforms, which are passed onto a Python routine that filters for over 500 keywords (including words like “illness,” “food poisoning,” “vomit,” “throw up,” “barf,” and “nausea”) and AWS Comprehend, Amazon’s natural language processing service, which checks sentiment and determines legitimacy.

Chick-fil-A

Above: A flow chart illustrating Chick-fil-A’s AI foodborne illness-detecting system.

Image Credit: Kyle Wiggers / VentureBeat

You’d think that spotting food-poisoned customers’ angry tweets would be a walk in the park, but not so. Those customers might misspell crucial words like “filthy” or “ill,” and then there’s connotation to contend with — for instance, posts like “I love this place … they make a sick sandwich!” aren’t usually cause for alarm, despite the conspicuous “sick.”

Addy says that initially, AWS Comprehend struggled to suss out the sentiment of certain food-related phrases. After collaborating with Amazon to improve it, though, the Chick-fil-A team has been able to achieve up to 78% accuracy.

So where does the data go? Store managers get push notifications via a bespoke Chick-fil-A mobile app, which highlights words the algorithm identified and enables them to drill in to see full posts. From there, they’re able to contact customers directly (through the social platform) if they so choose.

The data is also delivered to a corporate dashboard, where it’s plotted over time to make trends easier to spot.

Chick-fil-A

Food safety isn’t the only domain Chick-fil-A thinks might benefit from machine learning. The restaurant chain is experimenting with computer vision systems that warn employees who’ve been handling raw chicken to wash their hands before they move to other areas of the kitchen, and a separate AI-driven system that instructs team members how to rinse their hands thoroughly. Addy noted that if employees washed their hands “as often as they should,” they’d reduce the risk of foodborne illness by up to 80%.

Chick-fil-A isn’t the first to use AI to identify locations with troubling food safety records. One Google and Harvard study employed an algorithm that tracked the location of smartphone users, identified web search queries indicative of food poisoning, and looked up restaurants visited by the users who performed those searches to identify the origin of illnesses. Caterers in China are reportedly using AI to spot unhygienic cooks, and San Francisco-based startup ImpactVision taps machine learning and hyperspectral imaging — a combination of spectroscopy and computer vision — to assess the quality of food in factories and elsewhere automatically.