Back to work

Public-health data product

HealthCode

Full-stack restaurant inspection intelligence that turns fragmented public health records into searchable, map-based decision workflows.

Product Surface

HealthCode Near me view in Williamsburg, Brooklyn, with 100 nearby restaurants as grade-colored markers on a street map above a list of the closest places and their grades
Near me on the staging site, with the location set to Williamsburg, Brooklyn. Markers are colored by inspection grade on the self-hosted basemap.
HealthCode restaurant page for a Brooklyn restaurant with a B grade, showing its latest inspection, score and four violations, each with a plain-language label beside the official wording and a critical flag where it applies
A restaurant page. Each violation shows a plain-language label next to the city's official wording.
HealthCode neighborhood rankings for Williamsburg sorted by lowest concern, with sort buttons for lowest, highest, improved, recent, pest and temperature, and ranked restaurants with score, inspection date, trend and top issue
Williamsburg neighborhood rankings, sorted by lowest inspection concern.
HealthCode Near me view at phone width, with the search box, the grade-colored map and the nearby list stacked in one column
The same Near me view on a 390px-wide phone screen.
HealthCode architecture diagram
Deployed architecture: ingestion adapters, PostgreSQL, Express API, and React map/search UI.

Problem

Restaurant inspection data is public, but it is scattered across different source formats, jurisdictions, schemas, and publication habits. A useful product has to make that information searchable and geographically explorable while keeping source-level detail available for review.

Solution

HealthCode normalizes inspection feeds into a PostgreSQL-backed domain model for restaurants, inspections, violations, risk tags, and ingest runs. The React frontend gives users map, search, ranking, and detail workflows while the Express API applies validation, response caps, and privacy-conscious request logging.

One search box takes a restaurant name, a neighborhood, or a ZIP code. A neighborhood or ZIP opens a ranked list that can be sorted by lowest or highest concern, most improved, most recent, pest issues, or temperature issues. Near me maps the 100 closest restaurants. Each restaurant page lists its inspections, with every violation shown in plain language next to the official wording.

NYC restaurant inspections are the primary staging dataset. A separate Santa Clara adapter discovers facility histories, caches inspection PDFs, and parses major and minor violation sections into the same schema.

Data Flow

HealthCode data flow diagram
Public source records are preserved, normalized, scored, and exposed through bounded API views.

Design Decisions

Adapter-Based Ingestion

Each jurisdiction can expose data differently, so ingestion is split into adapters instead of forcing one brittle import path.

Raw-Row Traceability

Normalized records retain links back to source rows and ingest runs so quality issues can be debugged without guessing.

Safer Public Search

The API uses parameterized queries, wildcard escaping, query length limits, and control-character rejection before hitting search endpoints.

Map-Friendly Responses

Map and ranking endpoints are shaped for bounded responses, cached behavior, and frontend scanning rather than unlimited exports.

Operations And Reliability

The workflow uses GitHub Actions for migrations, sample ingest, risk backfill, tests, and frontend build checks. Scheduled staging checks verify the public frontend and API health every 30 minutes, with deeper database-backed smoke checks on demand. Render runs a daily NYC ingestion job that pulls incrementally and runs a full reconciliation weekly. A separate workflow runs migrations, ingestion, and risk backfill against staging on demand.

The public API sets a separate rate limit for each kind of request, from 30 map requests a minute up to 300 requests a minute in total per client. Map responses stop at 500 restaurants. Two health endpoints report whether the API and the database are up. Request logs keep a hashed client IP and never store the raw IP or the search text. The recorded checks were 15 passing adapter tests and passing staging smoke checks across Netlify, Render, and Neon.

Recent Engineering

Stopping Database Growth

NYC Open Data issues new row IDs on every fetch, so each full run appended another copy of the dataset, reaching 7.6 million rows and 20 GB (93.5% of the database). The fix keeps one current snapshot of raw rows and adds cache headers to the nine read endpoints.

Self-Hosted Basemap

OpenStreetMap's tile policy rules out consumer apps loading its tiles, so the maps now use a bundled NYC vector basemap (Protomaps PMTiles, zoom 0 to 14) that scripts extract and verify.

Mobile App

An NYC-only React Native (Expo) app for iOS and Android runs on the same API, with native maps, on-device clustering, grade and cuisine filters, search, inspection history, and rankings. It has preview and production build profiles but no app-store release yet.