feat(insights): analytics API + Insights page with charts & motif web (#7) #54

Merged
rbrooks merged 2 commits from feat/v6.2-data-viz into main 2026-06-26 04:16:51 +00:00
Owner

Closes #7. Adds a dedicated Insights page with time-series charts and a motif network.

API — /api/analytics (active-project scoped, parameterized)

  • GET /overview — headline totals (entries/motifs/categories), monthly entry volume, certainty breakdown
  • GET /motif-prevalence — monthly per-motif entry counts, shaped server-side into chart rows (top 8 motifs by total, with a truncated flag)
  • GET /network — motif co-occurrence: nodes (motifs + entry counts) and edges weighted by the number of shared entries

UI — new lazy-loaded Insights page

  • Nav: Entries / Motifs / Timeline / Insights / Search / … (desktop + mobile bottom nav)
  • Entries over time (area), motif prevalence over time (stacked area, top 8), entries by certainty (bar) — built with Recharts 3.9 (React 19-compatible)
  • Motif web — co-occurrence network via @xyflow/react: node size = entry count, edge thickness = shared-entry count ("how closely tied"); click a node to open the motif
  • The page is lazy-loaded, so Recharts ships as its own ~109 KB-gzip chunk and never touches the main bundle.

Tests

analytics.test.ts — overview totals/volume/certainty, prevalence shaping, and network co-occurrence (nodes, entry counts, weighted edges). Full suite green on the dev server: 174 api / 63 app, both production builds.

The Recharts dependency + lockfile were added on a Node host (I have no local Node) in a separate build(app): commit. CHANGELOG entry will land with the v6.2.0 release notes.

🤖 Generated with Claude Code

Closes #7. Adds a dedicated **Insights** page with time-series charts and a motif network. ## API — `/api/analytics` (active-project scoped, parameterized) - `GET /overview` — headline totals (entries/motifs/categories), monthly entry volume, certainty breakdown - `GET /motif-prevalence` — monthly per-motif entry counts, shaped server-side into chart rows (top 8 motifs by total, with a `truncated` flag) - `GET /network` — motif co-occurrence: nodes (motifs + entry counts) and edges weighted by the number of **shared entries** ## UI — new lazy-loaded Insights page - Nav: Entries / Motifs / Timeline / **Insights** / Search / … (desktop + mobile bottom nav) - **Entries over time** (area), **motif prevalence over time** (stacked area, top 8), **entries by certainty** (bar) — built with **Recharts 3.9** (React 19-compatible) - **Motif web** — co-occurrence network via `@xyflow/react`: node size = entry count, edge thickness = shared-entry count ("how closely tied"); click a node to open the motif - The page is lazy-loaded, so Recharts ships as its own ~109 KB-gzip chunk and never touches the main bundle. ## Tests `analytics.test.ts` — overview totals/volume/certainty, prevalence shaping, and network co-occurrence (nodes, entry counts, weighted edges). Full suite green on the dev server: **174 api / 63 app**, both production builds. The Recharts dependency + lockfile were added on a Node host (I have no local Node) in a separate `build(app):` commit. CHANGELOG entry will land with the v6.2.0 release notes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(insights): analytics API + Insights page with charts & motif web (#7)
Some checks failed
CI / App — typecheck, test & build (push) Failing after 1m29s
CI / API — typecheck & tests (push) Successful in 2m38s
bd134ffa23
API — new /api/analytics route (active-project scoped, parameterized):
- GET /overview: headline totals, monthly entry volume, certainty breakdown
- GET /motif-prevalence: monthly per-motif entry counts, shaped for a stacked
  time chart (top 8 motifs, `truncated` flag)
- GET /network: motif co-occurrence graph — nodes (motifs + entry counts) and
  edges weighted by shared entries

UI — new lazy-loaded Insights page (nav: Entries/Motifs/Timeline/Insights/…):
- Entries-over-time area chart, motif-prevalence stacked area, certainty bar
  chart (Recharts; page is lazy-loaded so the lib stays out of the main bundle)
- Motif "web" — co-occurrence network via @xyflow/react, node size = entry
  count, edge thickness = shared-entry count; click a node to open the motif

Tests: analytics.test.ts (overview/prevalence/network shaping + co-occurrence).
Recharts dependency + lockfile added in a follow-up commit (installed on a
Node host). CHANGELOG entry comes with the v6.2.0 release notes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
build(app): add recharts ^3.9.0 for the Insights charts
All checks were successful
CI / App — typecheck, test & build (push) Successful in 2m9s
CI / App — typecheck, test & build (pull_request) Successful in 2m0s
CI / API — typecheck & tests (push) Successful in 2m54s
CI / API — typecheck & tests (pull_request) Successful in 2m45s
9a4799535e
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rbrooks deleted branch feat/v6.2-data-viz 2026-06-26 04:16:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rbrooks/TeaLeaves!54
No description provided.