Food hygiene ratings: search and compare Britain’s restaurants

Category: Best news application

Country/area: United Kingdom

Organisation: The Times

Organisation size: Big

Publication date: 10 Apr 2019

Credit: Ryan Watts, Kaya Burgess, Sam Joiner, Daniel Clark

Project description:

Through an analysis of Food Standard Agency (FSA) data, we revealed that 15,000 restaurants in the United Kingdom (one in 20) were failing according to the departments rating system. 

We downloaded the ratings for half a million british businesses and built a searchable tool to allow consumers to check the score of any restaurant.

We took the story further with a country-wide audit of the hygiene standards of restaurants featured on the nation’s favourite takeaway apps. Over the course of a week we ran a script which scraped the details of every establishment on Just Eat, Deliveroo and UberEats.

Impact reached:

The results were shocking: 4,000 failing establishments were hosted by Deliveroo; one in eight takeaways on Just Eat were in need of improvement and 30 out of a sample of 500 on Uber Eats scored lower than acceptable. 

Deliveroo and UberEats both told the Times that they are looking into adding the FSA ratings to restaurants they feature following our investigation. The story caused a strong reaction from our readers who debated the experiences they had had in restaurants around the country. Some readers even told us that the investigation had changed their dinner plans.

Having easy access to the FSA data with our tool has also led to a few follow-up stories including a story on the hygiene ratings of school caterers.

Techniques/technologies used:

We started by downloading the FSA’s entire database. We set up a script to backup this file once a week so we could compare the number of failing restaurants at the start of the process to those in the data at the end. We had to do this because historical data had not been provided by the FSA.

We then used Selenium and R to direct a web browser to each restaurant’s profile page on Just Eat, Deliveroo and Uber Eats. We were unable to find these pages for every restaurant on Uber Eats, so instead scraped as many as we could.

At the time, Just Eat had already started to publish FSA ratings on their site so once we scraped the pages we were able to easily determine the businesses latest rating. This was not the case with Deliveroo and Just Eat so we used reconcile-csv (a command line tool) and fuzzy matching to combine the two datasets.

Our hygiene rating lookup tool is intended to improve upon the user experience of the FSA’s own website. We worked with designers to find the best way to present the information available and it was then built using React.

In addition to redesigning the existing offering, we decided not to use the FSA’s API but to instead download the data and serve it to the tool ourselves. This allowed us to georeference the restaurant addresses before it was added to the database so readers could search for restaurants within a certain radius of their inputted postcode. Readers wouldn’t have to rely on a simple text search like on the FSA site.

What was the hardest part of this project?

The greatest challenge was scraping each of the three takeaway websites. We used Selenium and a web server to load pages how they would appear on a normal browser so that we could access the right information. We had to script lots of delays so as to ensure we didn’t send too many requests to the site at once which would break the scraper. This meant the final scrape took about a week to run.

This project goes above and beyond by taking an existing service, considering how it’s likely to be used by consumers, and improving it. Hygiene standards are an important consumer issue and something the public has to take responsibility for by doing the research themselves. Our tool makes that process as easy as possible and opens up the data to everyone.

What can others learn from this project?

Our tool did not only benefit readers but helped us find decent case studies for the wider investigation. We sent a working preview of the tool to the newsroom to ask for help testing it. They sent back useful observations including examples of failing restaurants in their local areas that they were shocked by. We learn that the more interesting case studies came from the experiences of people using the tool and so getting the app, intended to be used by readers, into the hands of journalists early on proved fruitful.

Project links: