# UK Care Tender Monitor with CQC Matching (`refreshing_outlook/uk-care-tender-monitor`) Actor

Track new UK care-sector tenders from Find a Tender and Contracts Finder, with optional CQC provider and location enrichment. Pay only for new or materially changed matches, apart from the platform start event.

- **URL**: https://apify.com/refreshing_outlook/uk-care-tender-monitor.md
- **Developed by:** [Craig Armstrong](https://apify.com/refreshing_outlook) (community)
- **Categories:** Lead generation, Business, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 tender matches

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/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

## UK Care Tender Monitor with CQC Matching

Track UK public care-sector procurement from the official **Find a Tender** and **Contracts Finder** OCDS APIs. This incremental monitor emits one attributed dataset row for each new or materially changed matching tender, helping you follow planning notices, tenders and awards without repeatedly processing unchanged records.

Built with Node.js and Apify SDK v3. Pay-per-event (PPE) price is **$0.006 per new or materially changed matching tender**; CQC enrichment adds no charge. Store listing: [refreshing_outlook/uk-care-tender-monitor](https://apify.com/refreshing_outlook/uk-care-tender-monitor).

### Choose your monitoring scope

| Preset | Includes | Excludes |
| --- | --- | --- |
| `general` (default) | CPV `85` health/social work and `331` medical equipment | `852` veterinary services |
| `careHome` | CPV `8531`, including `85311`, `85312` and related social work services | Nothing by default |

The careHome preset focuses on social work services including residential care; CPV alone does not guarantee a care-home opportunity. Keywords are optional in both modes. If supplied, any keyword can match, and the notice must also pass CPV and all other active filters.

Example input for an independent care-home monitor:

```json
{
  "monitorMode": "careHome",
  "sources": "both",
  "stages": ["planning", "tender", "award"],
  "keywords": [],
  "regions": [],
  "sinceLastRun": true,
  "stateKey": "care-home",
  "enrichCqc": true,
  "cqcStrongMatchesOnly": false,
  "includeWeakInDigest": false
}
```

Omit `cpvPrefixes` and `cpvExcludePrefixes` to use preset defaults. Each explicit list overrides its corresponding preset list independently; inclusion must be non-empty, while exclusions can be `[]`. The input editor leaves custom CPV lists unset so they do not mask mode defaults. See [monitoring modes](docs/MONITOR-MODES.md) and the [input schema](.actor/input_schema.json).

Keywords match title, description or buyer using case-insensitive substrings. Regions match buyer or delivery locality/region; notices with no location data fail an active region filter. GBP bounds are inclusive; unknown and non-GBP values pass. Notices without eligible CPV codes do not match. Default stages include planning, tender and award, including their updates, amendments and cancellations.

### Optional CQC enrichment

Add Care Quality Commission provider and location candidates to tender rows, with `strong`, `possible` or `weak` strength labels. Enrichment searches **England only**, within already-resolved local authorities; there is no nationwide fallback. These are candidate links for review, not proof of regulation or a contractual relationship.

**Notices seldom carry both a site postcode and a care-home name, so strong postcode-and-name matches are rare.** Buyer headquarters postcodes do not count as site evidence. Office-type locations are excluded from postcode rules, and same-name provider siblings remain ambiguous possible matches. At most three ranked candidates are retained per tender. High-confidence candidates alone are eligible for optional rating lookups, capped at 25 requests per run by default; authority lists and ratings are cached for seven days.

Digests show strong CQC matches by default; the dataset keeps every match with its strength label unless cqcStrongMatchesOnly is true.

`OUTPUT.cqcDigest` reports counts of strong, possible and weak candidates across all matched rows, plus up to five row examples under `strongExamples`. Counts include unchanged and already-emitted tenders. Set `includeWeakInDigest: true` to expand examples to possible and weak candidates too; dataset rows remain unaffected. Set `cqcStrongMatchesOnly: true` to remove non-strong candidates from both dataset and subsequent digest; tenders still emit when no candidates remain.

Enrichment defaults to enabled. Provide your own free CQC subscription key in the secret `cqcApiKey` input (Apify Console redacts it), or set `CQC_API_KEY` in the local/run environment as a fallback. Sign up at the [CQC API portal](https://api-portal.service.cqc.org.uk/) — the public directory APIs used here are free with a subscription key. The Actor never ships a shared key. Without either source, enrichment skips with the warning `CQC enrichment skipped: API key unavailable` and tender monitoring continues. Neither Find a Tender nor Contracts Finder requires credentials. Local `cqcHints` are separate keyword/CPV heuristics and establish no regulatory status. Full evidence rules: [CQC matching](docs/CQC-MATCHING.md).

### Dataset and run summary

Each row includes the tender identifier, source, buyer, CPV codes, available value and deadline, coarse buyer address, notice links, change type, fingerprint and attribution. Descriptions and richer delivery scope are used in memory only.

Sanitised fictional example row (illustrative identifiers, no live notice):

```json
{
  "ocid": "ocds-fictional-care-001",
  "source": "fts",
  "title": "Residential care services framework",
  "buyerOrganisation": "Example Borough Council",
  "cpvCodes": ["85311000"],
  "valueAmount": 250000,
  "valueCurrency": "GBP",
  "deadline": "2026-12-01T12:00:00.000Z",
  "region": "Example Region",
  "buyerAddress": { "locality": "Example Borough", "region": "Example Region", "postcode": null },
  "stageOrNoticeType": "tender",
  "noticeUrls": [],
  "publishedDate": "2026-11-01T10:00:00.000Z",
  "releaseId": "fictional-release-001",
  "changeType": "new",
  "fingerprint": "illustrative-sha256-fingerprint",
  "cqcHints": { "careRegulatedLikely": true, "serviceHints": ["care_home", "care_social_work"], "matchedTerms": ["residential care"] },
  "cqcMatches": [],
  "attribution": "Contains public sector information licensed under the Open Government Licence v3.0. Source: Find a Tender Service, Cabinet Office."
}
```

`OUTPUT` contains `complete`, `stoppedReason`, source windows, tender counts and `cqcDigest`. An empty digest is:

```json
{
  "strongMatches": 0,
  "possibleMatches": 0,
  "weakMatches": 0,
  "strongExamples": []
}
```

Material changes cover title, buyer, CPV, value/currency, deadline, region and stage. Notice IDs, publication dates, links, CQC hints and enrichment do not affect fingerprints or trigger extra charges.

### Run locally

Requires Node.js 20 or later; the Docker image uses Node 22.

```sh
npm install
npm test
```

Tests are offline with mocked HTTP. For a live local run, write input to `storage/key_value_stores/default/INPUT.json` (include `cqcApiKey` only if you want enrichment; prefer env `CQC_API_KEY` locally), then run `npm start`. This contacts the public APIs. `CRAWLEE_STORAGE_DIR` overrides `./storage`; existing local storage is preserved. Keep storage and environment files out of Git, and never print credentials or commit keys.

Live sample commands are separate, explicitly invoked operations and are never part of tests:

| Command | Scope and local output |
| --- | --- |
| `npm run live-sample` | Public tender APIs, 36 hours, five pages per source; sanitised output under `samples/` |
| `npm run live-cqc-enrich` | 36-hour CQC-enriched sample; requires the local CQC key; writes samples and `docs/CQC-LIVE-ENRICH.md` |
| `npm run live-cqc-carehome` | 21-day careHome preset, no keywords, 80 pages per source; requires the local CQC key; writes samples and `docs/CQC-LIVE-CAREHOME.md` |

Both enriched sample scripts highlight strong examples and count possible and weak matches separately. They use no Apify cloud or spend. No live sample is needed for development validation.

### Incremental state and reliability

The first run looks back seven days. Subsequent windows start one hour before each source's checkpoint. `dateFrom` seeds a run when no checkpoint applies; `dateTo` sets its end. Explicit `dateTo` and `sinceLastRun: false` runs do not advance checkpoints. To backfill after changing mode or filters, use `fullRefresh: true` with `dateFrom`, or a separate `stateKey`. Full refresh retains emitted keys to avoid repeat charges.

| Local record | Contents |
| --- | --- |
| `SNAPSHOT` | Compact fingerprints and release metadata, pruned after 400 days |
| `RUN_METADATA` | Per-source checkpoints and last completed run counts |
| `EMITTED_KEYS` | Latest 50,000 unique `ocid:fingerprint` keys |
| `CQC_CACHE` | Sanitised authority lists and optional ratings, valid for seven days |
| `OUTPUT` | Completion status, windows, counts and CQC digest |

A non-default `stateKey` appends `-{stateKey}` to each record, including OUTPUT. All sources and enrichment finish before tender writes or charging. Incomplete fetches, failed event writes and spending stops never advance snapshots or checkpoints. A spending stop remembers written rows so a rerun can skip them. Dataset writes, charges and state persistence are not transactional: a crash can repeat a batch, and later failures cannot undo earlier successful charges. Deduplicate downstream on `ocid` plus `fingerprint`. A return to an older fingerprint is suppressed while its emitted key remains retained.

Find a Tender requests run at least ten seconds apart; Contracts Finder defaults to one second. Retries honour throttling and use a six-minute retry window, followed by a final throttled attempt that can extend beyond it. Contracts Finder 403 waits default to five minutes. Reaching `maxPages` (default 50 per source, shared across Find a Tender stages for that window) first bisects the date window and retries each half; it only fails if a window shorter than two seconds still overruns, or the split budget is exhausted. Narrow the window or raise `maxPages` if that happens. Missing source CPV, value or location fields can limit recall. The monitor uses APIs only, with fixed request paths and validated pagination cursors; it does not download documents, scrape HTML, schedule runs or send notifications.

### Pricing

PPE: **$0.006 per new or materially changed matching tender row**. Empty runs, unchanged notices and already-emitted fingerprints incur no custom event charge, apart from the platform start event ($0.00005). CQC enrichment is never charged. Ten new matches would cost $0.06 in custom events; 100 would cost $0.60.

See [pricing and transaction limits](docs/PRICING.md) and [Store listing](docs/STORE-LISTING.md).

### Privacy and attribution

The monitor strips contact, person, email, phone and fax keys recursively before processing and redacts email addresses and UK telephone numbers in output text. It persists no raw API records, descriptions, street addresses, suppliers, recipients or documents. Business organisation names and coarse buyer addresses remain. Text heuristics cannot recognise every personal name embedded in prose; keep personal data and credentials out of filters and state keys.

Contains public sector information licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/). Source: **Find a Tender Service, Cabinet Office**.

Contains public sector information licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/). Source: **Contracts Finder, Crown Commercial Service**.

Each dataset row carries the corresponding source attribution. Optional CQC enrichment uses Care Quality Commission public API data; matching labels do not imply CQC endorsement.

### Changelog

- 0.1.6: if a source hits `maxPages` after returning releases, the Actor bisects the date window and finishes the fetch. It still fails, without writing or charging, when a window cannot be split.

# Actor input Schema

## `monitorMode` (type: `string`):

Defaults to general: health, social work and medical equipment. careHome uses social work CPV 8531, including residential care. Explicit CPV lists override each preset list independently.

## `sources` (type: `string`):

Monitor both official OCDS APIs by default, or select Find a Tender or Contracts Finder.

## `stages` (type: `array`):

Defaults to planning, tender and award. Allowed values: planning, tender, award. Select which stages to monitor; updates, amendments and cancellations of those stages also qualify.

## `cpvPrefixes` (type: `array`):

Optional override: 2–8 digit prefixes. Omit for mode defaults: general \["85", "331"], careHome \["8531"]. An explicit list overrides the preset and must contain at least one prefix.

## `cpvExcludePrefixes` (type: `array`):

Optional override. Omit for mode defaults: general \["852"] (veterinary), careHome \[]. Supply \[] to exclude nothing. A notice still matches if another CPV code is eligible.

## `keywords` (type: `array`):

Defaults to no keyword filter. Case-insensitive substring matching across title, description and buyer; any keyword can match. Combined with CPV and other filters using AND, including in careHome mode.

## `regions` (type: `array`):

Defaults to no region filter. Any supplied region/locality substring can match, case-insensitively. Notices with no location data fail this filter.

## `minValue` (type: `number`):

Optional inclusive minimum. Unknown and non-GBP values pass.

## `maxValue` (type: `number`):

Optional inclusive maximum. Unknown and non-GBP values pass.

## `sinceLastRun` (type: `boolean`):

Enabled by default. Use each source checkpoint with a one-hour overlap; the first run looks back seven days unless a start date is supplied.

## `fullRefresh` (type: `boolean`):

Disabled by default. Ignore checkpoints and rebuild selected snapshots. Emitted keys remain to prevent repeat charges; supply a start date to backfill.

## `tagCqcHints` (type: `boolean`):

Local heuristics only; makes no CQC requests.

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

Optional ISO datetime with time zone. Used when no checkpoint applies; otherwise the checkpoint takes precedence. Defaults to seven days before the window end.

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

Optional ISO datetime with time zone; defaults to now. Supplying this field prevents checkpoint advancement.

## `requestDelayMs` (type: `integer`):

FTS minimum 10000; Contracts Finder minimum 500. Unset defaults to 10000/1000.

## `maxRetryWaitSecs` (type: `integer`):

Defaults to 60 seconds per 429/5xx retry wait. Contracts Finder 403 waits are exempt within the six-minute retry window.

## `maxPages` (type: `integer`):

Defaults to 50 per source and window, shared across Find a Tender stages. Reaching this before completion fails without advancing tender state; narrow the window.

## `stateKey` (type: `string`):

Local state namespace; use a separate namespace for different filters.

## `cqcApiKey` (type: `string`):

Optional. Get a free subscription key at https://api-portal.service.cqc.org.uk/ . Used only for CQC provider and location enrichment. If omitted, the Actor uses CQC_API_KEY from the run environment when present; otherwise enrichment is skipped and tender monitoring continues. Never charged.

## `enrichCqc` (type: `boolean`):

Enabled by default. Match within resolved English local authorities only. Needs a CQC API key via the secret cqcApiKey input or CQC_API_KEY in the environment; missing key skips enrichment. Never charged.

## `cqcStrongMatchesOnly` (type: `boolean`):

Disabled by default: the dataset retains strong, possible and weak candidates with strength labels. Enable to remove non-strong matches after ranking and the three-match cap; tender rows still emit if no matches remain.

## `cqcRequestDelayMs` (type: `integer`):

Defaults to 300 milliseconds between CQC requests.

## `cqcMaxDetailFetches` (type: `integer`):

Defaults to 25 high-confidence rating detail requests per run; zero disables detail requests.

## `includeWeakInDigest` (type: `boolean`):

Disabled by default: digest examples show strong matches only, while counts include every strength. Enable to include possible and weak examples too. Does not filter dataset rows or restore matches removed by cqcStrongMatchesOnly.

## Actor input object example

```json
{
  "monitorMode": "general",
  "sources": "both",
  "stages": [
    "planning",
    "tender",
    "award"
  ],
  "keywords": [],
  "regions": [],
  "sinceLastRun": true,
  "fullRefresh": false,
  "tagCqcHints": true,
  "maxRetryWaitSecs": 60,
  "maxPages": 50,
  "stateKey": "default",
  "enrichCqc": true,
  "cqcStrongMatchesOnly": false,
  "cqcRequestDelayMs": 300,
  "cqcMaxDetailFetches": 25,
  "includeWeakInDigest": false
}
```

# Actor output Schema

## `dataset` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("refreshing_outlook/uk-care-tender-monitor").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("refreshing_outlook/uk-care-tender-monitor").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 '{}' |
apify call refreshing_outlook/uk-care-tender-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,refreshing_outlook/uk-care-tender-monitor"
        }
    }
}
```

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/cAW49gkeS3lIaOpxN/builds/3AV7eVEsCkeBtrPcp/openapi.json
