# CQC Care Service Change & Risk Signals (`starshaped_bullsnake/cqc-care-service-change-risk-signals`) Actor

Detect decision-useful changes in official CQC care service data.

- **URL**: https://apify.com/starshaped\_bullsnake/cqc-care-service-change-risk-signals.md
- **Developed by:** [Starshape Tools](https://apify.com/starshaped_bullsnake) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 cqc care service change signals

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?

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

## CQC Care Service Change & Risk Signals

This Actor compares complete official CQC public snapshots and emits one machine-readable row per meaningful change. It is a change-intelligence Actor, not a facility-directory scraper.

### Supported signals

`NEW_REGISTRATION`, `DEACTIVATED`, `RATING_DOWNGRADE`, `RATING_UPGRADE`, and `PROVIDER_CHANGE`. Identity is the official CQC Location ID; provider changes require the official Provider ID. A missing active row alone is never treated as deactivation: explicit evidence from CQC's archived-locations sheet is required. Archived does not necessarily mean the business closed.

Severity (`HIGH`, `MEDIUM`, `LOW`) is a conservative heuristic classification of an observed change, not a prediction or risk probability.

### Official source

The Actor resolves the current files from [CQC's Using CQC data page](https://www.cqc.org.uk/about-us/transparency/using-cqc-data): the weekly Care Directory CSV plus the monthly ratings and deactivated-location ODS files. CQC warns that its digital-system migration can delay directory updates, including registration cancellations. This Actor therefore does not claim real-time freshness.

### First run and state

The first successful live run creates a baseline and emits no fake `NEW_REGISTRATION` signals. `baselineOnly: true` creates a missing baseline but never resets an existing one. State uses the named KVS `cqc-care-service-change-risk-signals-state`, a small scope-specific `CURRENT` pointer, complete generation metadata, and deterministic chunks of at most 2,000 compact entities. `localAuthorities` is source scope and changes the scope fingerprint. Signal, service, rating, postcode, and inactive filters are output-only and cannot change entity identity.

Detected signals enter a durable queue before `CURRENT` is committed. Dataset delivery advances its cursor only after a successful write. Large batches are split across runs by `maxItems`; while a backlog exists, it is drained before fetching another source version. Consumers can additionally deduplicate with deterministic `signalId`.

### Try it with sample data

```json
{"mode":"sample"}
```

Sample mode is a user-facing deterministic demonstration: it makes zero external requests, reads/writes no production state, uses the production diff engine, and emits rating downgrade, provider change, and explicit deactivation examples.

### Example live input

```json
{"mode":"live","localAuthorities":["Leeds"],"baselineOnly":true,"maxItems":100}
```

Schedule live mode weekly or monthly. A later run with the same complete source state and no pending backlog emits zero rows.

### Example output

```json
{"signalId":"…","signalType":"RATING_DOWNGRADE","severity":"HIGH","signalSummary":"Rating changed from Good to Requires improvement","detectedAt":"2026-01-02T00:00:00.000Z","sourceObservedAt":"2026-01-02T00:00:00.000Z","entityType":"location","entityId":"L1","name":"Oak Care","address":null,"postcode":null,"localAuthority":null,"serviceType":null,"previousValue":"Good","currentValue":"Requires improvement","previousRating":"Good","currentRating":"Requires improvement","reportDate":null,"providerId":"P1","providerName":"Alpha","sourceUrl":"https://www.cqc.org.uk/location/L1"}
```

### Limitations and compute

The public sheets do not expose a sufficiently stable report identifier/publication semantic for `NEW_INSPECTION_REPORT`, so it is not emitted. Manager, bed-capacity, service-type, and specialism signals are also excluded from this MVP. Whole-England runs download and parse large public files and use more memory/compute; authority scope filters storage after the official country file is fully validated. Required-source or schema failures fail closed and preserve the last committed baseline.

# Actor input Schema

## `mode` (type: `string`):

Live official sources or offline sample.

## `signalTypes` (type: `array`):

Optional output-only filter: NEW\_REGISTRATION, DEACTIVATED, RATING\_DOWNGRADE, RATING\_UPGRADE, or PROVIDER\_CHANGE.

## `serviceTypes` (type: `array`):

Optional exact output filter.

## `ratings` (type: `array`):

Optional exact current-rating filter.

## `postcodePrefix` (type: `string`):

Optional output filter.

## `localAuthorities` (type: `array`):

Exact names defining isolated source scope.

## `includeInactive` (type: `boolean`):

Include explicit archive signals.

## `baselineOnly` (type: `boolean`):

Create a missing baseline without resetting one.

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

Maximum queued signals emitted per run.

## Actor input object example

```json
{
  "mode": "sample",
  "includeInactive": false,
  "baselineOnly": false,
  "maxItems": 100
}
```

# Actor output Schema

## `OUTPUT` (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 = {
    "mode": "sample"
};

// Run the Actor and wait for it to finish
const run = await client.actor("starshaped_bullsnake/cqc-care-service-change-risk-signals").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 = { "mode": "sample" }

# Run the Actor and wait for it to finish
run = client.actor("starshaped_bullsnake/cqc-care-service-change-risk-signals").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 '{
  "mode": "sample"
}' |
apify call starshaped_bullsnake/cqc-care-service-change-risk-signals --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,starshaped_bullsnake/cqc-care-service-change-risk-signals"
        }
    }
}
```

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/JspPo2ZlZ4ZUaqjnf/builds/Qc2GQX0B7jKlbPJCb/openapi.json
