Skip to main content

Scores on the doors

When you go out to eat you want to know that the people preparing your food have a good standard of food hygiene. Across England, Northern Ireland, and Wales the Food Standards Agency collate hygiene ratings from local inspectors and publish them as an open dataset. It is a great, consistent, dataset and we already include extracts of it on our Data Mapper e.g. food hygiene ratings for Leeds.

I wanted to take the Food Standards Agency data and present it in a more useful way for when you are out-and-about. I also wanted to improve my Javascript skills to work with location data. So I've created a project - Scores on the Doors - which uses your device's location to display the nearest food premises along with their ratings. Clicking on any of the results takes you to the full entry for the establishment on the Food Standards Agency's website. The list is live so as you move around it updates in real time. I tested it out whilst travelling on the bus from Huddersfield to Holmfirth and it was like having a superpower.

Screenshot of the results when you are at our space in Munro House
Credit: ODI Leeds


To protect privacy, the user's location is not sent out of the page so our web server never knows the user's precise location. Instead, the user selects a local authority and we send every food establishment in that local authority to the browser. That means the user has to select the correct local authority and it is a bit slower to load initially but those are the trade-offs to protect privacy.

Update 2019-04-17: Having since added every Local Authority, the drop down list was proving to be a bit unweildly so we came up with a new method to auto-identify the Local Authority without sending the user's precise location to our server. We split the UK into roughly 55km (half degree) blocks and saved GeoJSON files containing the Local Authority boundaries in that block. Clicking on the "Use my location" button loads the boundaries for that block and, in the page, we then work out the Local Authority from the user's precise location and ask for everything in that Local Authority. That means our server still doesn't get to know the user's location better than about 55km or to Local Authority level.

Location, location, location

One problem I've noticed is that the location of the premises is sometimes off. That is because the FSA have determined the location by using the postcode centroid. This relies on the correct postcode being assigned and it also limits the accuracy with which a premises can be located. Sometimes a cafe/restaurant/pub might be listed up to 200m or so away from where it really is. It may be possible to improve locations by matching establishments to those included in Open Street Map data. However, the inconsistency of spellings and puncuation in both datasets will likely make that quite hard. It is something I'll try in the future.

The project currently covers Bradford, Calderdale, Kirklees, Leeds, Wakefield, Harrogate, and York. Update 2019-04-17: We have now added every Local Authority in the UK (England, Scotland, Wales and Northern Ireland).

Please give Scores on the Doors a try and let us know what you think.