Skip to main content

Module analytics

Module analytics 

Source
Expand description

Pre-computed analytics generator for pages export.

Generates pre-computed analytics data files (statistics.json, timeline.json, etc.) during export that enable instant dashboard rendering in the browser without expensive SQL aggregations.

§Generated Files

All files are encrypted with the main database and included in the payload:

  • statistics.json - Overall metrics (counts, time range)
  • agent_summary.json - Per-agent breakdown
  • workspace_summary.json - Per-workspace breakdown
  • timeline.json - Activity over time (daily/weekly/monthly)
  • top_terms.json - Common topics/terms from titles

§Example

use crate::pages::analytics::AnalyticsGenerator;

let generator = AnalyticsGenerator::new(&db_conn)?;
let bundle = generator.generate_all()?;
bundle.write_to_dir(&output_dir)?;

Structs§

AgentEntry
Individual agent entry.
AgentStats
Per-agent statistics.
AgentSummary
Per-agent summary.
AgentTimeline
Agent-specific timeline.
AnalyticsBundle
Bundle of all analytics data.
AnalyticsGenerator
Generator for pre-computed analytics data.
DailyEntry
Daily activity entry.
MonthlyEntry
Monthly activity entry.
Statistics
Overall statistics for the archive.
TimeRange
Time range for the archive.
Timeline
Timeline data with daily/weekly/monthly aggregations.
TopTerms
Top terms extracted from conversation titles.
WeeklyEntry
Weekly activity entry.
WorkspaceEntry
Individual workspace entry.
WorkspaceSummary
Per-workspace summary.

Functions§

aggregate_to_monthly
Aggregate daily entries to monthly.
aggregate_to_weekly
Aggregate daily entries to weekly.