Skip to content

[P1][Analytics][planned] Persist session analytics summaries for trend curves #112

Description

@xodapi

Summary

Persist privacy-safe SessionAnalyticsSummaryRecord outputs from the AnalyzeSession batch contract introduced in #110 / PR #111. This is the storage bridge needed before building cognitive ability trend curves (#48) and admin analytics (#91).

Problem

#110 defines the synthetic fixtures and server-side summary contract, but summaries are not yet persisted or queryable. If #48 starts directly from UI charts, it will mix product visualization with storage decisions and make the analytics layer harder to audit.

Scope

  • Add an explicit persistence contract for SessionAnalyticsSummaryRecord.
  • Decide whether the first implementation is Prisma/PostgreSQL table, append-only event table, or repository abstraction over existing practice events.
  • Store only privacy-safe summary fields: no raw Brain ID, no auth tokens, no email, no screenshots, no raw localStorage, no raw event payloads unless explicitly reviewed.
  • Add read APIs or service functions needed by [P1][Analytics][planned] Add cognitive ability trend curves #48: by pseudonymous user/session owner, by module, by date range, and aggregate trend-ready series.
  • Keep migrations small and explicit if a DB schema change is required.

Acceptance Criteria

Verification

  • pnpm lint
  • pnpm test
  • pnpm build
  • targeted route/service tests for persistence contract

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:analyticsAnalytics, EventBus, metrics, WASMenhancementNew feature or requestpriority:P1High priority stabilization workstatus:plannedPlanned and not yet implemented

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions