New York City publishes every restaurant inspection as a public dataset on NYC Open Data. The official file is DOHMH New York City Restaurant Inspection Results, dataset id 43nn-pn8j, maintained by the NYC Department of Health and Mental Hygiene. You can query it live through the Socrata Open Data API without downloading the full file. This note covers the three mistakes that most often produce a wrong "current grade," plus copy-paste SODA queries that avoid them. It is a companion to a longer file-layout explainer I published on Hashnode, not a rewrite of that piece. The endpoint The JSON endpoint is: https://data.cityofnewyork.us/resource/43nn-pn8j.json SoQL ($select, $where, $order, $group, $limit) works on that URL. No API key is required for light public use, but you should still set a User-Agent and keep $limit modest. Mistake 1: treating a random row as the current grade The file is a history table, not a current-grade table. A restaurant can have years of inspections in it. If you filter grade = 'A' and stop at the first hit, you may be looking at a 2023 visit even though a later inspection exists. A safer pattern is: find the latest real inspection_date for a CAMIS (the city's unique establishment id), then read the grade and score on that date only. https://data.cityofnewyork.us/resource/43nn-pn8j.json?$select=camis,dba,boro,grade,score,inspection_date,grade_date&$where=camis='50016891' AND inspection_date > '2000-01-01'&$order=inspection_date DESC&$limit=20 Enter fullscreen mode Exit fullscreen mode That CAMIS is Dirt Candy in Manhattan. As of the December 1, 2026 record date in the city file, its latest graded inspection is Grade A, score 7, inspected November 12, 2025. Always re-check the live file before citing a number; grades move. Also filter out the 1900-01-01 placeholder date. Those rows mark establishments that have not been inspected yet. Taking max(inspection_date) without that filter will pin a restaurant to 1900. Mistake 2: counting rows and calling it a restaurant count Each row is one violation cited at one inspection, not one restaurant. An inspection with five violations produces five rows. An inspection with no violations still appears, usually as a row with no violation code. If you count(*) you are counting violation lines. To count establishments, count distinct camis. To describe one visit, group by camis and inspection_date. Citywide snapshot I pulled from the live file on December 2, 2026 (dataset record date December 1, 2026): Letter-graded restaurants in the city file are still dominated by Grade A: 21,670 Grade A / 90.4% as of the November 30, 2026 citywide update we published from this same dataset. The A/B line is a score of 13. A is 0 to 13 points, B is 14 to 27, and C is 28 or more. A restaurant can sit at 13 and keep an A, then pick up one more point and fall to B. That 13-point edge is easy to miss if you only look at letter grades. Mistake 3: mixing an ungraded later visit with an older letter grade The latest row for a CAMIS is not always a letter grade. Some later visits are ungraded (for example a task-force inspection, or a visit that has a score but no grade yet). If your code does "latest row, else fall back to the last A," you can publish a stale A as if it were current official status. The rule I use: if the latest inspection has a letter A, B, or C, that is the current grade. If the latest inspection is ungraded, say so, and do not quietly keep the previous letter as "current" without labeling it as the last graded visit. A processed monthly report, if you want the cleaned view Eat Real Food NYC is a free public directory of healthy restaurants in New York City. As of December 2, 2026 the live directory has 2,212 published listings, 1,544 with a Grade A, and 1,700 with an A, B, or C grade, across 113 neighborhoods. The newest inspection date on a published listing is November 28, 2026. Listing a restaurant is free; official grades, scores, and default rankings are never for sale. The monthly health-grade report built from dataset 43nn-pn8j is here: https://www.eatrealfoodnyc.com/data/nyc-restaurant-health-grade-report The official dataset page is here: https://data.cityofnewyork.us/Health/DOHMH-New-York-City-Restaurant-Inspection-Results/43nn-pn8j
How to query NYC restaurant inspections from Open Data 43nn-pn8j (and avoid three common mistakes)
Full Article
Original Source
Read the full article at Dev →KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.