# Restaurant Inspection Alerts (US Health Departments) (`texxupport/restaurant-inspection-alerts`) Actor

- **URL**: https://apify.com/texxupport/restaurant-inspection-alerts.md
- **Developed by:** [Kye Williams](https://apify.com/texxupport) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 inspections

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Restaurant Inspection Alerts (US Health Departments)

Get every new restaurant health inspection from seven US health departments as one clean record per inspection, with the result, score, grade and the full list of violations. Run it on a schedule and it sends only inspections you have not received before. Turn on **Only problem inspections** to get just the failed, closed and C-grade visits.

Built for food-safety consultants, pest-control and cleaning companies looking for leads, food suppliers, insurers, local news and review sites.

### Places covered

| Place | Source dataset | Score |
| --- | --- | --- |
| New York City, NY | NYC DOHMH (data.cityofnewyork.us, 43nn-pn8j) | Points, lower is better. 0-13 is an A, 28+ a C |
| Chicago, IL | Chicago Dept. of Public Health (data.cityofchicago.org, 4ijn-s7e5) | No score. Pass, Pass w/ Conditions or Fail |
| King County (Seattle), WA | Public Health Seattle & King County (data.kingcounty.gov, f29f-zza5) | Points, lower is better |
| Austin, TX | Austin Public Health (datahub.austintexas.gov, ecmv-9xxi) | 0-100, higher is better |
| Cincinnati, OH | Cincinnati Health Dept. (data.cincinnati-oh.gov, rg6p-b3h3) | No score |
| Boulder County, CO | Boulder County Public Health (data.colorado.gov, 6ytb-f2cq) | Points, lower is better |
| Montgomery County, MD | Montgomery County DHHS (data.montgomerycountymd.gov, dkrp-gr48) | No score. Pass, Fail, Closed and others |

**Any other Socrata portal.** Under *Advanced*, add any inspection dataset on a Socrata open-data portal with its address, dataset id and date column. Common column names (name, address, zip, score, result, violation) are recognized automatically.

### What you get

One record per inspection, even where the department publishes one row per violation:

- the restaurant: name, address, city, state, ZIP, phone, cuisine or facility type, risk level, coordinates and business id;
- the inspection: date, type, result, score (with `scoreDirection`, so you know whether higher is better), grade and inspection id;
- `violationCount`, `criticalViolations` and `violations`, which lists every violation with its code, description, critical flag, points and comments;
- `problem`, which is true for failed, closed, unsatisfactory or C-grade inspections and Austin scores under 70;
- `datasetUrl`, a link to the official dataset.

### Good to know

- **Fixes the traps in the raw data.**
  - New York and King County publish one row per violation; they are merged into one inspection.
  - Chicago repeats a visit once per license; the duplicates are removed.
  - Chicago's violations arrive as one long text, and are split into a list.
  - New York's "1900-01-01" placeholder dates are dropped.
- **Publishing delays.** Departments add inspections a few days after the visit. Keep **Days back** at 7 or more on a daily schedule, with **Only new** on, so late additions are not missed and nothing is sent twice.
- **Big windows.** Up to 50,000 rows are read per place per run. For long histories, use a shorter window, or add a free Socrata app token to avoid request limits.
- **If one place is down**, the others still run, and the status message names the place that failed.
- **Data is shown as published.** Inspection results are a snapshot of one visit. Check the department's own site before acting on a record.

### Pricing

Pay per event: one charge per inspection delivered. Runs that find nothing new cost only the platform's small start-up usage.

### Data sources and disclaimer

All data comes from official open-data portals run by the departments listed above. This Actor is not affiliated with, endorsed by or sponsored by any of them.

# Actor input Schema

## `sources` (type: `array`):

Which health departments to read.

## `daysBack` (type: `integer`):

How far back to look when no start date is set. Departments often publish inspections a few days late, so 7 is a good value for a daily schedule.

## `dateFrom` (type: `string`):

Only include inspections on or after this date (format YYYY-MM-DD). Leave empty to use the days-back setting.

## `dateTo` (type: `string`):

Only include inspections on or before this date (format YYYY-MM-DD). Leave empty for no end date.

## `onlyProblems` (type: `boolean`):

Failed, closed, unsatisfactory or C-grade inspections, and Austin scores under 70.

## `postalCodes` (type: `array`):

Only include restaurants in these ZIP codes. Leave empty for all ZIP codes.

## `nameKeywords` (type: `array`):

Only include restaurants whose name contains one of these words. Leave empty for all restaurants.

## `cuisines` (type: `array`):

For example pizza, chinese, bakery or school.

## `includeViolations` (type: `boolean`):

Include the full list of violations found in each inspection.

## `onlyNew` (type: `boolean`):

Turn on for scheduled runs. Skip inspections that were already delivered in a previous run, so each inspection is reported once.

## `maxResults` (type: `integer`):

Stop after this many inspections have been delivered in one run.

## `customDatasets` (type: `array`):

Any inspection dataset on a Socrata portal, for example \[{"label": "My county", "host": "data.example.gov", "dataset": "abcd-1234", "dateField": "inspection_date"}]. Common column names are recognized automatically.

## `appToken` (type: `string`):

Free from any Socrata portal (Developer settings). Raises the request limit for big windows. Stored as a secret.

## Actor input object example

```json
{
  "sources": [
    "nyc",
    "chicago"
  ],
  "daysBack": 7,
  "onlyProblems": false,
  "includeViolations": true,
  "onlyNew": false,
  "maxResults": 1000
}
```

# Actor output Schema

## `results` (type: `string`):

Every row delivered by this run, as a table you can download as CSV, Excel or JSON.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "sources": [
        "nyc",
        "chicago"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("texxupport/restaurant-inspection-alerts").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "sources": [
        "nyc",
        "chicago",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("texxupport/restaurant-inspection-alerts").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "sources": [
    "nyc",
    "chicago"
  ]
}' |
apify call texxupport/restaurant-inspection-alerts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,texxupport/restaurant-inspection-alerts"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/uNbYjEL3VdhNjBYn2/builds/PPQCqw5atZQpk4fZ3/openapi.json
