# CMS Nursing Home Portfolio Risk Alerts (`natstandridge/cms-nursing-home-risk-alerts`) Actor

Batch-audit CMS Medicare nursing home CCNs for overallRating, healthInspectionRating, staffingRating, specialFocusStatus, abuseIcon, totalNumberOfPenalties, totalAmountOfFinesUsd, riskFlags, and snapshot changes. Pay-Per-Event $0.10/facility, official CMS Provider Data.

- **URL**: https://apify.com/natstandridge/cms-nursing-home-risk-alerts.md
- **Developed by:** [Nathaniel Standridge](https://apify.com/natstandridge) (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

$100.00 / 1,000 delivered cms nursing-home facility reviews

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

## CMS Nursing Home Portfolio Risk Alerts

Review a bounded portfolio of US nursing homes against the official [CMS Provider Information dataset](https://data.cms.gov/provider-data/dataset/4pq5-n9py). Each run accepts 1–25 six-digit CMS Certification Numbers (CCNs), fetches the current active-provider records directly from the CMS API, and emits one dataset row per found facility review, including a clear result. An optional prior `OUTPUT.snapshot` avoids another dataset-item charge for unchanged checks of the same CMS processing date.

**Who uses it:** regional operators, lenders, investors, and compliance teams checking a known set of facilities every month. The review results show published low ratings, Special Focus Facility status, the CMS abuse icon, recorded aggregate penalties, and changes in those values. A clear result confirms only that none of this Actor's listed flag rules matched that current CMS record. It does not make a clinical or legal judgment or identify why a value changed.

### Input

```json
{"ccns":["015009"]}
```

Use exact six-digit strings so leading zeroes survive. `priorSnapshot` is optional: paste the `snapshot` from the previous complete run's `OUTPUT`. The Actor checks its format and fingerprint to catch accidental edits. It **cannot authenticate** a caller-supplied historical snapshot against CMS; comparisons are labeled `caller_supplied_snapshot`. Without a prior snapshot, each found facility produces a paid current review. With one, a found facility produces a new review if its CMS processing date advanced or it is new to the portfolio. A same-date unchanged record produces no paid row. The `OUTPUT.snapshot` contains every found facility for the next run.

| Option | Default | Limit | Behavior |
| --- | ---: | ---: | --- |
| `ccns` | required | 1–25 | Duplicates and malformed IDs fail before any request. |
| `priorSnapshot` | omitted | 25 records | Must be from this Actor's output format and contain only current portfolio CCNs. |
| `maxSourceAgeDays` | 90 | 30–365 | A processing date older than this fails before billing. |
| `maxResults` | 20 | 1–25 | If more reviews are needed, fail before billing rather than omit results. Raise both this and the run charge limit for 21–25 facilities. |
| `maxRunSeconds` | 180 | 60–240 | Bounds CMS reads and delivery. |

The API host and dataset are fixed. The Actor does not accept URLs, credentials, names, resident data, or addresses as input. It requests only the 12 CMS fields needed for the review, makes up to two short attempts per CCN, reads at most 64 KiB per response, and never follows redirects. A missing CCN is reported in `OUTPUT.notFoundCcns`; absence from the **active-provider** dataset does not establish that a facility closed.

### Output and interpretation

Each dataset row is a facility review containing CMS ratings, SFF status, abuse icon, aggregate penalty count and fine total, `reviewStatus` (`flagged`, `changed`, or `clear`), `riskFlags`, and exact `changes` (`field`, `previous`, `current`) when a prior record exists. The row includes the CMS processing date, age of that date at observation, and [source dataset URL](https://data.cms.gov/provider-data/dataset/4pq5-n9py). Low rating flags mean published values of 1 or 2. `penalties_recorded_in_cms_total` means the published aggregate count is greater than zero; it does **not** mean a new penalty occurred. A changed fine total or penalty count is a data change, not proof of an event during the comparison period. If a CMS field is blank, it remains `null`.

`OUTPUT` reports source coverage, missing CCNs, CMS processing dates, planned and delivered review counts, and a `snapshot` for the next run. If the spending limit covers only part of the portfolio, the run finishes with the delivered rows, `complete: false`, `reason: "charge_limit"`, and `snapshot: null`. Reuse a snapshot only from a complete run.

The billing model is **$0.10 per delivered facility review**, including clear results, with Apify's native `apify-default-dataset-item` event. The default $2 run charge limit and `maxResults=20` cover up to 20 facilities. To review 21–25 facilities, raise `maxResults` and the Apify run charge limit together; 25 rows cost at most $2.50. A same-date unchanged review with a supplied prior snapshot, or a CCN absent from the active-provider dataset, has no dataset-item charge. Repeating a run without the prior snapshot produces and charges another current review. Storage and platform costs, where applicable, are separate under Apify's rules. The Actor checks the configured event price before fetching CMS data, freezes its result plan before delivery, and reconciles dataset rows with charged events on retry. No savings, regulatory outcome, or clinical result is promised.

### Run cadence and limits

Run after the CMS Provider Information dataset's next processing update, commonly as part of a monthly review. `processingDate` is the source's date field; this Actor does not claim an exact publication schedule. A prior snapshot with the same processing date but different comparison fields is rejected. A newer prior processing date is also rejected. CMS may revise data or its API: if required fields, date format, or source availability change, the run fails without delivering an unverified review.

This Actor does not query a facility's detailed inspection deficiencies, individual residents, financial viability, or legal compliance. Review the source record and relevant authoritative documents before acting on a flag or change. The dataset is public government data; customer portfolio CCNs and snapshots stay in the user's Apify run input and output stores.

### Sources and market distinction

- [CMS Provider Information dataset and API](https://data.cms.gov/provider-data/dataset/4pq5-n9py): one current row per active nursing home.
- [CMS Nursing Home data dictionary](https://data.cms.gov/provider-data/sites/default/files/data_dictionaries/nursing_home/NH_Data_Dictionary.pdf): field meanings for ratings, Special Focus status, abuse icon, penalties, and processing date.
- [StarPRO pricing](https://getstarpro.com/pricing) and [NursingHomeLens pricing](https://nursinghomelens.com/pricing) show paid nursing-home monitoring and analysis budgets. Their broader products are not direct feature-equivalent substitutes.
- [Raw CMS ratings scraper on Apify](https://apify.com/parseforge/cms-nursing-home-ratings-scraper) returns source records. This Actor's bounded portfolio, explicit current flags and clear checks, caller-controlled comparison, and review queue serve a different recurring job.

These links establish a plausible budget and source contract, not proven demand for this Actor. Actual external paid use, retention, and contribution must be measured after release.

### Quick Integration (Apify MCP, n8n, Make & Python SDK)

#### 1. Apify MCP (`https://mcp.apify.com`) — Claude, Cursor, OpenAI Agents & ADK

Connect your AI agent directly to `https://mcp.apify.com/?actors=natstandridge/cms-nursing-home-risk-alerts` (synchronous <25s default prefill, `LIMITED_PERMISSIONS`, `$0.1`/event Pay-Per-Event):

```json
{
  "mcpServers": {
    "apify-cms-nursing-home-risk-alerts": {
      "url": "https://mcp.apify.com/?actors=natstandridge/cms-nursing-home-risk-alerts",
      "headers": { "Authorization": "Bearer <APIFY_TOKEN>" }
    }
  }
}
```

#### 2. n8n Workflow (Apify / HTTP Request Node)

- **Method / URL:** `POST https://api.apify.com/v2/acts/natstandridge~cms-nursing-home-risk-alerts/run-sync-get-dataset-items`
- **Header:** `Authorization: Bearer {{ $env.APIFY_TOKEN }}`
- **JSON Body:**

```json
{
  "ccns": [
    "065001"
  ]
}
```

#### 3. Make.com & Python SDK (`apify-client`)

In **Make.com**, select the **Apify -> Run an Actor** module for `natstandridge/cms-nursing-home-risk-alerts` (enable *Run synchronously*) followed by **Apify -> Get Dataset Items**. Or in Python:

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("natstandridge/cms-nursing-home-risk-alerts").call(run_input={"ccns": ["065001"]})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
```

# Actor input Schema

## `ccns` (type: `array`):

One to 25 exact six-digit CCNs for active nursing homes. Use strings to preserve leading zeroes. Duplicate CCNs are rejected.

## `priorSnapshot` (type: `object`):

Optional. Paste the snapshot from a previous complete run of this Actor. This caller-supplied comparison is checked for shape and accidental edits, but is not independently authenticated historical CMS data.

## `maxSourceAgeDays` (type: `integer`):

Fail without billing if any returned CMS processing date exceeds this age in days. Default 90.

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

If the portfolio needs more review results than this, fail before billing rather than silently omit facilities. Current clean results count. Default 20 fits the $2 default run charge limit; raise both limits to review 21–25 facilities.

## `maxRunSeconds` (type: `integer`):

Bound API reads and delivery. Default 180 seconds.

## Actor input object example

```json
{
  "ccns": [
    "015009"
  ],
  "maxSourceAgeDays": 90,
  "maxResults": 20,
  "maxRunSeconds": 180
}
```

# Actor output Schema

## `reviews` (type: `string`):

No description

## `summary` (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 = {
    "ccns": [
        "015009"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("natstandridge/cms-nursing-home-risk-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 = { "ccns": ["015009"] }

# Run the Actor and wait for it to finish
run = client.actor("natstandridge/cms-nursing-home-risk-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 '{
  "ccns": [
    "015009"
  ]
}' |
apify call natstandridge/cms-nursing-home-risk-alerts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,natstandridge/cms-nursing-home-risk-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/STB3gAzXdbeGAMLPD/builds/dMBa7whBUrQUZkp7N/openapi.json
