Commit History
-
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: 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
-
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