Quotengine

Overview
An estimate engine for dental practices. A patient describes the treatment they need, optionally with a panoramic x-ray, and gets an indicative quote.
Stack
TypeScript, Hono, Cloudflare Workers, D1, R2, Claude (vision and tool use), zod, Vitest
What I built
- Guarded multimodal intake: Claude reads the patient's message and an optional panoramic x-ray, and can only answer through a forced tool schema that picks items from the practice's catalog.
- A deterministic pricing engine in TypeScript: per-practice catalogs, rules, modifiers, tax and markup, all validated with zod before they load.
- A Hono API on Cloudflare Workers with leads in D1 (versioned SQL migrations), radiographs in private R2 storage and an OpenAPI contract.
- Health-data privacy: consent is recorded with the SHA-256 of the exact text accepted, and an x-ray is stored only with a separate opt-in, otherwise it is processed in memory.
- 333 tests across 44 files running in CI, plus an evaluation harness on open-access radiographs.
- Docs a reviewer can follow: four architecture decision records, a threat model, a model card and a go-live privacy checklist.
Key decisions
- The model never does arithmetic. It returns catalog IDs through a forced tool schema, and code computes every price.
- Uncertain input fails closed: a poor x-ray or a low-confidence reading returns a consultation request instead of a guessed price.
- No accuracy claims without proof: the model card states what has not been measured yet on a dentist-labelled dataset.
- Every estimate is indicative and needs in-person clinical confirmation.