# UK Parliament Question SLA Watchdog (`hllerdgn80/uk-parliament-question-sla-watchdog`) Actor

Flags overdue and holding-only answers to UK parliamentary written questions by topic or department, plus new questions since your last run, via the official Parliament API.

- **URL**: https://apify.com/hllerdgn80/uk-parliament-question-sla-watchdog.md
- **Developed by:** [Halil Erdogan](https://apify.com/hllerdgn80) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 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

## UK Parliament Question SLA Watchdog

Every UK government department is expected to answer a written parliamentary
question by its own published deadline (the "date for answer" — ordinary
questions get a working week, named-day questions get the specific day
asked for). Nobody publishes a simple answer to "is anyone actually late
right now, on my topic". This Actor is that answer.

Give it one or more topics — a search term (e.g. "asylum backlog"), an
answering department (e.g. "Home Office"), or both — and it checks the
official UK Parliament Written Questions register (Open Parliament
Licence, public, no key required) and tells you, per topic:

- **Overdue** — no answer at all, and today is already past the due date.
- **Holding answer only** — the department recorded a holding reply instead
  of a substantive one (the API's own flag), so the question looks
  "answered" in a raw feed but is not actually resolved.
- **Answered late** — a real answer was eventually given, after the deadline.
- **New since your last run** — questions that were not there the last time
  you ran this Actor on the same topic (per-topic memory, kept between runs).

### Why this and not a generic Hansard/written-questions scraper

Every existing written-question Actor we found on Apify Store (checked
27 Sep 2026) returns the raw question/answer feed and stops there — none of
them compute a deadline, flag lateness, or distinguish a holding answer from
a real one. This Actor's only job is that judgement call: it fetches from the
same official API everyone else uses, but every row it charges for is one
that actually needs a human's attention, not a dump of everything.

### Data sources (official, public, no key)

- `questions-statements-api.parliament.uk` — the UK Parliament Written
  Questions and Answers register.
- `members-api.parliament.uk` — resolves the asking MP's name for each
  flagged question, and resolves a department name to the ID the Questions
  API filters on (`api/Reference/AnsweringBodies`; the Questions API itself
  has no name-based department filter).

Both are official UK Parliament open data published under the Open
Parliament Licence. No scraping, no login, no paywall, no rate-limit key.

### Input

```json
{
  "topics": [
    {
      "label": "NHS waiting lists",
      "searchTerm": "waiting list",
      "answeringBody": "Department of Health and Social Care",
      "house": "Commons"
    },
    {
      "label": "Home Office asylum backlog",
      "searchTerm": "asylum backlog"
    }
  ],
  "questionsPerTopic": 60,
  "maxConcurrency": 3
}
```

Each topic needs at least a `searchTerm` or an `answeringBody`. `house` is
optional (`"Commons"`, `"Lords"`, or omitted for both). `answeringBody` is
matched against the official list of government departments
(`members-api.parliament.uk/api/Reference/AnsweringBodies`) — use the plain
gov.uk department name, e.g. `"Home Office"` or `"Department of Health and
Social Care"`. A name that does not match anything comes back as a clear
`unknown_department` error rather than silently searching everything.
`searchTerm` alone is a loose full-text search over question content, so for
a focused topic combine it with `answeringBody`.

### Output

One summary row per topic (questions checked, overdue count, holding-answer
count, late-answer count, new-since-last-run count) plus one detail row per
question that is flagged (overdue / holding-only / answered late) or newly
seen since your previous run, with the question text, department, asking
member, due date, and a direct link to the question on parliament.uk.

### Pricing

Pay per event `question-flagged` — charged once for every question row
actually pushed to the dataset. A topic with nothing overdue and nothing new
costs nothing beyond the run itself; you only pay for what needed your
attention.

### Honest scope / what this does not do

- It watches the questions your topics match on **this run's** most recent
  batch (`questionsPerTopic`, default 60, newest-first) — a topic with more
  activity than that in one sitting week may miss older items further back;
  raise `questionsPerTopic` for very high-volume departments.
- The first run on a brand-new topic is a baseline: it reports overdue /
  holding / late counts immediately, but "new since last run" is only
  meaningful from the second run onward.
- It does not interpret *why* an answer is late or holding — only the
  official API's own dates and flags, verbatim.

# Actor input Schema

## `topics` (type: `array`):

Each topic is checked separately against the official UK Parliament Written Questions API. Give a search term (matched in the question text/heading) and/or an answering department name, plus an optional House filter. Example: {"label": "Home Office asylum backlog", "searchTerm": "asylum", "answeringBody": "Home Office", "house": "Commons"}.

## `questionsPerTopic` (type: `integer`):

How many of the most recently tabled questions matching each topic to fetch and classify. The official API returns newest-first, so this is effectively 'how far back to look'. 60 covers roughly the last few sitting weeks for a normal topic.

## `maxConcurrency` (type: `integer`):

How many topics to check in parallel against the official Parliament APIs. Higher is faster but more likely to hit rate limits; 3 is a safe default.

## Actor input object example

```json
{
  "topics": [
    {
      "label": "NHS waiting lists",
      "searchTerm": "waiting list",
      "answeringBody": "Department of Health and Social Care",
      "house": "Commons"
    }
  ],
  "questionsPerTopic": 60,
  "maxConcurrency": 3
}
```

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

// Run the Actor and wait for it to finish
const run = await client.actor("hllerdgn80/uk-parliament-question-sla-watchdog").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("hllerdgn80/uk-parliament-question-sla-watchdog").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 hllerdgn80/uk-parliament-question-sla-watchdog --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,hllerdgn80/uk-parliament-question-sla-watchdog"
        }
    }
}
```

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/RbNkSTOVisZlRB3Cd/builds/VqgHJ9try92J4HXIV/openapi.json
