Skip to content

feat: engagement analytics suite#623

Open
mpurnell1 wants to merge 2 commits into
commaai:masterfrom
mpurnell1:report-card
Open

feat: engagement analytics suite#623
mpurnell1 wants to merge 2 commits into
commaai:masterfrom
mpurnell1:report-card

Conversation

@mpurnell1

@mpurnell1 mpurnell1 commented Mar 29, 2026

Copy link
Copy Markdown

Depends on #622

Summary

Adds comprehensive engagement analytics to new-connect, giving openpilot users detailed insights into how well the system drives on their routes.

Engagement Summary (device dashboard)

  • Donut chart showing engaged/overriding/disengaged time breakdown
  • 12 paired stats: distance, duration, engagement (time/dist), disengagements, overrides, streaks, miles/disengage, best/worst drive, trend
  • Configurable drive count (5/10/25/50) with paginated API fetching
  • Trend comparison against previous N drives
  • Progressive loading with throttled updates
  • Copy text and save PNG for sharing

Drive Calendar

  • GitHub-style heatmap showing engagement rate by day for last 12 weeks
  • Cursor-based pagination to cover full date range
  • Clickable days navigate to route detail
  • Custom instant tooltips

Per-route Drive Engagement

  • Donut chart + stats grid in Route Info
  • Engaged by time vs distance comparison

Enhanced Timeline

  • Hover labels with segment type and duration
  • Cross-component highlighting: timeline, donut, and map are linked
  • Proportional donut overlay showing which portion of a slice the hovered segment represents
  • Consecutive short events merge into single blocks

Engagement Map

  • Interactive Leaflet map replacing static Mapbox image
  • GPS trace colored by engagement state (green/indigo)
  • Override dots with tooltips
  • Cross-highlights with donut and timeline

Technical

  • Shared EngagementHover type in derived.ts enables cross-component hover
  • No new dependencies
  • Responsive across desktop, tablet, and mobile
  • Line limit temporarily bumped to 6000 for development

Test plan

  • Verify engagement summary loads and updates when changing drive count
  • Verify calendar populates progressively
  • Verify per-route donut and stats display correctly
  • Verify timeline hover shows labels and cross-highlights donut/map
  • Verify engagement map shows colored traces and override dots
  • Verify copy and save image work
  • Verify responsive layout on mobile/tablet/desktop

The Mapbox geocoding API now returns 131 Fleet Street (EC4A 2BH) instead
of 133 Fleet Street (EC4A 2BB) for the same coordinates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Mar 29, 2026

Copy link
Copy Markdown

Changes:

path lines diff
./components/EngagementCalendar.tsx 198 +198
./components/ShareReportCard.tsx 174 +174
./components/EngagementDonut.tsx 172 +172
./components/ReportCard.tsx 169 +169
./components/RouteReportCard.tsx 147 +147
./components/RouteEngagementMap.tsx 132 +132
./api/derived.ts 297 +116
./components/Timeline.tsx 290 +111
./pages/dashboard/activities/RouteActivity.tsx 131 +35
./utils/format.ts 93 +10
./App.browser.test.tsx 43 +3
./pages/dashboard/activities/DeviceActivity.tsx 152 +2
./components/RouteStaticMap.tsx 0 -63

Total lines: 5944 (+1206)

@mpurnell1 mpurnell1 force-pushed the report-card branch 4 times, most recently from 84bec51 to ca4a517 Compare March 29, 2026 23:19
- Engagement Summary: donut chart, 12 stats, drive count selector, trend
  comparison, progressive loading, copy/save image sharing
- Drive Calendar: 12-week heatmap, clickable days, instant tooltips
- Per-route Drive Engagement: donut + stats grid, responsive layout
- Enhanced Timeline: hover labels, segment merging, cross-component
  highlighting with proportional donut overlay
- Engagement Map: interactive Leaflet map with colored traces, override
  dots, tooltips, cross-highlighting
- Shared EngagementHover type for linked hover across donut/timeline/map
- Responsive across desktop, tablet, and mobile
- Temporarily bump line and bundle size limits for development

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Mar 29, 2026

Copy link
Copy Markdown

deployed preview: https://623.connect-d5y.pages.dev

Welcome to connect! Make sure to:

  • read the contributing guidelines
  • mark your PR as a draft until it's ready to review
  • post the preview on Discord; feedback from users will speedup the PR review

Mobile

Desktop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant