# England Planning Appeals Monitor (`keepable_injera/england-planning-appeals-monitor`) Actor

Monitor England Planning Inspectorate appeal decisions from the monthly Casework Database. Filter by authority, decision, casework, development, and residence count, and detect new or changed cases.

- **URL**: https://apify.com/keepable_injera/england-planning-appeals-monitor.md
- **Developed by:** [Chee Chiaw Lim](https://apify.com/keepable_injera) (community)
- **Categories:** Real estate, Open source
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 results

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

## England planning appeals monitor

Read England Planning Inspectorate appeal decisions from the monthly Casework Database. Filter cases by local authority, casework type, development type, decision, date, and residence count. Results appear in newest decision date order.

The actor discovers workbook attachments through the [GOV.UK Content API](https://www.gov.uk/api/content/government/publications/planning-inspectorate-appeals-database). It streams the `Data Set` sheet instead of loading the workbook into memory. The default run reads the current Casework Database and emits up to 100 decisions from the last 90 days.

### Run locally

Use Node.js 20 or later.

```sh
npm install
npm test
npm start
```

An empty input contacts the live source. Tests use local fixtures and stub network calls. Read results in `storage/datasets/default` and the summary in `storage/key_value_stores/default/RUN_SUMMARY.json`.

### Input

| Field | Default | Meaning |
| --- | --- | --- |
| `lpaNames` | `[]` | Case-insensitive substrings of local planning authority names. |
| `onsCodes` | `[]` | Case-insensitive exact matches against either authority ONS code. |
| `caseworkTypes` | `[]` | Case-insensitive exact casework type matches. |
| `developmentTypes` | `[]` | Case-insensitive exact development type matches. |
| `decisions` | `[]` | Case-insensitive exact decision matches. |
| `decidedAfter` | 90 days before the run date | Exclusive decision date lower bound, in `YYYY-MM-DD` format. |
| `minResidences` | Unset | Minimum residence count, including zero. |
| `onlyNew` | `false` | Set `true` to emit only new and changed cases. |
| `maxItems` | `100` | Maximum emitted records, from 1 to 10000. |
| `includeOlderCasework` | `false` | Also read the Older Casework Data attachment. |
| `stateStoreName` | `england-planning-appeals-monitor-state` | Named key-value store for case history. |

List filters accept arrays of strings. An empty array applies no filter. Values within one array are alternatives. Different filter categories all apply. Records without a decision date do not match the decision date window. Records without a residence count do not match `minResidences` when it is set.

`includeOlderCasework` does not widen the date window. Set an earlier `decidedAfter` to retrieve older decisions. `maxItems` limits emitted results. The actor must scan the selected workbook attachments to find the newest matching decisions.

### Output

This illustrative record shows the output shape. It is not a captured appeal.

```json
{
  "caseNumber": "1234567",
  "caseworkType": "Householder (HAS)",
  "lpaName": "Example Council",
  "lpaOnsCode": "E00000000",
  "localAuthorityOnsCode": "E00000000",
  "lpaDecisionDate": "2026-06-01",
  "receivedDate": "2026-06-10",
  "validDate": "2026-06-12",
  "startDate": "2026-06-15",
  "decisionDate": "2026-10-01",
  "decision": "Dismissed",
  "procedure": "Written Representations",
  "developmentType": null,
  "appealTypeReason": null,
  "appealReason": null,
  "typeDetail": null,
  "jurisdiction": "England",
  "linkStatus": null,
  "leadCase": null,
  "appellantType": "individual_or_unknown",
  "siteAddress": null,
  "sitePostcodeDistrict": "HA9",
  "areaHectares": null,
  "floorSpaceSqm": null,
  "numberOfResidences": null,
  "lpaApplicationReference": null,
  "greenBelt": null,
  "costsApplied": null,
  "enforcementGrounds": null,
  "appealUrl": "https://acp.planninginspectorate.gov.uk/ViewCase.aspx?caseid=1234567",
  "source": "Planning Inspectorate Casework Database, https://www.gov.uk/government/publications/planning-inspectorate-appeals-database",
  "licence": "Open Government Licence v3.0, http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/",
  "retrievedAt": "2026-10-22T00:00:00.000Z",
  "generatedId": "1234567",
  "changeType": "new"
}
```

Dates are ISO calendar dates. Missing source values are null. `generatedId` is the case number. `changeType` is `new`, `changed`, or `unchanged`.

The actor compares a hash of the emitted source fields with the saved hash for the same `generatedId`. Decision, date, and other output changes can mark a case as changed. Retrieval timestamps and change metadata do not affect the hash. State saves only after a successful result push. A crash between the push and state save can repeat a result on the next run.

Use a separate `stateStoreName` for independent histories. Change detection covers cases that pass the current filters and are emitted within `maxItems`. It is not a complete audit of every historical case.

`RUN_SUMMARY` records run counts, timestamps, and any run error. The actor charges per emitted result using the `result` event, with no run fee. Unchanged results emitted with `onlyNew=false` also count as results.

### Personal data

The output never contains the source Appellant, Agent, or Inspector Name fields. The actor uses Appellant only to classify `appellantType` with the organisation pattern specified for this project. An organisation match is a heuristic, not a verified legal status.

A full `siteAddress` appears only for an organisation match outside these casework types:

- Householder (HAS)
- Enforcement Notice
- Lawful Development Certificate
- High Hedges
- Tree Preservation Order
- Tree Replacement Notice
- Appeal against Enforcement Listed Building Notice/Enforcement Conservation Area Notice

All other cases have `siteAddress: null`. `sitePostcodeDistrict` contains only the postcode outward code, such as `HA9`, when the address contains a recognised UK postcode. The actor does not produce inspector-level statistics.

### Source credit and licence

Contains public sector information licensed under the Open Government Licence v3.0. Source: Planning Inspectorate Casework Database. The actor normalizes dates, filters records, removes personal fields, and applies the address restrictions above. No endorsement by the Planning Inspectorate is implied.

The England source and licence text below is reproduced from [TERMS.md](TERMS.md).

- Source: Planning Inspectorate Casework Database, https://www.gov.uk/government/publications/planning-inspectorate-appeals-database (updated 2026-10-01, monthly xlsx, rolling 5 years). Attachment URL read from the GOV.UK Content API https://www.gov.uk/api/content/government/publications/planning-inspectorate-appeals-database.
- Licence: GOV.UK content under OGL v3 unless stated; the same dataset on https://opendatacommunities.org/data/planning-inspectorate-casework and data.gov.uk lists OGL v3 (http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/). OGL v3 does not cover personal data. Data notes (https://www.gov.uk/government/publications/planning-inspectorate-appeals-database/appeals-data-data-notes-and-guidance): third-party copyright needs permission; data can change between publications; PINS states patterns by Decision Maker are artefacts and not evidence of fitness.
- robots: gov.uk robots.txt disallows only /search/all and print pages.
- Conditions and how met: OGL attribution in README and items; Appellant, Agent and Inspector Name are never output (only `appellantType` = organisation/individual/unknown from a heuristic, no names); full site address is output only when the appellant name matches an organisation pattern (Ltd, Limited, LLP, plc, Council, Homes, Developments, Group, Trust, etc.) and the casework type is not Householder (HAS), Enforcement Notice, Lawful Development Certificate, High Hedges, Tree Preservation Order or Tree Replacement Notice; otherwise only the postcode outward code (e.g. HA9) is output. No inspector-level stats.

### Limitations

The source updates monthly, so decisions and corrections can arrive after their decision dates. The current workbook covers a rolling five-year period. Source values can change between publications. A short date window does not detect revisions to older decisions.

The actor downloads the selected workbooks on each run. Workbook size and source availability affect run time. It streams rows and retains matching output records rather than workbook cells. Postcode extraction and organisation classification can miss unusual formats. The public appeal link may not expose every case detail.

### Verification with the source sample

`samples/` is excluded from git. With the supplied `samples/full.xlsx`, run `node scripts/verify-sample.js` to scan the full workbook through the actor flow using a file-backed test adapter. It writes 100 default-filter records and `RUN_SUMMARY` under `storage/sample-verification`, reads them back, checks privacy and ordering, and checks peak process memory against 1 GiB. This verifies the sample pipeline without contacting GOV.UK or loading the Apify SDK.

Run `python3 scripts/build-fixture.py` to rebuild the trimmed workbook fixture from the sample. The script replaces names and site addresses with test values before writing the fixture.

# Actor input Schema

## `lpaNames` (type: `array`):

Case-insensitive substring matches against LPA Name. Empty selects all authorities.

## `onsCodes` (type: `array`):

Case-insensitive exact matches against either LPA or local authority ONS code.

## `caseworkTypes` (type: `array`):

Case-insensitive exact matches against Type of Casework.

## `developmentTypes` (type: `array`):

Case-insensitive exact matches against Development Type.

## `decisions` (type: `array`):

Case-insensitive exact matches against Decision.

## `decidedAfter` (type: `string`):

Exclusive decision date lower bound in YYYY-MM-DD format. Omit to use 90 days before the run date in UTC.

## `minResidences` (type: `number`):

Minimum Number of Residences. Omit to include records with no residence count.

## `onlyNew` (type: `boolean`):

Skip unchanged cases already saved in the named state store.

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

Maximum emitted cases, ordered by newest decision date first.

## `includeOlderCasework` (type: `boolean`):

Also read the Older Casework Data attachment. The decision date filter still applies.

## `stateStoreName` (type: `string`):

Named key-value store for successfully emitted case hashes. Use a separate name for an independent history.

## Actor input object example

```json
{
  "lpaNames": [],
  "onsCodes": [],
  "caseworkTypes": [],
  "developmentTypes": [],
  "decisions": [],
  "onlyNew": false,
  "maxItems": 100,
  "includeOlderCasework": false,
  "stateStoreName": "england-planning-appeals-monitor-state"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `runSummary` (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("keepable_injera/england-planning-appeals-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("keepable_injera/england-planning-appeals-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 keepable_injera/england-planning-appeals-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,keepable_injera/england-planning-appeals-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/8d3uyD5ShB5gjQWqc/builds/CEp8cOXENu6vX3M5c/openapi.json
