Play 3 · Pilot to Production Healthcare API-layer RBAC Append-only audit

Patient Intake Approval Queue

The governed backend under a plausibly AI-built intake tool. A versioned triage rule set, role checks that run on the server, and a full audit trail, so the app is safe to run in production.

6 tables · 11 API endpoints · 3 RBAC roles · append-only audit trail

The review console: a priority-ordered queue beside intake #2, showing the triage rule that fired and the append-only audit trail.

What it demonstrates

The frontend could have shipped in an afternoon from an AI app builder. This project is everything IT needs before that frontend can touch a real patient. Speed is not the argument. Control is: the business logic lives in one typed API layer a technical evaluator can read and trust.

Versioned triage rules

The active rule set decides each priority and records the version and reason on the intake. Older intakes keep the version that routed them.

API-layer RBAC

An auth table plus a per-endpoint role guard. Wrong-role writes are rejected on the server with a 403, never with row-level security.

Append-only audit

Submitted, evaluated, claimed, approved, denied. Every change writes one row with the actor and time, and is never updated after.

API surface

Every endpoint lives under one API group, intake.

VerbPathWhat it enforces
POST/api:intake/auth/loginPublic. Verifies the credential, mints a token, returns the role.
POST/api:intake/submitIntake clerk. Matches or creates a patient by MRN, opens the intake.
POST/api:intake/evaluateIntake clerk. Runs the active rules, stamps priority, version, and reason.
POST/api:intake/queue/claimClinician. Claims an open queue item.
POST/api:intake/queue/approveClinician. Approves a claimed intake.
POST/api:intake/queue/denyClinician. Denies a claimed intake with a reason.
GET/api:intake/queueClinician or viewer. The queue, emergent first.
GET/api:intake/detail/{intake_id}Any signed-in user. The intake, its routing rule, and its audit trail.
POST/api:intake/rules/activateClinician. Publishes a new triage rule version.
GET/api:intake/rulesAny signed-in user. Every rule version, active flagged.
GET/api:intake/seedPublic. Seeds the demo data (idempotent).

The screens

Use this template

Hand this repo to your coding agent as a starting point, then adapt the tables, endpoints, and screens to your own domain.

Clone https://github.com/xano-scratch/patient-intake-approval-queue and use it
as the starting template for my app. Read its README and xano/ first to learn the
XanoTS patterns (typed tables, an API group with a pinned canonical slug, per-endpoint
role guards, an append-only audit trail). Then adapt the tables, endpoints, and screens
to: <describe your domain and the one governed job it should do>.

Or run it yourself:

git clone https://github.com/xano-scratch/patient-intake-approval-queue
cd patient-intake-approval-queue
npm install
npx xanots login
npm run xano:deploy

The deploy prints live URLs. A deployed preview is an ephemeral environment, so shared preview links expire. Redeploy any time for fresh links. The repo is the durable artifact.