# UK Pharmacy Growth & Service Adoption Signals (`starshaped_bullsnake/uk-pharmacy-growth-service-adoption-signals`) Actor

Turn official monthly NHSBSA contractor data into pharmacy-level dispensing growth and service-activity signals.

- **URL**: https://apify.com/starshaped\_bullsnake/uk-pharmacy-growth-service-adoption-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 $15.00 / 1,000 pharmacy growth / service adoption 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

## UK Pharmacy Growth & Service Adoption Signals

Turn official monthly NHS Business Services Authority (NHSBSA) contractor activity into decision-ready, pharmacy-level signals. The Actor dynamically resolves the newest two consecutive CSV resources from the NHSBSA CKAN API; it does not scrape web pages or require credentials.

### Try it with sample data

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

Sample mode makes zero NHSBSA HTTP requests, never opens the production state store, and sends deterministic embedded previous/current records through the same comparison logic as live mode. It produces three representative contractor signals.

### Input

- `mode`: `live` (default) or `sample`.
- `maxItems`: maximum Dataset items, default `100`, maximum `10000`.
- `minGrowthPercent`: optional common percentage override. Defaults are 30% for service activity and 10% for dispensing.
- `minAbsoluteGrowth`: optional service-activity absolute-increase override; default `25`. Dispensing uses an internal default of 1,000 items.

### Signals

The current long-form source schema is mapped through explicit aliases. `SERVICE_ACTIVITY_STARTED:<service>` means the preceding month contains zero/no recorded activity and the current month contains at least 10 activities. It does **not** claim that a contractor registered for the service. `SERVICE_ACTIVITY_GROWTH:<service>` requires both 25 additional activities and 30% growth by default. `DISPENSING_ACTIVITY_GROWTH` requires 1,000 additional prescription items and 10% growth by default. These thresholds suppress routine small month-to-month variation; they are qualification rules, not statistical anomaly detection.

Supported, exact-source service families are Pharmacy First consultations, New Medicine Service interventions, blood-pressure clinic checks/ABPM, and contraception initiation/ongoing/emergency consultations. Related rows are summed per contractor. Each contractor produces at most one item, containing every qualifying reason and compact previous/current/change metrics. Results are sorted by strongest signal, then contractor code.

The defaults were calibrated against the April–May 2026 official distributions available during development. They filter tiny changes while retaining material month-on-month movement. Overrides affect growth qualification, never the zero-to-positive activity-start rule.

### Live runs

Every live Run resolves, downloads, parses, and normalizes the latest two consecutive official monthly resources, then immediately emits the currently qualifying signals. No prior Run or persistent comparison baseline is required. Repeating a Run against the same source pair and input produces the same deterministically ranked results. Summary and bounded schema/resource diagnostics are written outside the Default Dataset.

### Source and caveats

Source: [NHSBSA Pharmacy and appliance contractor dispensing data](https://opendata.nhsbsa.net/dataset/pharmacy-and-appliance-contractor-dispensing-data), published monthly by NHS Business Services Authority Open Data. Data has a reporting lag and can receive backdated corrections. Signals describe recorded contractor activity—not guaranteed revenue, commercial performance, or service registration. Missing activity does not prove a pharmacy does not offer a service.

NHSBSA data is attributed to NHS Business Services Authority Open Data and is reusable under the source's published Open Government Licence where applicable. This Actor is independent and does not imply NHS or NHSBSA endorsement.

# Actor input Schema

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

Live uses official NHSBSA data; sample uses deterministic embedded data with no HTTP or production state access.

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

Maximum contractor signal items written to the Dataset.

## `minGrowthPercent` (type: `number`):

Optional percentage threshold applied to service and dispensing growth. Defaults to 30% for services and 10% for dispensing.

## `minAbsoluteGrowth` (type: `number`):

Optional absolute threshold for service activity growth. The default is 25; dispensing remains an internal 1,000-item default.

## Actor input object example

```json
{
  "mode": "live",
  "maxItems": 100
}
```

# Actor output Schema

## `dataset` (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("starshaped_bullsnake/uk-pharmacy-growth-service-adoption-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("starshaped_bullsnake/uk-pharmacy-growth-service-adoption-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 '{}' |
apify call starshaped_bullsnake/uk-pharmacy-growth-service-adoption-signals --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,starshaped_bullsnake/uk-pharmacy-growth-service-adoption-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/FaUyaMG7hCp8GRddK/builds/o3dINODWrWDgJ8tl8/openapi.json
