What this is
Cancelled-Op counts the NHS's 28-day promise after an operation is cancelled, and pays out in sterling when that promise is broken.
An agent reads each claim against the hospital's record and decides one of three things: the promise was kept, the promise was broken, or it never applied. Only the middle one moves money.
Repayments go out as real PayPal payouts in GBP, idempotent on the batch id so a resend can never pay twice.
The promise, and the hole in it
You fast from midnight. You arrange leave. You get to the hospital and the operation is cancelled — no bed, no theatre time, no anaesthetist. Nothing clinical about it.
The NHS Constitution has an answer for this. You are owed another binding date within 28 days, or the treatment funded at a hospital of your choice.
Two things are wrong with that answer.
More than one in five cancelled patients never get the 28-day date.
And the funding alternative is a pledge. NHS England states plainly that a pledge is not legally binding. So the promise that money will follow you when the system fails — the only part that would actually help — is, by construction, unenforceable.
What the system looks like underneath
From NHS England's own Referral to Treatment figures, July 2026:
| Pathways waiting to start treatment | 7,328,252 |
| Waiting beyond 18 weeks | 2,535,685 — 34.6% of the list |
| Within 18 weeks | 65.4%, against a 92% standard NHS England says in its own words it is "thus not meeting" |
| Waiting more than 52 weeks | 111,379 |
| Operations cancelled on the day for non-clinical reasons | 22,029 |
A queue of seven million is the context. Twenty-two thousand people cancelled on the morning of surgery is the event. The 28-day promise is the remedy. It is kept about four times in five, and when it is broken there is nothing to appeal to.
Turning a pledge into a payment

Cancelled-Op starts a clock the moment an operation is cancelled, and it counts in days against the statutory promise rather than in positions on a list.
Three things can happen, and the app is built around all three rather than only the happy one:
- Promise kept — a new date lands inside 28 days. Nothing is owed.
- Promise broken — the clock runs out. The patient is owed funded treatment elsewhere, and Cancelled-Op pays it.
- Outside the promise — the cancellation was clinical, so the pledge never applied. Saying so is as important as paying, because a system that pays on every case is not enforcing anything.


When a new date lands inside the window, nothing is owed and the app says so plainly.

And when the cancellation was clinical, the pledge never applied. Saying that clearly matters: a system that pays on every case is not enforcing a rule, it is just paying.
When the clock does run out, repayment goes out as a real PayPal payout in pounds sterling. Not a referral, not a letter — money.
Why GBP matters here
A lot of payout tutorials quietly assume dollars. We proved a full sterling batch through to a terminal SUCCESS with a real PayPal fee, because the NON_HOLDING_CURRENCY error is widely assumed to apply more broadly than it does. It does not apply to GBP.
We also made re-sending safe. The same case sent twice adopts PayPal's original batch rather than creating a second payout, keyed on a deterministic sender_batch_id. There is a test named for exactly that breach, because paying a cancelled patient twice is a different failure but still a failure.
What runs it
| Agent | Claude Sonnet 4.5 on Amazon Bedrock, reading the claim and the hospital record to decide kept, broken, or outside |
| PayPal | Payouts v1 in GBP, idempotent on sender_batch_id, with signature-verified webhooks for every item state |
| Platform | AWS Lambda, DynamoDB, S3 and CloudFront |

The method page shows exactly which record each decision rested on. A system that moves public money on an AI's judgement should be able to show its working, and this one does.
Built With
- bedrock
- paypal
- sonnet
Log in or sign up for Devpost to join the conversation.