Projects

Live demo

Treatment Estimator. Estimates built live in the consult, with prices that never move.

A treatment coordinator builds multi-option estimates live during the consult, clicking teeth on a chart and dragging treatments onto option cards while prices compute from that clinic's own versioned price book. Every saved line freezes its price at capture, so the document a patient signs is still reproducible six months later.

Pricing engine · Live consult tool 6 steps · synthetic data

Walk through it, six steps

Step 1 of 6

Start from the doctor's handoff

The doctor finishes the exam: upper full-arch, lower conventional, show both a fixed and a removable option. The coordinator picks the patient, sets the arch scope, selects the consulting doctors, and gets a draft estimate while the patient is still in the chair.

New estimate · Jordan Rivera-Blake (synthetic)Synthetic data
Arch scopeboth
  • Upper + Lower
Doctors1
  • Dr. Sam Placeholder ★ primary
Estimate
  • EST-100377 · Draft · Revision 1
  • Northside Clinic (Demo)
Step 1 of 6

Every name, number, transcript and document in this tour is synthetic. The mechanisms, thresholds and architecture are real. The production system and its data stay private.

The problem.

The old tool was a 10-year-old script wrapped around one spreadsheet: a rigid 14-step questionnaire that could not express a real consult, where treatments get added in minute 20 and dropped in minute 25. Coordinators hand-checked the math, and a price change silently rewrote history on past estimates.

  • Price guarantee DB property write-once capture columns, trigger-enforced
  • Pricing coverage 100% line and branch coverage is a CI gate
  • Tests 316 incl. 11 golden fixtures from the legacy tool
  • Shipped 3 weeks v1 to production, ~77 PRs over 3.5 months

How it fits together.

4 layers, left to right
  1. Frontend

    • Next.js App Router, server components for reads
    • Zustand workspace store + TanStack Query
    • Debounced live pricing preview (~200 ms)
  2. Pricing core

    • Shared procedure catalog: zones, tooth maps, caps
    • Per-location immutable price book versions
    • One resolver, five pricing models, resettable tier counters
  3. Integrity

    • Write-once *_at_capture columns, trigger-enforced
    • Estimate revisions snapshot on present
    • Append-only audit table, monthly partitioned
  4. Output & quality

    • react-pdf patient and clinical variants + ExcelJS
    • 100% pricing coverage gate · property-based invariants
    • 11 golden fixtures replayed from the legacy tool

Where it landed.

Coordinators build estimates the way consults actually flow instead of fighting a 14-step form, and the math stopped being anyone's job to double-check: lines must sum to subtotals, caps can never be exceeded, and every line carries the price book version that produced it, invariants enforced by property-based tests in CI and triggers in the database. All prices shown here are invented; the real fee schedules are the company's.

Concepts

Domain modelingImmutable versioningWrite-once invariantsProperty-based testingGolden fixturesOptimistic UI

Stack

Next.jsTypeScriptPostgresAuth.js + Workspace SSOZustandTanStack Queryreact-pdfExcelJSPlaywright