Health software / allied health
PracticeDesk
A referral arrives as a messy email, the 9 am slot just cancelled, and two people try to book the last funded session — here is what the system lets through, and why.
In the demo you run Monday at a fictional Brisbane allied-health practice: AI structures a referral email, the cancelled 9 am slot goes to the one eligible waitlisted patient, and two receptionists book the last funded session at once. Underneath: an entitlement ledger inside the booking transaction, an exclusion constraint on the book, and invoices reproducible to the cent.
- My role
- Sole engineer: spec to deployment
- Walkthrough
- 90-second guided scenario
- Focus
- Concurrency, entitlements and effective-dated billing
Launch guided demo (opens in a new tab)Engineering evidence
Stack: React · TypeScript · PHP/Symfony · PostgreSQL · Playwright + axe
Independently built portfolio showcase · simulated data

The business problem
An allied-health practice turns referrals into authorised, delivered and billed sessions under funding schemes with their own rules: referrals expire, schemes authorise a number of sessions or a budget, and prices change on a date. Two receptionists can book the same last funded session at once, and when funding is incomplete a session must be held, not guessed.
Try the workflow
Step 1

AI fills administrative fields only, each with a verbatim quote. The system, not the model, decides that funding is missing. Step 2

The cancelled 9 am slot: one of four waitlisted patients is eligible; the others show why not. Compare, then apply. Step 3

Two receptionists book the last Chronic Care session at once: exactly one succeeds, and the ledger still adds up.
Engineering invariants
Rules the system enforces whatever the user does, and where each one is proven.
| Invariant | Why it matters | Evidence |
|---|---|---|
| A booking consumes an entitlement by a conditional update inside the booking transaction: remaining = authorised − consumed + released, never negative. A cancellation or no-show never consumes one. | Two receptionists cannot both book the last funded session. | Race test: six real processes, three runs (opens in a new tab)Integration/PracticeDeskRaceTest.php :: testExactlyOneOfManyConcurrentBookingsConsumesTheLastSession |
| A practitioner is never double-booked: a database exclusion constraint on the book. A preview against a changed book is refused. | The waitlist cannot fill a slot that is no longer free. | Exclusion constraint + book version (opens in a new tab)Integration/PracticeDeskGoldenTest.php :: testThePractitionersAreNeverDoubleBookedInTheSeed |
| Delivery and invoicing are idempotent. An expired referral never produces a billable scheme line, and incomplete funding holds the invoice instead of guessing. | A replay never bills twice, and a scheme is never billed for a session it does not cover. | Held, not guessed (opens in a new tab)Unit/Practice/BillingEngineTest.php :: testIncompleteFundingIsHeldNotGuessed |
| An issued invoice is never rewritten: revisions are INSERT-only, and the database refuses UPDATE and DELETE. Every line carries its rule and price versions. | Any invoice recalculates as of its date to the cent. | Recalculation as of a date (opens in a new tab)Integration/PracticeDeskGoldenTest.php :: testEveryReferenceInvoiceRecalculatesAsOfItsDateToTheCent |
System architecture
Key decisions
An entitlement ledger: a balance row changed only by a conditional update, plus INSERT-only events, kept in the module.
Why: One row inside the booking transaction decides the race, and the events explain every balance. It is the second ledger of this shape after StockPoint's; it gets extracted on the third use.
Rejected: Moving the ledger into the shared core now: stock and entitlements mean different things.
ADR 0012 · entitlement ledger and race-safe booking
Compare before apply, with a book version.
Why: The waitlist preview carries the book version it was computed from; applying it to a changed book is refused with what changed. FieldDesk's pattern.
Rejected: Applying a preview to whatever the book looks like by then.
docs/specifications/016-practicedesk.md
Effective-dated scheme and price versions on every invoice line.
Why: A session is priced by the version in force on its date, so Wednesday's price change leaves Tuesday's invoice alone. EnergyDesk's pattern.
Rejected: A single current price list, which would change the result of recalculating an older invoice.
docs/specifications/016-practicedesk.md
Engineering evidence
Benchmark
Booking race
Six real concurrent processes book a patient's last Chronic Care session at the same instant. In each of three runs exactly one booking committed, five were refused "no entitlement", and one ledger event was written.
Conditions: Integration test with real PHP processes, not mocks; seeded synthetic practice; measured 2026-11-27
Tests
Billing to the cent
All 1,629 reference invoices recalculate as of their dates to the cent, across a mid-week price change. The 9 am session is invoiced once even when the request is replayed: $95.00 = $62.50 scheme benefit + $32.50 patient gap.
Conditions: Seeded fictional practice: 6 practitioners, about 300 synthetic patients, a 224-appointment week, 60 days of history (1,676 appointments), four fictional schemes
End-to-end
Contract, Playwright and tablet tests
Billing unit tests per scheme and version, the golden week, an OpenAPI-validated contract test of the whole Monday, a Playwright smoke with axe and a tablet test of the book.
Engineering page
“How it's engineered” in the live demo (opens in a new tab)
The full detail: rules, data model, tests and measurements, next to the running product.
I use AI-assisted development for implementation, exploration and review. I remain responsible for architecture, business rules, code quality and deployment. Critical behaviour is verified with deterministic tests, static analysis and reproducible benchmarks.
Trade-offs and limits
- Synthetic practice; the schemes are fictional, inspired by Medicare chronic condition care, the NDIS and workers' compensation, with invented rules and fees
- No Medicare, NDIS, insurer, My Health Record or messaging integrations; no payments
- No clinical notes. Not a medical device and not clinical software
- Day view of the book only (no week view)
My contribution
I built PracticeDesk as an independent engineering showcase in one working day on my Industry Demo Kit platform: product specification, domain model, backend, frontend, data generator, automated tests and deployment.
Want to discuss the engineering behind this?
Launch demo (opens in a new tab)Get in touch
Source-code walkthroughs available on request.