# CMS Hospital Quality Scraper — Star Ratings, 13 Fields (`themineworks/cms-hospital-quality`) Actor

Scrape CMS Hospital Compare data: overall star ratings plus hospital name, type, ownership, location and emergency services flag for 4,500+ US hospitals. Filter by state, city, name or stars. No API key. Clean JSON. Use it as an MCP server in Claude, ChatGPT & AI agents.

- **URL**: https://apify.com/themineworks/cms-hospital-quality.md
- **Developed by:** [The Mine Works](https://apify.com/themineworks) (community)
- **Categories:** Other, Business, MCP servers
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 hospital scrapeds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## 🏥 CMS Hospital Quality Scraper: Star Ratings (No Key)

### Overview

CMS Hospital Quality Scraper pulls the official CMS Hospital Compare dataset from Medicare.gov as clean, structured JSON: overall star rating (1 to 5), hospital name, type, ownership, location, contact details, and emergency-services flag. Coverage runs to 4,500+ Medicare-certified acute-care hospitals across every US state. Built for healthcare analytics, site selection, quality benchmarking, and investment due diligence.

The Centers for Medicare & Medicaid Services publishes this dataset as the federal government's official hospital quality benchmark. It powers Medicare.gov's hospital finder and drives decisions at insurers, health systems, investors, and researchers. The underlying Socrata API is open but demands dataset IDs and SODA query syntax, so this actor handles the plumbing and returns one clean record per hospital.

Reliability posture: blocked, empty, or failed runs are never charged. You only pay for a hospital record that was actually delivered.

✅ No API key | ✅ Official CMS Provider Data Catalog | ✅ Zero charge on empty runs | ✅ Pay only for hospitals delivered | ✅ MCP-ready for AI agents

### Features

Overall star rating (1 to 5) plus name, type, ownership, address, phone, and emergency-services flag on every record.
Filter by state, city, hospital name (partial match), or minimum star rating to narrow to a target set.
Full coverage: about 4,500 Medicare-certified acute-care hospitals across all 50 states plus DC.
Direct pulls from the official CMS Provider Data Catalog, so there is no key, no cookies, and no anti-bot friction.
One flat JSON record per hospital, ready for BI dashboards, network-adequacy models, or LLM ingestion.

### How it works

The actor queries the CMS Provider Data Catalog's Socrata endpoint for the Hospital General Information dataset, applies your state, city, name, or star-rating filters server-side, and flattens the response into one record per facility. Pagination is handled internally so you can pull anywhere from 1 to 5,000 hospitals in a single run.

Empty searches (an unusual state code, a strict star threshold, a name that matches nothing) are recognized before charging: no matches, no charge.

### 🧾 Input configuration

```json
{
  "state": "NY",
  "minStars": 4,
  "maxResults": 100
}
```

### 📤 Output format

```json
{
  "hospital_name": "PROVIDENCE ST JOSEPH HOSPITAL",
  "facility_id": "050006",
  "address": "2700 DOLBEER ST",
  "city": "EUREKA",
  "state": "CA",
  "zip_code": "95501",
  "county_name": "HUMBOLDT",
  "phone_number": "(707) 445-8121",
  "hospital_type": "Acute Care Hospitals",
  "hospital_ownership": "Voluntary non-profit - Private",
  "overall_star_rating": "4",
  "emergency_services": "Yes",
  "scraped_at": "2026-07-15T04:15:15.503Z"
}
```

Every hospital record contains these fields:

| Field | Description |
| --- | --- |
| 🏥 `hospital_name` | Facility name as filed with CMS |
| 🆔 `facility_id` | CMS Certification Number (CCN) |
| 🏠 `address` | Street address |
| 🌆 `city` | City |
| 🗺️ `state` | Two-letter state code |
| 📮 `zip_code` | ZIP code |
| 📍 `county_name` | County |
| 📞 `phone_number` | Main phone number |
| 🩺 `hospital_type` | CMS facility type (e.g. Acute Care) |
| 🏛️ `hospital_ownership` | Ownership category (non-profit, government, proprietary) |
| ⭐ `overall_star_rating` | CMS overall star rating (1 to 5) |
| 🚑 `emergency_services` | Yes or No |
| 🕒 `scraped_at` | ISO timestamp of capture |

### 💼 Common use cases

**Healthcare investment and diligence**
Benchmark acquisition targets against state and national peers on star rating and ownership type.
Screen for high-performing hospitals (4 or 5 stars) in a target metro before an outreach cycle.

**Payer network adequacy and benchmarking**
Build network-adequacy models with facility-level counts by state and ownership.
Compare star ratings across contracted vs. non-contracted hospitals to prioritize renegotiation.

**Health-system strategy and site selection**
Map competitive density and star distribution in a candidate expansion market.
Identify referral targets by county, star rating, and emergency-services capability.

**Research and journalism**
Study quality variation across states, ownership types, or metros using a consistent CMS dataset.
Automate quarterly refreshes to catch new star-rating publications.

### 🚀 Getting started

1. Open the actor and enter a State code (e.g. `CA`), or leave blank for all 50 states.
2. Optionally add a City or partial Hospital name to narrow further.
3. Set Minimum star rating (1 to 5) if you only want top performers.
4. Set Max hospitals (default 200) to cap the run.
5. Click Save & Start, then download as JSON, CSV, or Excel, or pull via API or MCP.

### FAQ

**Do I need an API key?**
No. The CMS Provider Data Catalog is fully open. No login, no key, no rate-limit paperwork.

**How current is the data?**
CMS updates the Hospital Compare dataset quarterly. The actor always queries the live endpoint, so you get the latest release.

**How many hospitals are covered?**
Roughly 4,500 Medicare-certified acute-care hospitals across all 50 states plus DC and territories.

**What is the star rating based on?**
CMS calculates the overall star rating from up to five care areas: mortality, safety of care, readmission, patient experience, and timely and effective care. Hospitals with fewer than three scored groups receive no rating.

**Can I get raw HCAHPS scores?**
The overall star rating already incorporates HCAHPS. For raw HCAHPS survey scores by domain (communication with nurses, responsiveness, quietness), contact us and we can build a companion actor on the HCAHPS-specific CMS dataset.

### Use in Claude, ChatGPT & any MCP agent

```
https://mcp.apify.com/?tools=themineworks/cms-hospital-quality
```

Or call it programmatically with the Apify client:

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

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('themineworks/cms-hospital-quality').call({
  state: 'NY',
  minStars: 4,
  maxResults: 100,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### 🛠️ Complete your healthcare data pipeline

Hospital ratings are one signal. Layer in the rest of the healthcare stack:

- **[Medicare Part D Drug Spending](https://apify.com/themineworks/medicare-part-d-drug-spending)**: total spend, claims, beneficiaries, and unit cost for every drug in Medicare Part D.
- **[openFDA Scraper](https://apify.com/themineworks/openfda-unified-crawler)**: drug adverse events (FAERS), recalls, labels, device 510k, and food enforcement.
- **[Socrata Open Data Scraper](https://apify.com/themineworks/socrata-open-data)**: any US federal, state, or city Socrata portal (CDC, HHS, CMS, NYC, more).

Typical flow: benchmark hospitals with this actor, pair with Part D pricing for payer economics, and pull FAERS for the safety signal on prescribed drugs.

Found a bug or have a feature request? Open an issue on the actor's Apify Console page or reach out through the Apify profile.

# Actor input Schema

## `state` (type: `string`):

Filter by US state code (e.g. CA, NY, TX). Leave blank for all states.

## `city` (type: `string`):

Filter by city name.

## `hospitalName` (type: `string`):

Filter by hospital name — partial matches work.

## `minStars` (type: `integer`):

Return only hospitals with this overall star rating or higher (1-5).

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

Maximum hospitals to return.

## Actor input object example

```json
{
  "state": "CA",
  "maxResults": 25
}
```

# 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 = {
    "state": "CA",
    "maxResults": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("themineworks/cms-hospital-quality").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 = {
    "state": "CA",
    "maxResults": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("themineworks/cms-hospital-quality").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "state": "CA",
  "maxResults": 25
}' |
apify call themineworks/cms-hospital-quality --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=themineworks/cms-hospital-quality",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

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