feat: analytics dashboards & two-tier feedback system #78

Merged
chihlasm merged 13 commits from feat/analytics-feedback into main 2026-02-16 20:23:14 +00:00
chihlasm commented 2026-02-16 06:00:31 +00:00 (Migrated from github.com)

Summary

  • Session CSAT ratings: 1-5 star rating with optional comment after session completion (POST /sessions/{id}/rate)
  • Step thumbs feedback: Inline thumbs up/down on each step during navigation (POST /steps/{id}/feedback)
  • Team Analytics page (/analytics): Stat cards, stacked area chart, top flows & engineers leaderboards — team admin/owner only
  • Personal Analytics page (/analytics/me): Individual stats, charts, outcome distribution — any user
  • Flow Analytics panel: Toggle in tree editor showing sessions over time, step dropoff rates, anonymous CSAT comments
  • Backward-compatible /ratings alias routes for existing step rating endpoints

Improvements built in

  • Median duration (not average) via percentile_cont — resistant to outlier sessions
  • Active engineers metric for team dashboards
  • Anonymous feedback comments in analytics views (privacy)
  • Step dropoff metrics computed from session decisions JSONB

Backend

  • Migration 039: session_ratings table + analytics indexes
  • SessionRating model + analytics schemas
  • 4 new endpoint groups: /sessions/{id}/rate, /steps/{id}/feedback, /analytics/team|me|flows/{id}
  • 528/528 tests passing (20 new)

Frontend

  • Recharts for time-series visualization (lazy-loaded, code-split)
  • StepFeedback component with first-time hint + localStorage dismissal
  • CSATModal with star rating UI + skip option
  • FlowAnalyticsPanel with dropoff table highlighting (>20% = red)
  • Analytics nav item in sidebar

Test plan

  • Start a session, verify inline thumbs appear on each step
  • Complete a session, verify CSAT modal appears with star rating
  • Submit a rating, verify it persists (409 on duplicate)
  • Visit /analytics as team admin — verify charts render with data
  • Visit /analytics as engineer — verify access denied with link to /analytics/me
  • Visit /analytics/me — verify personal stats load
  • Open tree editor, click Analytics toggle — verify flow panel loads
  • Run pytest — all 528 tests pass
  • Run npm run build — clean build

🤖 Generated with Claude Code

## Summary - **Session CSAT ratings**: 1-5 star rating with optional comment after session completion (POST `/sessions/{id}/rate`) - **Step thumbs feedback**: Inline thumbs up/down on each step during navigation (POST `/steps/{id}/feedback`) - **Team Analytics page** (`/analytics`): Stat cards, stacked area chart, top flows & engineers leaderboards — team admin/owner only - **Personal Analytics page** (`/analytics/me`): Individual stats, charts, outcome distribution — any user - **Flow Analytics panel**: Toggle in tree editor showing sessions over time, step dropoff rates, anonymous CSAT comments - **Backward-compatible `/ratings` alias routes** for existing step rating endpoints ### Improvements built in - Median duration (not average) via `percentile_cont` — resistant to outlier sessions - Active engineers metric for team dashboards - Anonymous feedback comments in analytics views (privacy) - Step dropoff metrics computed from session decisions JSONB ### Backend - Migration 039: `session_ratings` table + analytics indexes - `SessionRating` model + analytics schemas - 4 new endpoint groups: `/sessions/{id}/rate`, `/steps/{id}/feedback`, `/analytics/team|me|flows/{id}` - 528/528 tests passing (20 new) ### Frontend - Recharts for time-series visualization (lazy-loaded, code-split) - `StepFeedback` component with first-time hint + localStorage dismissal - `CSATModal` with star rating UI + skip option - `FlowAnalyticsPanel` with dropoff table highlighting (>20% = red) - Analytics nav item in sidebar ## Test plan - [ ] Start a session, verify inline thumbs appear on each step - [ ] Complete a session, verify CSAT modal appears with star rating - [ ] Submit a rating, verify it persists (409 on duplicate) - [ ] Visit `/analytics` as team admin — verify charts render with data - [ ] Visit `/analytics` as engineer — verify access denied with link to `/analytics/me` - [ ] Visit `/analytics/me` — verify personal stats load - [ ] Open tree editor, click Analytics toggle — verify flow panel loads - [ ] Run `pytest` — all 528 tests pass - [ ] Run `npm run build` — clean build 🤖 Generated with [Claude Code](https://claude.com/claude-code)
railway-app[bot] commented 2026-02-16 06:00:48 +00:00 (Migrated from github.com)

🚅 Deployed to the patherly-pr-78 environment in selfless-grace

Service Status Web Updated (UTC)
hopeful-liberation Success (View Logs) Feb 16, 2026 at 6:02 am
patherly Success (View Logs) Feb 16, 2026 at 6:01 am
<!-- railway-bot-comment-version=2 --> <!-- railway-project-id="22b9b58c-271b-42e5-a10e-6fdec8d00134" railway-project-name="selfless-grace" --> 🚅 Deployed to the [patherly-pr-78](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134?environmentId=dde49bb9-1f55-4c6f-9979-16f085cd45b2) environment in **[selfless-grace](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134)** | **Service** | **Status** | **Web** | **Updated** (UTC) | | :--- | :--- | :--- | :--- | | hopeful-liberation | ✅ Success ([View Logs](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134/service/e1db2ee3-d241-4f45-abe4-c9c5fdf483d5?id=fedb707e-7440-41af-88db-e24740662edf&environmentId=dde49bb9-1f55-4c6f-9979-16f085cd45b2)) | | Feb 16, 2026 at 6:02 am | | patherly | ✅ Success ([View Logs](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134/service/95f556ff-5264-4116-a0c2-618a2fc53ba4?id=eae453d5-8901-4d64-a7dc-d541dc9b17f7&environmentId=dde49bb9-1f55-4c6f-9979-16f085cd45b2)) | | Feb 16, 2026 at 6:01 am |
Sign in to join this conversation.