A compliance-first transcription prototype for a New York behavioral-health firm: record, diarize, review, hold-to-sign — every event hash-chained, and substance-use records physically segregated from everything else. Synthetic data; no clinician has used it yet. That is stated on every sheet, not hidden in one.
Fifty minutes of someone's worst week is spoken aloud in a small room. This machine has one job: make the record of it accurate, signed, and impossible to alter silently.
The clinician records in the browser; audio goes to object storage on a presigned URL — the bytes never transit the application server. Deepgram Nova-3 fetches it directly and returns a diarized draft, or the pipeline fails loud: an unlabeled transcript is a defect here, not a degraded mode. The clinician reviews, reassigns a mislabeled speaker, then presses and holds to sign. The transcript locks, and every one of thirteen domain events along the way lands in an append-only, SHA-256 hash-chained audit log.
Deliberately, the machine writes no clinical note. New York's S.8484 permits administrative AI and forbids the therapist kind, so Phase 1 ships the boring, legal thing: a verbatim, speaker-labeled transcript. The clinician stays the author; the machine is the stenographer and the notary.
Somewhere in New York tonight, a counselor is typing up a two-o'clock session at the kitchen table — the third note of the evening, all of it from memory.
Nothing was recorded; nothing could be. So the legal record of care is a reconstruction: what she remembers, hours later, filtered through two more sessions and dinner. The client's own brief put the wedge in four words — clinicians hate writing notes — and the sector has a name for the symptom: pajama-time charting, the after-hours documentation load that burns clinicians out.
The loop in FIG. 1 is the before-state this machine was drawn against. Note what stalls it: not slowness — fidelity. The chart is a memory of a memory, and it is the document a court, an auditor, or the next clinician will treat as what happened.
Nothing records until the patient signs a standalone, versioned AI-use consent — plain English, the vendors named, a 988 crisis-line handoff, and the promise that nothing said trains an AI. Editing the document bumps its version and forces re-consent. The consent is a gate, not a checkbox.
The browser records opus/webm and uploads on a presigned URL — audio bytes never transit the application server. Deepgram Nova-3 fetches straight from storage and returns speaker-labeled segments, or the use case fails loud: in a two-person room, a transcript that can't say who spoke is a defect, not a degraded mode.
Federal law (42 CFR Part 2) makes substance-use records stricter than the rest of the chart. Most EHRs enforce that with a flag column. Here every record routes physically — part2_db, non_part2_db, shared_db, plus two audio buckets — and an unclassified patient defaults to Part 2, fail-safe. A wiring mistake becomes a 500 error, not a leak.
All thirteen event types append to a hash chain — each entry's SHA-256 covers the sequence, the previous hash, and its own canonical form — with a meta-chain in shared_db anchoring both stores. The dashed arc is the consequence loop: every repository read re-asserts that store and flag agree, and a mismatch fires audit.tamper_signal into the same chain it protects.
After review — reassign a speaker, fix a segment, every edit hash-chained per transcript — the clinician presses and holds. The transcript locks with a signature reference and becomes the record; export is an AES-128 password-encrypted PDF on a 15-minute link. The audio is purged within thirty days. The transcript is what remains, and it can prove it hasn't changed.
The industry default for Part 2 is logical segregation — one database, a flag, query-layer discipline. This firm is SUD-primary: over half its patients are Part 2-protected, so the flag would guard the majority of every table.
The governing tension: the strictest regulation in US healthcare versus a prototype that must prove itself before real money. HIPAA-grade infrastructure and BAAs cost more than an unvalidated idea is worth.
Real drawings carry a revision table because real machines break. This one broke in instructive places.
Every row traces to an ADR or the repo's own status log. The pattern: in a compliance system, the fix is never a patch — it is a rule written down so the same class of mistake becomes impossible.
diarize=true became primary. The port boundary made it one adapter and one composition-root line; zero domain code moved. The WER benchmark was demoted to a pre-pilot gate — recorded, not forgotten..afm font files ENOENT'd under the bundler. Same pass: the primary button in forms defaulted to type="button" and silently swallowed submissions.non_part2_flag was the only wall — exactly the boundary an engineer under deadline pressure crosses without noticing.audit.tamper_signal.Two things a skeptic would find, answered before the interview: the Cloudflare Access adapter parses identity headers but JWT signature verification is stubbed — a marked production TODO, tolerable only because no real patient data exists to protect yet. And there is no PII redaction anywhere: the transcript is stored verbatim by design, defended by segregation, access control and the chain — not by masking. Both are written in the repo's known-issues file, not discovered by an auditor.
What these numbers are not: a clinical result. No clinician has used this system on a real session. The first supervised pilot is a future Phase 2 gate, so no time-savings figure appears anywhere on these sheets — a number like that would be invented, and in healthcare an invented number is disqualifying. What the numbers are: proof that the trust machinery a pilot cannot retrofit — consent, segregation, the chain, the seal — already works, to production engineering gates.
Discuss a compliance-first build →A compliance dossier that claimed compliance would be lying twice, so here is the plain state of it.
This system is designed for 42 CFR Part 2; it is not compliant with it. The §2.32 redisclosure notice that must ride on every export exists as a typed constant and is not yet attached to the PDF — the repo flags it [CRITICAL] in its own known-issues file, and real-PHI mode stays off until it ships. The consent and court-order machinery of §2.31, §2.35 and §2.65 is drawn (M15–M17), not built. No healthcare-privacy attorney has reviewed any of it; that review is scoped as one end-of-project bundle before any pilot. One module of a planned twenty-one exists.
The hardest part of the build was refusing the demo that sells. AI-drafted clinical notes were the obvious wow — and New York's S.8484 red zone, and a trust debt no startup in this domain survives. So Phase 1 shipped the stenographer and the notary instead, and hardened consent, audit and retention before any model gets to infer anything. That is the judgment this case file is actually selling: under real regulatory constraint, build the boring, provable thing first — and write every gap down before someone else finds it.
Bring the process nobody is allowed to get wrong — patient records, money movement, audit trails. The first conversation costs nothing, and the discretion you just read is permanent.