Navigation

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

PracticeDesk billing: five invoices with payer, rule version and price version on every line. IN-60001 for the 9 am session totals $95.00 as a $62.50 scheme line and a $32.50 patient line; IN-90001 is held because its referral expired on 2026-11-24, and IN-90002 is held awaiting the insurer's approval.

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

  1. Step 1

    PracticeDesk referral inbox: the referral email on the left with highlighted quotes, and the administrative fields on the right (patient, referrer, discipline, referral date, a low-confidence scheme hint, availability and funding "missing"), each with the quote it came from, under a notice that AI sets no clinical priority.
    AI fills administrative fields only, each with a verbatim quote. The system, not the model, decides that funding is missing.
  2. Step 2

    PracticeDesk appointment book for Monday 30 November with six practitioners and the cancelled 9:00 physiotherapy slot selected. The waitlist panel shows one eligible patient and three who are not (referral expired, no sessions left this period, waiting for another discipline), and a current-versus-proposed book with an Apply button.
    The cancelled 9 am slot: one of four waitlisted patients is eligible; the others show why not. Compare, then apply.
  3. Step 3

    PracticeDesk "The last funded session" panel, 0 of 5 left: Receptionist 1 booked (201) and Receptionist 2 refused (409, no remaining Chronic Care Plan entitlement), with the ledger line authorised 5, consumed 5, released 0, remaining 0.
    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.

InvariantWhy it mattersEvidence
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

PracticeDesk system architectureBrowser, then a React and TypeScript single-page app, then a Symfony modular monolith with the Practice module, then PostgreSQL: row-level security isolates every demo session. The backend calls an AI adapter: AI structures the referral's administrative fields with a quote for every value and drafts patient messages from computed facts; a person approves and nothing is sent. It never sets clinical priority or urgency, diagnoses, recommends treatment, decides eligibility, calculates fees or books anything.BrowserAnonymous demo session · guided scenarioReact + TypeScriptSingle-page app · Playwright end-to-end + axeJSON · RFC 9457 problem detailsSymfony modular monolithPractice moduleentitlement ledger · appointment book · invoice revisionstransactions · constraintsPostgreSQLRow-level security isolates every demo sessionAI adapterJSON schema + semanticvalidation · fixture modeby default · no AI numbersDocker + Caddy on a shared 4-vCPU host · synthetic data only
AI structures the referral's administrative fields with a quote for every value and drafts patient messages from computed facts; a person approves and nothing is sent. It never sets clinical priority or urgency, diagnoses, recommends treatment, decides eligibility, calculates fees or books anything.

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.