[loggi-nh0] Add new chart types: cumulative, gap analysis, distributions #113
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bead ID:
loggi-nh0Type: task
Priority: P2
Status: closed
Close reason: Added 4 new chart types: Cumulative Progress (line chart, all types), Record Gaps (histogram, all types), Duration Distribution (histogram, timerange), Word Length Distribution (histogram, diary). Added backend /stats/distribution endpoint for diary word counts. All charts hidden by default, discoverable via Customize modal. Shared autoBucketHistogram helper for distribution charts. 6 new tests for the distribution endpoint, all 171 tests pass.
Why
The current stats only show activity over time and time-of-day/weekday breakdowns. Missing: cumulative progress (motivational running total), gap analysis (consistency insight), and distribution histograms (shape of individual records).
What
New charts (all
defaultVisible: false)Cumulative Progress (all types)
{ id: 'cumulative', label: 'Cumulative Progress', defaultVisible: false }Gap Analysis (all types)
{ id: 'gaps', label: 'Record Gaps', defaultVisible: false }Duration Distribution (timerange only)
/stats/sessionsendpoint (already returns per-session durations){ id: 'dur_dist', label: 'Duration Distribution', defaultVisible: false, kinds: ['timerange'] }Word Count Distribution (diary only)
GET /api/entries/<id>/stats/distributionreturning{ records: [{ word_count: N }] }— just the word counts, no text content{ id: 'word_dist', label: 'Word Length Distribution', defaultVisible: false, kinds: ['diary'] }Backend (diary distribution endpoint)
Add to
app/stats.py:Returns per-record word counts for diary entries. Apply same date filtering as other endpoints.
Frontend
PLOT_REGISTRYinstats.jscardBuildersentries inrenderStatsGrid()stats-charts.jsloadStats()(only for diary entries)Where
app/stats.py— new/stats/distributionendpointapp/static/js/stats.js— registry, builders, data loadingapp/static/js/stats-charts.js— 4 new render functionsConstraints
stats-charts.jsis already 723 lines — keep new renderers conciseAcceptance criteria
Dependencies:
loggi-d7a