gxstudio.dev ← GX Studio
CASE_03

Clinical Healthcare & Practice Management — Split-Payment Escrow Architecture

A clinical mental health platform required confidential scheduling, dynamic practitioner matching, and legally compliant financial split-payouts between clinics and therapists.

Microservices • Rails API • PostgreSQL • Docker

The constraint: money and confidentiality in one transaction

Each of those requirements is ordinary on its own. Together they pull against each other. Matching a patient to a practitioner means reading availability and suitability quickly, while confidentiality demands that clinical data be reachable by as little of the system as possible. And a billing process that needs to know who was seen, by whom, and when, in order to divide a payment, is precisely the component that should never hold that information.

The financial side carried a constraint of its own. Money collected from a patient is not the platform’s to hold freely — it is owed, in defined proportions, to a clinic and to a practitioner. That division has to be correct and auditable rather than merely eventual.

The architecture: separation as a compliance boundary

Architected decoupled services for Auth, Scheduling, and Financial/Billing. Built automated escrow calculations, appointment calendar locks, and profile verification pipelines.

The service boundaries were drawn to limit what each part of the system can see, not merely to divide the work between teams. Billing operates on appointment outcomes and the amounts owed against them; computing a split does not require clinical content, so billing was never given access to it. That containment is what keeps HIPAA and LGPD obligations tractable — the surface holding regulated data stays small enough to reason about and to audit.

Escrow made the payment path honest. Funds are held against a delivered session and released in calculated proportions to each party, so no payout depends on someone remembering to reconcile it by hand at the end of a month.

Calendar locks addressed the scheduling race directly. Practitioner availability is contended — two patients can reach the same slot in the same moment — and matching is only trustworthy if claiming a slot is atomic.

The outcome

Split payouts run automatically across multiple parties, schedule matching resolves in under a second, and the platform operates under strict HIPAA and LGPD compliance.

The structural payoff is that correctness and compliance are enforced by architecture rather than by procedure. Billing cannot leak clinical data it was never handed, and a double-booking does not need reconciling after the fact because it cannot be created in the first place.

Verified Impact
• Automated multi-party split payouts
• Sub-second schedule matching
• Strict HIPAA/LGPD compliance

[NDA PROTECTED / ANONYMIZED]