About grAte

grAte (grade + ate) maps the health inspection results of every restaurant New York City is tracking, so you can check a place before you sit down.

How grades work

Inspectors give points for each violation they find, so a lower score is better:

A restaurant that scores worse than an A gets a second, unannounced inspection a few weeks later, and the grade comes from that one. Until then it keeps showing its last grade. A restaurant contesting its grade can post Grade Pending until a hearing. Violations marked critical are the ones most likely to make someone sick.

Where the data comes from

The city publishes inspection results on NYC Open Data and updates them every day. grAte copies them each night. The city only keeps about three years of results and drops restaurants once they close. grAte keeps everything it has copied, so its history grows over time.

Privacy

"Near me" never sends your location anywhere. grAte downloads the whole list of restaurants once, and your browser works out what's close. grAte doesn't use cookies.

How it's built

The city's data is about 300,000 rows, one per violation, rewritten every day: a 150 MB file. grAte doesn't keep that file. Each night a job on Cloudflare Workers re-reads the last 90 days and keeps one row per restaurant and one per inspection in a small database, about 20 MB in all. Only rows that changed get written, so a quiet night writes almost nothing, and every run has a limit on how much it may write so a bug can't run up a bill.

The map loads one compact file of the whole city, about a megabyte. Searching, filtering and finding what's near you all happen in your browser, which is why your location stays with you. The 30,000 dots are drawn straight onto a canvas over the map, which stays smooth where one map marker per restaurant would crawl.

Fine print

grAte is an independent project by Shance Lin. See more of Shance's projects. It isn't affiliated with the NYC Department of Health and Mental Hygiene. Results can lag behind the card in the window, so the card is the final word.

Map data © OpenStreetMap contributors, drawn by OpenFreeMap, Leaflet and MapLibre.