-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Create a comprehensive analytics dashboard with interactive charts and insights about document usage, query patterns, and system performance.
User Stories
- As a user, I want to see which documents I query most often
- As a user, I want to understand my query patterns over time
- As a user, I want to see analytics about response confidence and accuracy
- As a user, I want to identify trends in my document usage
- As a user, I want to export analytics data for reporting
Tasks
Dependencies Installation
- Add to
package.json{ "dependencies": { "chart.js": "^4.4.0", "vue-chartjs": "^5.3.0", "date-fns": "^3.0.0" } } - Run package installation
- Verify chart.js integration with Vue 3
Analytics Infrastructure
-
Create
src/store/analytics.ts- State for analytics data
- Actions to collect query data
- Getters for computed metrics
- Data aggregation functions
- Time-based filtering (day, week, month, year)
-
Create
src/utils/analytics.ts- Calculate document usage frequency
- Compute average confidence scores
- Analyze query patterns
- Process time-series data
- Generate trend indicators
- Export functions for CSV/JSON
-
Instrument existing code
- Track queries in
src/services/api.ts - Log response times
- Record confidence scores
- Track document sources accessed
- Monitor error rates
- Track queries in
Dashboard Page
-
Create
src/pages/InsightsView.vue- Overall layout with grid system
- Summary statistics cards
- Chart containers
- Date range selector
- Document filter dropdown
- Export data button
- Responsive design for mobile
-
Update
src/router/index.ts- Add
/insightsroute - Add navigation menu item
- Set page title and metadata
- Add
Chart Components
- Create
src/components/InsightCharts.vue(container) - Create individual chart components:
-
DocumentUsageChart.vue- Pie chart- Most queried documents
- Interactive segments
- Percentage labels
- Click to filter other charts
-
QueryPatternsChart.vue- Line chart- Queries over time (daily, weekly, monthly)
- Multiple series for different documents
- Smooth curves
- Tooltip with details
-
ConfidenceDistributionChart.vue- Bar chart- Distribution of confidence scores
- Bins: 0-20%, 20-40%, 40-60%, 60-80%, 80-100%
- Color-coded bars
- Average confidence indicator
-
SourceHeatmapChart.vue- Heatmap- Document pages vs. time period
- Most/least referenced pages
- Color intensity for frequency
- Interactive cells
-
Statistics & Metrics
- Create statistics components:
-
StatCard.vue- Reusable metric card- Large number display
- Trend indicator (up/down)
- Comparison to previous period
- Icon and label
-
- Implement metrics:
- Total queries count
- Average confidence score
- Most queried document
- Average response time
- Queries per day (7-day average)
- Total documents in system
- Most active hours
- Query success rate
Advanced Analytics
- Page reference frequency analysis
- Which pages are cited most
- Identify underutilized documents
- Generate recommendations
- Query complexity metrics
- Average query length
- Common query patterns
- Frequently used keywords
- Response quality metrics
- Confidence score trends
- Source count per response
- Response length distribution
Data Export
- Implement export functionality
- Export to CSV
- Export to JSON
- Export charts as images (PNG)
- Generate PDF report
- Include date range in filename
- Progress indicator for large exports
Acceptance Criteria
- Dashboard displays all analytics charts correctly
- Charts are interactive (hover, click, zoom)
- Data accurately reflects actual query history
- Can filter analytics by date range (last 7/30/90 days, all time)
- Can filter by specific documents
- Statistics cards show accurate metrics with trends
- Dashboard loads efficiently even with large datasets (1000+ queries)
- Charts are responsive and work on mobile
- Can export data to CSV and JSON
- All charts have proper legends and labels
- Color scheme matches application theme
- Tooltips provide detailed information
- No performance degradation with analytics running
Dependencies
- All previous versions (v0.1.0 - v0.4.0)
Documentfromsrc/store/types.tsQuerySourcefromsrc/store/types.ts- Existing query and message data
- New chart.js and vue-chartjs libraries
Design Notes
Layout
- 4-column grid on desktop, 1-column on mobile
- Summary cards at top
- Large charts in middle section
- Detailed tables at bottom
Colors (Chart.js compatible)
- Primary:
#3B82F6(blue) - Success:
#22C55E(green) - Warning:
#EAB308(yellow) - Danger:
#EF4444(red) - Neutral:
#6B7280(gray)
Chart Options
- Enable animations (300ms duration)
- Responsive: true
- MaintainAspectRatio: false
- Show legend for multi-series charts
- Grid lines: subtle gray
- Font family: match app theme
Technical Considerations
Performance
- Aggregate data client-side for <10,000 queries
- Consider backend aggregation for larger datasets
- Cache computed analytics for 5 minutes
- Use Web Workers for heavy calculations
- Lazy load charts (only render when in viewport)
Data Storage
- Store raw analytics data in IndexedDB if exceeds localStorage limit
- Keep last 365 days of detailed data
- Aggregate older data into monthly summaries
- Implement data cleanup strategy
Chart Configuration
// Example configuration
{
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: { display: true, position: 'bottom' },
tooltip: { mode: 'index', intersect: false }
},
scales: {
y: { beginAtZero: true }
}
}Testing Checklist
- Test with no query history
- Test with small dataset (<10 queries)
- Test with large dataset (1000+ queries)
- Test date range filtering
- Test document filtering
- Test export to CSV
- Test export to JSON
- Test chart interactivity (hover, click)
- Test responsive behavior on mobile
- Test with different time zones
- Test chart rendering performance
- Test with incomplete data (missing fields)
- Verify calculation accuracy of all metrics
Related Issues
- Depends on: All previous versions (v0.1.0 - v0.4.0)
- Related to: Future v0.6.0 (suggestions can use analytics data)
Milestone
v0.5.0 Release
Additional Resources
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request