# CMS Nursing Home Ratings, Deficiencies & Fines Scraper (`groundplanes/cms-nursing-home-deficiency-penalty-scraper`) Actor

Pull US nursing homes from the official CMS Provider Data Catalog: Five-Star ratings, health deficiency counts, civil money penalties, payment denials, staffing and ownership, one row per facility, filtered by state, stars and fines.

- **URL**: https://apify.com/groundplanes/cms-nursing-home-deficiency-penalty-scraper.md
- **Developed by:** [Groundplane Labs](https://apify.com/groundplanes) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.10 / 1,000 facilities

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## CMS Nursing Home Ratings, Deficiencies & Fines Scraper

Pull US nursing homes from the official CMS Provider Data Catalog and get one row per facility: Five-Star ratings, health deficiency count, civil money penalties (fines), payment denials, staffing hours, RN turnover, ownership type, affiliated entity, beds and occupancy. Filter by state, star rating, Special Focus status, total fines and ownership type.

> This actor is an independent tool. It is not affiliated with or endorsed by the Centers for Medicare & Medicaid Services (CMS).

### What it does

- Reads three official, keyless CMS datasets through the Provider Data Catalog API on data.cms.gov: **Provider Information** (`4pq5-n9py`), **Penalties** (`g6vv-u9sr`) and **Health Deficiencies** (`r5ix-sfxw`).
- Asks CMS only for the states you choose. Every other filter (stars, fines, Special Focus, ownership) runs inside the actor, because CMS returns numbers as text and text comparisons would give wrong answers.
- Counts each facility's health deficiencies on the CMS side (one count per facility, not 400,000 raw rows) and checks that the counts add back up to the dataset total.
- Cross-checks every facility's fines and payment denials against the separate Penalties dataset. One row per facility, always: penalties are summed per facility first, so a facility with ten fines is still one row.
- Sorts by total fines, highest first, and stops at `maxItems`.

### Who it's for

- Healthcare staffing agencies looking for facilities with low staffing ratings and high turnover.
- Private equity and senior housing buyers screening distressed facilities (low stars, large fines, Special Focus status).
- Compliance consultants and survey-readiness firms finding facilities with recent deficiencies and penalties.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `states` | array of strings | `["FL", "TX", "CA", "OH", "PA", "NY"]` | 2-letter state codes. Empty = all states and territories. |
| `maxOverallStarRating` | integer 0 to 5 | `2` | Keep facilities rated at or below this. While it is 1 to 5, facilities CMS has not rated are left out. `0` = no star filter (includes unrated facilities). |
| `onlySpecialFocusFacilities` | boolean | `false` | Keep only facilities with Special Focus status `SFF`. `SFF Candidate` facilities are not included. |
| `minTotalFinesAmountUsd` | integer | `10000` | Keep facilities whose total fines are at least this. `0` = no fines filter. |
| `ownershipTypeFilter` | string | `""` | CMS ownership type contains this text, case-insensitive (for example `For profit`, `Non profit`, `Government`, `Limited Liability`). Text that matches no published type fails the run and lists the valid ones. |
| `maxItems` | integer | `1000` | Maximum facilities, highest total fines first. |

All filters must match together.

#### Example input (canary)

```json
{
  "states": ["FL", "TX", "CA", "OH", "PA", "NY"],
  "maxOverallStarRating": 2,
  "onlySpecialFocusFacilities": false,
  "minTotalFinesAmountUsd": 10000,
  "ownershipTypeFilter": "",
  "maxItems": 1000
}
```

On 2026-11-01 this input matched 1,312 of the 5,208 facilities in those six states and returned the 1,000 with the highest fines.

#### Example run options (default $50 max charge)

```json
{ "maxTotalChargeUsd": 50 }
```

The actor checks your max charge before every dataset push and stops cleanly when the limit is reached.

### Output

One row per facility. Blank values in the CMS data stay `null`; they are never turned into 0.

| Field | Type | Description |
|---|---|---|
| `cmsCertificationNumberCcn` | string | CMS Certification Number, the facility's 6-character Medicare ID. |
| `providerName` | string | Facility name. |
| `providerAddress` | object | `street`, `city`, `state`, `zip`, `phone` (the facility's main number). |
| `ownershipType` | string or null | For example `For profit - Corporation`. |
| `affiliatedEntityName` | string or null | Affiliated entity (chain) name, when the facility belongs to one. |
| `numberOfCertifiedBeds` | integer or null | Certified beds. |
| `averageResidentsPerDay` | number or null | Average residents per day. |
| `occupancyRatePct` | number or null | **Our calculation, not a CMS field:** average residents per day ÷ certified beds × 100, rounded to 0.1. Null when beds are 0 or missing. Not capped at 100. |
| `overallRatingStars` | integer or null | Overall Five-Star rating, 1 to 5. Null when CMS has not rated the facility. |
| `healthInspectionRatingStars` | integer or null | Health inspection rating, 1 to 5. |
| `staffingRatingStars` | integer or null | Staffing rating, 1 to 5. |
| `specialFocusStatus` | string or null | `SFF`, `SFF Candidate`, or null. |
| `abuseIconFlag` | string or null | `Y` when CMS shows its abuse icon for the facility, else `N`. |
| `totalHealthDeficienciesCount` | integer or null | Health deficiency citations CMS lists for the facility in the Health Deficiencies dataset: the three most recent standard inspection cycles plus complaint inspections. This is more than the "rating cycle" counts on the Care Compare summary. Null when CMS lists none and has no rated inspection. |
| `numberOfFines` | integer or null | Civil money penalties (fines). |
| `totalAmountOfFinesUsd` | number or null | Total fines in US dollars. |
| `numberOfPaymentDenials` | integer or null | Medicare payment denials. |
| `totalNurseStaffingHoursPerResidentDay` | number or null | Reported total nurse staffing hours per resident per day. |
| `rnTurnoverPct` | number or null | Registered nurse turnover, percent. |
| `cmsProcessingDate` | string or null | Date CMS processed this data release (YYYY-MM-DD). |

Fines and payment denials are the values CMS publishes for each facility (about the last three years). The actor checks them against the Penalties dataset on every run.

#### Sample row (synthetic)

```json
{
  "cmsCertificationNumberCcn": "999999",
  "providerName": "Example Care Center",
  "providerAddress": {"street": "100 Example Rd", "city": "Springfield", "state": "OH", "zip": "45501", "phone": "5555550100"},
  "ownershipType": "For profit - Limited Liability company",
  "affiliatedEntityName": "Example Health Group",
  "numberOfCertifiedBeds": 120,
  "averageResidentsPerDay": 96.4,
  "occupancyRatePct": 80.3,
  "overallRatingStars": 1,
  "healthInspectionRatingStars": 1,
  "staffingRatingStars": 2,
  "specialFocusStatus": "SFF Candidate",
  "abuseIconFlag": "Y",
  "totalHealthDeficienciesCount": 58,
  "numberOfFines": 3,
  "totalAmountOfFinesUsd": 214500.0,
  "numberOfPaymentDenials": 1,
  "totalNurseStaffingHoursPerResidentDay": 3.42,
  "rnTurnoverPct": 61.5,
  "cmsProcessingDate": "2026-10-01"
}
```

### How pricing works

Pay per result. You only pay for rows returned.

### Data source and terms

- **CMS Provider Data Catalog** (data.cms.gov/provider-data), the source behind Medicare Care Compare. Public US government data, no login or API key.
- **Update cadence:** CMS refreshes these datasets about once a month. Every row carries `cmsProcessingDate`, and the run status shows it.
- The actor checks at the start of each run that all three dataset IDs still point to the same datasets and still have every column it reads. CMS occasionally re-issues dataset IDs; if that happens the run fails with a clear message instead of returning the wrong data.

### Limits and FAQ

- **Unrated facilities** (new facilities, or ones CMS has not rated) are left out whenever `maxOverallStarRating` is 1 to 5. Set it to `0` to include them.
- **Special Focus:** `onlySpecialFocusFacilities` keeps `SFF` only. To see candidates too, leave it off and filter on `specialFocusStatus`.
- **Speed (measured on a local test machine, 2026-11-01):** the default six-state run took about 40 seconds; all states (about 14,700 facilities) took about 100 seconds.
- **Zero matches** end as `Complete: 0 facilities matched your filters` with counts of what each filter removed.

### Troubleshooting

- **Failed: "no longer resolves in the metastore" or "now holds ..."**: CMS re-issued a dataset ID. Nothing was delivered.
- **Failed: "schema drift ... core column(s) missing or renamed"**: CMS changed a column the actor reads; the column is named.
- **Failed: "reports N facilities nationwide (normally about 15,000)"**: the CMS dataset looks truncated.
- **Failed or PARTIAL: "disagree between Provider Information and Penalties"**: the two CMS datasets give different fines for some facilities. Under 20% the rows ship with the Provider Information values and the run says how many disagree; above that, nothing ships.
- **PARTIAL: "CMS data is stale"**: the newest CMS release is more than 75 days old.
- **PARTIAL: max charge limit reached**: raise the max charge for the run.

If this keeps happening, please open an issue on this actor's Issues tab and we'll fix it fast.

Found a problem or need a field? Open an issue on the Issues tab; we respond quickly.

### Changelog

- **0.1 (2026-11-01):** First build.

# Actor input Schema

## `maxItems` (type: `integer`):

Maximum facilities to return, highest total fines first.

## `maxOverallStarRating` (type: `integer`):

Keep facilities rated at or below this many stars (1 to 5). Facilities CMS has not rated are left out while this is 1 to 5. Set 0 for no star filter (includes unrated facilities).

## `minTotalFinesAmountUsd` (type: `integer`):

Keep facilities whose total civil money penalties (as CMS reports them, about the last 3 years) are at least this amount. Set 0 for no fines filter.

## `onlySpecialFocusFacilities` (type: `boolean`):

Keep only facilities CMS lists as a Special Focus Facility (status SFF). SFF Candidates are not included; see specialFocusStatus in the output.

## `ownershipTypeFilter` (type: `string`):

Keep facilities whose CMS ownership type contains this text, case-insensitive (for example 'For profit', 'Non profit', 'Government', 'Limited Liability'). Text that matches no published type fails the run and lists the valid ones.

## `states` (type: `array`):

2-letter state codes (for example FL, TX). Leave empty for all states and territories.

## Actor input object example

```json
{
  "maxItems": 1000,
  "maxOverallStarRating": 2,
  "minTotalFinesAmountUsd": 10000,
  "onlySpecialFocusFacilities": false,
  "ownershipTypeFilter": "",
  "states": [
    "FL",
    "TX",
    "CA",
    "OH",
    "PA",
    "NY"
  ]
}
```

# Actor output Schema

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

No description

# 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 = {
    "maxItems": 1000,
    "maxOverallStarRating": 2,
    "minTotalFinesAmountUsd": 10000,
    "ownershipTypeFilter": "",
    "states": [
        "FL",
        "TX",
        "CA",
        "OH",
        "PA",
        "NY"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("groundplanes/cms-nursing-home-deficiency-penalty-scraper").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 = {
    "maxItems": 1000,
    "maxOverallStarRating": 2,
    "minTotalFinesAmountUsd": 10000,
    "ownershipTypeFilter": "",
    "states": [
        "FL",
        "TX",
        "CA",
        "OH",
        "PA",
        "NY",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("groundplanes/cms-nursing-home-deficiency-penalty-scraper").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 '{
  "maxItems": 1000,
  "maxOverallStarRating": 2,
  "minTotalFinesAmountUsd": 10000,
  "ownershipTypeFilter": "",
  "states": [
    "FL",
    "TX",
    "CA",
    "OH",
    "PA",
    "NY"
  ]
}' |
apify call groundplanes/cms-nursing-home-deficiency-penalty-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,groundplanes/cms-nursing-home-deficiency-penalty-scraper"
        }
    }
}
```

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/UM4YRSu0huLM8W7Ga/builds/sETkxTzC836erF5bu/openapi.json
