Files
teatea-pension/.trellis/tasks/07-08-complete-ops-ai-board/prd.md

31 lines
2.4 KiB
Markdown

# Complete operations modules and AI analysis board
## Goal
Finish the currently visible operations surface by making collaboration modules fully reachable from the workspace/dashboard and adding a real persisted AI analysis board that summarizes elder AI analysis history without fabricating data.
## Requirements
- Keep the existing persisted collaboration modules for devices, notices, alerts, and family visible through permission-aware workspace navigation and dashboard entry points.
- Seed collaboration-module records idempotently for already-initialized local/demo organizations without overwriting operator-created records.
- Show an AI analysis board from persisted `elder_ai_analyses` rows, joined to elder names, with permission-aware redaction for unavailable data scopes.
- Restrict AI board access to users with `ai:read`; never expose analysis content when underlying data-scope permissions are missing.
- Preserve organization scoping for all data loads and route links, including slug-aware `/app/{organizationSlug}/...` links.
- Reuse existing module server operations and UI adapters; do not add new dependencies or fake/static operational data.
## Acceptance Criteria
- [x] Existing collaboration modules remain data-backed and reachable from unscoped and organization-scoped workspace routes.
- [x] Existing workspaces with core resident data but no collaboration data receive missing default devices, notices, alerts, and family records on seed rerun.
- [x] The dashboard can be viewed by users with collaboration or AI read permissions, not only core care/facility permissions.
- [x] The dashboard renders collaboration queues/metrics only from persisted server queries and hides unavailable sections by permission.
- [x] The dashboard renders an AI analysis board sourced from persisted analysis history when `ai:read` is present.
- [x] AI analysis board items redact result content when `canViewAnalysisScopes` denies one or more stored data scopes.
- [x] Focused tests cover idempotent collaboration seeding and AI board redaction behavior.
- [x] `pnpm type-check` and focused tests pass.
- [x] Elder AI generation uses bounded provider timeout, token, and retry controls so slow providers fail with sanitized timeout history instead of hanging indefinitely.
## Notes
- Out of scope: background alert-rule execution, family portal/authentication, AI recommendation/business-action generation changes, and new database schema.