pediatric-ai-scribe-v3/shared/clinical
Daniel e6d0e5ef8c feat(notes): editable AI output + automatic correction tracking
Restores two pieces of vanilla behavior the React port silently dropped:

1. The output divs were contenteditable in vanilla — clinicians fix
   AI mistakes inline before saving the encounter or copying out.
   The early React port rendered the output as a read-only div, so
   any edit forced a copy-paste workflow.

2. correctionTracker.js (public/js/correctionTracker.js) saved every
   meaningful inline edit to user_memories under category
   correction_<section> so the AI learns user preferences. Settings
   → Corrections still showed them, but nothing in React was *writing*
   them — the loop was broken.

New EditableResult component wraps the result body in a textarea,
captures the AI baseline on first render / after refine|shorten, and
on blur posts to /api/memories/correction (only when the edit clears
the noise threshold from vanilla — wordDiff ≥ 2 OR charDiff ≥ 20 on
outputs > 100 chars).

Wired into all 7 note pages:
  Encounter   → section: 'encounter'
  Dictation   → section: 'hpi'
  SOAP        → section: 'soap'
  SickVisit   → section: 'sickvisit'
  WellVisit   → section: 'wellvisit'
  HospitalCourse → section: null   (server enum has no correction_hospital)
  ChartReview    → section: null   (server enum has no correction_chart)

Tests:
  shared/clinical/correction-tracker.ts (+ .test.ts) — pure heuristic
  with vectors covering the noise floor (single-word swap on long
  text → skipped; new sentence → tracked; large char diff → tracked).
  Lives in shared/ so the root vitest config picks it up; the React
  component imports from there.
2026-04-24 05:24:09 +02:00
..
bilirubin.test.ts feat(client): port Bilirubin + Fenton calculators with captured vectors 2026-04-24 01:49:45 +02:00
bilirubin.ts feat(client): port Bilirubin + Fenton calculators with captured vectors 2026-04-24 01:49:45 +02:00
bmi.test.ts feat(client): port BMI + Vitals + Resus Meds + Equipment calculators 2026-04-24 02:08:05 +02:00
bmi.ts feat(client): port BMI + Vitals + Resus Meds + Equipment calculators 2026-04-24 02:08:05 +02:00
bp.test.ts feat(client): port BP Percentile — all 10 Calculator pills now run in React 2026-04-24 02:15:17 +02:00
bp.ts feat(client): port BP Percentile — all 10 Calculator pills now run in React 2026-04-24 02:15:17 +02:00
calculators.test.ts feat(client): port age→weight + BSA + dose + GCS; shared/clinical module 2026-04-24 01:11:58 +02:00
calculators.ts feat(client): port Bedside Anaphylaxis + Cardiac + Seizure panels 2026-04-24 01:27:29 +02:00
correction-tracker.test.ts feat(notes): editable AI output + automatic correction tracking 2026-04-24 05:24:09 +02:00
correction-tracker.ts feat(notes): editable AI output + automatic correction tracking 2026-04-24 05:24:09 +02:00
fenton.test.ts feat(client): port final 5 Bedside panels — all 15 now run in React 2026-04-24 02:00:50 +02:00
fenton.ts feat(client): port final 5 Bedside panels — all 15 now run in React 2026-04-24 02:00:50 +02:00
visit-status.test.ts feat(wellvisit): port the 4 sub-tabs vanilla had — By Visit / Milestones / SSHADESS / Note 2026-04-24 05:24:09 +02:00
visit-status.ts feat(wellvisit): port the 4 sub-tabs vanilla had — By Visit / Milestones / SSHADESS / Note 2026-04-24 05:24:09 +02:00