Commit History
-
Improve diagram layout, relationship correctness and validation; patch dependencies Running
DONG-WEI-YANG6ec5c72
-
feat(a11y): keyboard navigation for genogram/ecomap canvas editors
DONG-WEI-YANG +1: Claude Sonnet 5Canvas has no native focusable sub-elements, so members/systems in GenogramEditor and EcomapEditor were only reachable by clicking exact pixel coordinates — completely unusable for keyboard-only or screen-reader users, and one of the accessibility gaps flagged in the original audit. Added an additive keyboard interaction layer that reuses the exact same selectedId state and mutation logic mouse clicks already drive, so no existing rendering or pointer-interaction code changed: - Canvas is now tabIndex={0} + role="application" with an aria-label and aria-describedby pointing at the existing mode-hint text (now updated to mention the keyboard controls). - ArrowRight/ArrowDown and ArrowLeft/ArrowUp cycle selection through members (sorted by generation then x — genogram's natural reading order) or systems (array order — ecomap has no hierarchy), wrapping at both ends. Works identically in read-only mode, since navigating without mutating is always safe. - Escape clears select…ad1dd60 -
chore(lint): add ESLint, fix mechanical violations, remove dead code
DONG-WEI-YANG +1: Claude Sonnet 5No lint tooling existed in this project at all. Added ESLint 9 flat config (eslint.config.js) with typescript-eslint, eslint-plugin-react, and only the two classic eslint-plugin-react-hooks rules (rules-of-hooks, exhaustive-deps) rather than its full v7 "recommended" preset — that preset bundles the entire React Compiler rule set (set-state-in-effect, immutability, purity, etc.) as errors, which flags common existing patterns (e.g. syncing a tRPC query's error into local state via useEffect) that are safe today since this codebase doesn't use the Compiler. Adopting those is a deliberate future decision, not a side effect of adding lint tooling. `npm run lint` / `lint:fix` added. Ran eslint --fix for the mechanically-safe violations (useless escapes, useless try/catch, prefer-const, unused eslint-disable directives), then fixed the rest by hand: - target="_blank" without rel="noreferrer" on 3 external links (Home.tsx, Privacy.tsx x2) — real reverse-tabnabbing risk in older browsers.…01fbb71
-
fix(a11y): associate labels with form controls in genogram/ecomap modals
DONG-WEI-YANG +1: Claude Sonnet 5MemberFormModal and RelationshipFormModal (GenogramEditor.tsx) and SystemPopup (EcomapEditor.tsx) all had <label> elements as siblings of their inputs/selects/textareas/button-groups, with no htmlFor/id or aria-labelledby connecting them. Visually fine, but a screen reader has no way to know which label describes which control — every field in these three modals was effectively unlabeled to assistive tech. Real inputs/selects/textareas get id + matching htmlFor (姓名, 出生年, 死亡年, 疾病/狀況, 特殊狀態, 世代, 系統名稱, 類型, 連結強度, 資源流向, 備註). The 此人為個案本人 checkbox was already correctly wrapped inside its <label> and needed no change. Button-group fields that don't map to a single labelable element (性別, 健康狀態, 關係類型, 關係品質) instead get a role="group" wrapper with aria-labelledby pointing at the existing heading text, converted from <label> to <span> since it isn't labeling one control. Verified in a real browser: opened all three modals via the actual add-member/add-relationship/add-system flows and confirmed vi…c3c9539 -
refactor(ui): extract shared RoleWorkspaceIndex for case-manager/supervisor landing pages
DONG-WEI-YANG +1: Claude Sonnet 5The original audit flagged all 4 role Index.tsx pages as ~400 lines of duplicated RoleCard logic, safe to unify. That was only half right — a lesson repeated from the LTC3CodePicker false-positive earlier this session: verify audit findings against the actual code before acting. nurse/Index.tsx and social-worker/Index.tsx each use a genuinely different layout (horizontal card list vs a 2-card grid built on the shared ui Card component) — those are deliberate design differences, not duplication, and were left alone. case-manager/Index.tsx and supervisor/Index.tsx, however, were byte-for-byte identical in structure, varying only by accent color (amber/purple), copy, icons, and hrefs — a genuine, safe duplication. Extracted that shared shape into RoleWorkspaceIndex.tsx, parametrized by an accentColor color-token map (following the same full-literal-classname pattern already used in RoleCard.tsx, required since Tailwind can't see dynamically interpolated class names). Both pages are now …4bd76fd -
fix(genogram,ecomap): add real readOnly mode instead of fake no-op onChange
DONG-WEI-YANG +1: Claude Sonnet 5social-worker/Retrieve.tsx and VoiceWizard.tsx's final-preview step passed onChange={() => {}} to GenogramEditor/EcomapEditor to fake read-only viewing. This didn't work: pointer/double-click handlers still ran fully (opening add/edit modals, allowing drag-to-move, selection, delete), they just failed to persist since onChange was swallowed — so a viewer could interact with a supposedly read-only diagram and see modals with no way to actually save, a confusing dead-end UI. Added a proper `readOnly` prop to both editors. When set, pointer handlers only allow selection and canvas panning, double-click is a no-op, the mutating toolbar buttons (新增成員/建立關係/刪除/自動排列 and their ecomap equivalents) are hidden and replaced with a "唯讀檢視" badge, and the selected-member info bar's 編輯 button is hidden. Non-mutating toolbar actions (reset view, export PNG) remain available. Verified via real browser: created a test record with a genogram member, retrieved it through social-worker/Retrieve.tsx, confir…bc0709a -
fix(feedback): FeedbackWidget silently reported success on server errors
DONG-WEI-YANG +1: Claude Sonnet 5fetch() only rejects on network failure -- a 4xx/5xx response still resolves normally, so the missing response.ok check meant any server-side validation error or 500 still showed "感謝您的寶貴建議!" while the feedback was never actually saved. Also replaces the alert() fallback with an inline error message matching the rest of the app's error-display style. First real use of the jsdom + RTL component-test harness added earlier this session -- FeedbackWidget needed no providers (no trpc client, no router), making it a clean first case. Also fixes a gap in the harness itself: RTL's cleanup() wasn't wired into afterEach, so multiple render() calls across tests in one file piled up in the same jsdom document instead of unmounting. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>44c3303 -
refactor(frontend): unify genogram/ecomap/key-display on shared components
DONG-WEI-YANG +1: Claude Sonnet 5case-manager/NewCareTracking.tsx, supervisor/NewQualityCheck.tsx, and nurse/{NewSOAP,NewNursingPlan}.tsx each hand-rolled their own plain table-row-form genogram/ecomap editor (~130-460 duplicated lines per page) instead of using the real canvas-based GenogramEditor/ EcomapEditor components already running in production on the social-worker pages -- same Genogram/Ecomap data shape, purely a UI duplication. case-manager and supervisor also had their own static KeyDisplay reimplementation lacking the shared component's live 7-day countdown. Swapped all four pages onto the shared components. KeyDisplay gains an optional onReset prop (backward compatible -- other callers are unaffected) to preserve case-manager/supervisor's "建立新紀錄" button, which the shared component didn't previously offer. Along the way, case-manager/NewCareTracking.tsx and supervisor/NewQualityCheck.tsx also gain a createRecord.isError error banner (mirroring nurse/NewSOAP.tsx's existing pattern) -- both pages previous…668ce24 -
fix(security): patch critical vulnerabilities from full-app audit
DONG-WEI-YANG +1: Claude Sonnet 5- record.retrieve/genogram.load/ecomap.load now travel via POST body instead of GET, so the record access key never lands in URL query strings, proxy logs, browser history, or Referer headers (httpBatchLink methodOverride + allowMethodOverride) - express.json body limit 2mb -> 20mb, and ai.ts's imageBase64 gets an explicit .max() -- the old 2mb cap silently 413'd realistic photo uploads and multi-file record attachments before Zod ever ran - app.use('/trpc/ai.', aiLimiter) never actually matched in Express 5 (a path-prefix mount only matches when followed by '/' or EOS, never a procedure name) -- every paid AI call was silently running under only the generic 100/min limiter instead of the intended 10/min. Fixed via explicit req.path.startsWith() check; also caps tRPC batch size so one HTTP request can't smuggle dozens of AI calls past the per-request limiter - genogram.save/ecomap.save never verified the caller's key against the record's keyHash before encryptin…b81c93f
-
refactor(ui): extract shouldOfferOfflineAI() helper, DRY the modal guard
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)Replaces 4 inline copies (3 in AiFillButton, 1 in SmartTranscript) of the enabled/declined check with a single helper in deviceAI.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>dbfa411 -
refactor(device-ai): extract wllamaProgress pub-sub, fix Vite chunk warning
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)OfflineAIBanner now imports download-progress from the lightweight wllamaProgress.ts instead of the heavy wllamaProvider.ts — removing the static-import edge that prevented wllamaProvider from code-splitting. wllamaProvider re-exports onDownloadProgress/getDownloadProgress so existing importers (tests) are unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>a70fc1e -
feat(ui): wire offline-AI modal trigger + banner mount at App level
DONG-WEI-YANGa752482 -
feat(ui): OfflineAIBanner — sticky download progress with cancel
DONG-WEI-YANG88ee8cf -
feat(ui): EnableOfflineAIModal — modal-on-failure for offline AI opt-in
DONG-WEI-YANG3c1dcdf
-
fix: voice recording blocked in HF Spaces iframe
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Root cause: getUserMedia() and SpeechRecognition are blocked in cross-origin iframes without explicit microphone permission delegation. HF Spaces embeds apps in an iframe that doesn't set allow="microphone". Fixes: - Add microphone=(self) to Permissions-Policy header - Detect iframe context and show "open in new tab" button with guidance - Improve error message for not-allowed in iframe vs standalone context Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>da07cf4 -
fix: resolve 45 TypeScript errors + add org_name field + deep integration tests
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- Add org_name (機構名稱) field to all record forms (visit, SOAP, nursing note/plan, social assessment) - Fix tRPC v11 onError removal: migrate to useEffect + query.error pattern - Fix AI response type narrowing: birth_year typeof guard, union literal assertions - Fix GenogramEditor: use Set<GenogramRelationship> instead of missing .id - Fix Retrieve pages: Record<string, any> for display-only data rendering - Fix LTC3CodeSuggestions: explicit map return type for null filtering - Add vite-env.d.ts for CSS module declarations - Add 21 deep integration tests (real server + tRPC client, all routers) - Total: 176 tests passing, 0 TypeScript errors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>7539384
-
fix: Word export TRPCError, genogram download DOM attach, save speed
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Three production bug fixes: - export.ts: throw TRPCError instead of plain Error (was silently failing) - GenogramEditor: add document.body.appendChild before a.click() (cross-browser) - record.ts: run hashKey + QR generation concurrently (faster save) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>11880c8 -
feat: T-shaped McGoldrick-Gerson family connection renderer
DONG-WEI-YANG +1: Claude Sonnet 4.6Replace per-relationship diagonal rendering with batch drawFamilyConnections() that draws couple horizontal bars (with quality overlays), vertical descent lines, horizontal sibship bars, and vertical child drops per family unit. Non-family-unit relationships (twins, siblings, etc.) fall back to the existing drawRelationship(). Add DESCENT_LENGTH = 48px constant. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>0df2c35 -
feat: device AI integration, extend apiStatus, WASM vite config
DONG-WEI-YANG +1: Claude Sonnet 4.6Task 6: AiFillButton wires in deviceAI — probes capability on mount, tries device-side soap_classify before server, updates disabled guard and no-key warning to reflect device AI availability level. Task 7: apiStatus now returns deviceAICapable metadata documenting built-in AI, WASM, and vocab-correction browser support tiers. Task 8: vite.config excludes onnxruntime-web from optimizeDeps and sets worker format to 'es' for WASM compatibility. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>40a83c7 -
feat: SmartTranscript vocab + device AI correction steps (Tasks 4+5)
DONG-WEI-YANG +1: Claude Sonnet 4.6Add two client-side correction steps before the server pipeline: Step 0 — instant vocabulary correction via loadRoleVocab/correctWithVocab; Step 1 — on-device AI correction via deviceAI.execute('correct'). Add optional `role` prop (default 'nurse') and propagate it to all 8 consumer pages/components. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>4837cc3
-
feat: voice wizard, quick record UI, abuse arrow, quick mode toggle
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Voice Step Wizard (/wizard): - 5-step guided genogram/ecomap construction via voice - Step 1: client info, Step 2: family members, Step 3: relationships - Step 4: external resources (ecomap), Step 5: preview + save - Each step: independent recording → AI extraction → editable cards - Embedded GenogramEditor/EcomapEditor preview in final step Quick Record (/quick): - Streamlined 3-step flow: choose role → voice record → AI fill → save - Designed for 3-minute record completion - Large role selection cards, full-width voice area Quick Mode Toggle (all 6 form pages): - "快速模式/完整模式" toggle button in page headers - Quick mode hides secondary form sections, keeps voice + key fields - Essential fields per role always visible Abuse Directed Arrow: - New quality type 'abuse' with zigzag + directional arrow - Arrow points from abuser (from_id) → victim (to_id) - AI prompt supports 虐待/施暴/家暴 Chinese mappings Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>5c4cd74 -
feat: complete McGoldrick-Gerson genogram + Hartman ecomap standard compliance
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Genogram — new relationship qualities: - close_conflicted: double parallel line + zigzag overlay (親密衝突) - fused_hostile: triple parallel line + zigzag overlay (融合敵對) Genogram — new relationship types: - adopted: dashed line (收養) - foster: dotted line (寄養) - identical_twin / fraternal_twin: twin relationship types (雙胞胎) Genogram — new health type: - substance_abuse: dark amber color (物質濫用/酗酒/藥物成癮) Genogram — special member symbols: - pregnancy: small triangle, light blue (懷孕) - miscarriage: small triangle with X (流產) - stillbirth: small triangle with X, gray (死產) Genogram — layout: - autoLayout now sorts siblings by birth_year (oldest on left per standard) Ecomap — new system types: - recreation: emerald, musical note icon (休閒) - transportation: sky blue, bus icon (交通) - other: stone, asterisk icon (自訂) Ecomap — new flow option: - none: no arrows drawn (無流動) All Zod schemas, AI prompts, coercion enums, and offline extractor updated to match new types across 8 files. Co-Authored-…0aaeec3 -
fix: genogram/ecomap line rendering to McGoldrick-Gerson standard
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Genogram (家系圖): - Close → double parallel line (═══) instead of thick single line - Very close/fused → triple parallel line (≡≡≡) instead of double - Cutoff → line with gap + perpendicular bars (─┃ ┃─) instead of solid - Conflict/hostile zigzag improved: sharper peaks, larger amplitude - Added 'separated' (分居) relationship type with single slash symbol Ecomap (生態圖): - Stressful connection → zigzag line (∿∿∿) instead of dashed line Also fixed genogram.ts Zod schema to include all 7 quality levels (was missing very_close, hostile) and added separated type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>60cc41b -
fix: comprehensive security hardening, iOS voice fallback, and UX resilience
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- iOS voice fallback: MIME type detection + record-only mode when Web Speech API unavailable - HF Whisper fallback for audio transcription when Gemini fails - OpenCC s2twp layer in NLP pipeline for simplified→traditional Chinese conversion - localStorage draft autosave (useAutosave hook) across all 6 form pages - AI fill no longer overwrites user-entered fields (skip-if-filled pattern) - DB transaction wrapping for record creation (prevents orphaned data) - keyPrefix column for O(1) record lookup (replaces O(n) bcrypt scan) - Prompt injection fix: sanitizeForPrompt + Zod array/string constraints - Security headers: HSTS, X-Frame-Options, X-Content-Type-Options, Permissions-Policy - CSP: removed unsafe-eval, kept unsafe-inline for HF Spaces compatibility - AI-specific rate limiter (10 req/min), retrieve limiter tightened to 3/min - Crypto upgrades: bcrypt 10→12 rounds, key entropy 15→32 bytes - Role-recordType cross validation via Zod .refine() - fileName sanitization + file array .max(…94a07ff
-
fix: unify design system — focus rings, border-radius, CollapsibleSection
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- Unify focus ring: remove global CSS override, standardize all inputs to indigo-200/500 (was blue-200, blue-400, slate-400 in various files) - Fix border-radius: inline inputs in NewSOAP/NewNursingPlan rounded→rounded-lg - Extract shared CollapsibleSection to src/components/ui/CollapsibleSection.tsx (replaces local CollapsiblePanel in NewRecord + CollapsibleSection in NewSOAP/NewNursingPlan) - Fix social-worker Index: add missing group class for hover arrow - Fix GenogramEditor, NewNursingNote focus rings to match system Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>2b24125 -
fix: ErrorBoundary, WCAG contrast, form label accessibility
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- Add React ErrorBoundary in main.tsx with Chinese error UI + reload button (prevents white-screen crash) - Fix footer link contrast: text-slate-300 → text-slate-400 (WCAG AA) - Add htmlFor/id associations on form inputs: - FeedbackWidget textarea + contact input - LTC3CodePicker search input (aria-label) - VitalSignsGrid in NewSOAP and NewNursingNote Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>820d0cd -
feat: replace all UI emoji with SVG icons
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- EcomapEditor: 11 system type icons + client center drawn via Canvas Path2D (cross-platform consistent, color-matched) - Role index pages: social-worker, case-manager, supervisor heading icons replaced with Heroicons SVG - FeedbackWidget: floating button, success check, category labels all switched from emoji to SVG - Zero emoji remaining in src/**/*.{tsx,ts} Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>8eca767 -
fix: Dockerfile Alpine→Slim, dotenv loading, AI fallback, SVG icons
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- Dockerfile: switch node:20-alpine to node:20-slim to fix 8hr+ build timeout on HF Spaces (native modules no longer need compilation) - Server: add dotenv for .env loading, fix API key not being read - AI: Chinese error messages, apiStatus endpoint, smart audio→text fallback when Gemini key unavailable - UI: replace emoji icons with professional SVG (Heroicons) on home page role cards and step indicator Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>431d9e7
-
fix: canvas min-height + CSP headers for HF Spaces
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- GenogramEditor: set min-height 480px / 60vh (was collapsing to 0) - EcomapEditor: set min-height 480px - Server: add Content-Security-Policy headers allowing unsafe-eval and unsafe-inline for HF Spaces iframe embedding, plus connect-src for Gemini and HuggingFace API calls Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>a7d3a65 -
fix: Gemini 429 auto-fallback + genogram/ecomap rendering crash
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Three critical fixes: 1. AiFillButton: When Gemini Audio returns 429 (quota exceeded), automatically falls back to text mode (HF models) instead of just showing an error. Users see "自動切換文字分析..." message. 2. GenogramEditor: Add null safety for QUALITY_STYLES lookup — prevents canvas crash when quality value is undefined or unknown. Falls back to 'normal' style. 3. NewRecord handleAiResult: Add proper type casting and defaults for all genogram member/relationship/ecomap fields to prevent undefined values from crashing the rendering pipeline. - gender defaults to 'other', health to 'healthy' - quality defaults to 'normal' - conditions coerced from array to string Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>091e6b1 -
feat: add step progress indicator to all role pages
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Shows a 5-step visual progress bar at the top of every record page: 🎙️ 語音錄音 → 🤖 AI 填寫 → ✏️ 檢查修改 → 🔒 同意送出 → 📄 下載 Word - Current step auto-detected from state (transcript/aiFilledFields/result) - Completed steps show green checkmarks - Active step highlighted in indigo with scale effect - Mobile-responsive: shows step icons + current step name on small screens - Added to all 6 role pages (social worker, SOAP, nursing note/plan, case manager, supervisor) in both form and result views Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>02fe62d -
feat: 4-layer NLP correction pipeline for STT error fixing
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Adds multi-layer voice transcription correction between recording and AI extraction: Layer 1 — Punctuation restoration (regex): Inserts commas before kinship terms, transitions, age mentions. Critical for clause-context protection rules. Layer 2 — Homophone correction (dictionary): 80+ medical/LTC domain homophones (高血吧→高血壓, 居福→居服, 阿罵→阿嬤) Layer 3 — Medical term normalization: Abbreviations (BP→血壓), informal→formal (血壓高→高血壓), service name→code mapping (身體照顧→BA01) Layer 4 — HF model deep correction (Qwen2.5-72B): AI-powered final pass for remaining errors, with length validation to prevent hallucination. Pipeline integrated into SmartTranscript component — runs automatically after recording stops. Shows correction details to user (e.g., 「高血吧」→「高血壓」). New API endpoint: ai.correctTranscript for standalone use. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>9392a10 -
feat: adopt v3_CLI best practices — medical NLP, confidence scores, 7-level quality
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Genogram/Ecomap accuracy improvements inspired by v3_CLI reference project: - Clause context protection rules prevent cross-person misattribution (e.g., "父親張明,55歲,有糖尿病" correctly attributes all to one person) - Medical dictionary with 60+ conditions across 8 specialties (cardiovascular, metabolic, respiratory, cancer, mental, disabled) - Confidence scoring (0-1) on every member, relationship, and ecomap system - Relationship quality expanded from 5 to 7 levels (McGoldrick standard): very_close, close, normal, distant, conflicted, hostile, cutoff - GenogramEditor updated with visual styles for new quality levels - Offline regex-based NLP extractor as API fallback (no LLM needed): kinship dictionary, age extraction, health condition classification - Health risk analyzer: genetic pattern detection, multi-morbidity, caregiver burden assessment with actionable recommendations Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>ce46768 -
feat: upgrade STT quality + AI accuracy + smart UX for voice recording
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Phase 1 — Wire audioBlob to Gemini Audio as primary STT: - Connect onAudioBlob across all 6 role pages - AiFillButton auto-switches to Gemini Audio mode when blob available - audioAndParse upgraded with multi-key rotation + JSON retry logic Phase 2 — Improve AI prompts for structured extraction accuracy: - Dynamic year calculation (no more hardcoded 2026) - Add ORAL_SPEECH_RULES for Taiwanese colloquial speech patterns - Strengthen anti-hallucination rules with specific prohibitions - All 5 prompt files updated Phase 3 — UX improvements: - SmartTranscript component: auto Gemini re-transcription, editable text, source indicator (browser/Gemini/user edit) - AiFilledNotice component: shows specific field names AI filled (replaces generic count message) - All 6 role pages upgraded with new components Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>182d832 -
fix: add friendly Chinese error messages for voice recognition failures
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Map technical SpeechRecognition error codes (not-allowed, audio-capture, network, service-not-available) to actionable Chinese messages so users know how to fix permission or connectivity issues. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>2484f83
-
feat: add role-specific voice guidance hints to VoiceRecorder
DONG-WEI-YANG4149062 -
feat: P1 — Gemini Vision OCR for genogram/ecomap from photos
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- imageAndParse: send image to Gemini Vision, get structured JSON with retry - ocrGenogram endpoint: photo → genogram members + relationships - ocrEcomap endpoint: photo → ecomap systems + connections - ImageUploadButton component: file picker + camera capture + preview + loading Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>758fa3c -
feat: P0 voice upgrade — MediaRecorder + noise suppression + Gemini audio mode
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)VoiceRecorder: - Add MediaRecorder for audio blob capture alongside SpeechRecognition - Enable noiseSuppression, echoCancellation, autoGainControl - Add real-time 5-bar volume indicator via AnalyserNode - New onAudioBlob prop for passing audio to AI processing AiFillButton: - Add dual mode: text analysis (existing) + audio analysis (Gemini native) - Mode toggle appears when audio blob is available - "音檔精準辨識" uses Gemini Audio API for higher accuracy Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>deff6e1 -
feat: professional UI overhaul — polished landing, role cards, flow guide
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- Global CSS: font smoothing, custom scrollbar, smooth focus rings, selection color - Home: gradient logo mark, feature badges (AI/encryption/auto-delete), cleaner hierarchy - RoleCard: horizontal layout with feature tags, subtle hover, professional typography - FlowGuide: numbered circles with connectors, streamlined to 6 essential steps Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>8daaede -
feat: create shared AiFillButton component (Task 5)
DONG-WEI-YANG +1: Claude Sonnet 4.6Adds src/components/AiFillButton.tsx — a reusable React component that wraps the AI voice-to-form tRPC mutation with loading spinner, error display, and role-specific color theming via a static COLOR_MAP to satisfy Tailwind CSS 4's static class detection requirement. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1e8e0e4 -
feat: add VitalSignsSuggestion component for AI vital signs review
DONG-WEI-YANG +1: Claude Sonnet 4.6Displays AI-extracted vital signs split by confidence level: high-confidence fields (>= 0.7) are shown in an amber-highlighted grid marked as auto-filled, while low-confidence fields (< 0.7) appear in a list with individual Apply buttons. Returns null when there are nothing to display. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>88078ea
-
fix: implement Word export for all 7 record pages and eliminate mock patterns
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- Create shared useWordExport() hook (tRPC → base64 → Blob → download) - Wire Word download into all pages: NewSOAP, NewNursingNote, NewNursingPlan, NewRecord, Retrieve, NewCareTracking, NewQualityCheck - Replace Math.random() ID generation with crypto.randomUUID() - Replace random node positioning with deterministic grid layout - Update audit script with exclude filters for known-good patterns - All 7 audit categories now pass clean Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>c8d0859
-
feat: add feedback system, flow guide, Word export cleanup
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- Isolated feedback SQLite (data/feedback.db) with submit/list API - FeedbackWidget: floating button on every page, 5 categories - FlowGuide: 8-step visual operation flow (intent proof) - Word export: removed header/footer branding (UI-only authorization) - Registered feedback + export routers in appRouter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>9fa0cea -
feat: complete Group B+C+D — full system implementation
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Backend (Group B): - tRPC routers: record, genogram, ecomap, voice, ltc3, consent, export, rag - Services: crypto (AES-256-GCM+HKDF), Word export, voice structuring, LTC3 matching, cleanup cron, crawl targets - Middleware: rate limiter per endpoint Frontend (Group C): - Role selection home page with 9 shared UI components - Social worker workspace: visit record + social assessment forms - Nurse workspace: SOAP + nursing note + nursing plan forms - Case manager workspace: care tracking with LTC3 code mapping - Supervisor workspace: quality check with compliance review - Canvas editors: genogram (1422 lines, McGoldrick) + ecomap (865 lines) - Voice recorder (Web Speech API) + LTC3 code suggestions - Consent dialog + key/QR display + retrieve form with QR scanner RAG + AI (Group D): - Per-role distributed SQLite RAG stores (4 databases) - Embedder (Transformers.js all-MiniLM-L6-v2) - Hybrid search (0.7*vector + 0.3*BM25) - Record ingester with PII anonymization - Auto-crawler (9 LTC r…7c280c7