Skip to content

[Backend] Real course analytics with database aggregation pipeline #26

Description

@jobbykings

Description

The analytics service (analyticsService.ts) and data aggregation service (dataAggregation.ts) currently have @ts-ignore comments and incomplete implementations. Build out real database aggregation queries that power course analytics and reporting.

Files to Modify

  • backend/src/services/analyticsService.ts — Implement real aggregation queries, fix @ts-ignore
  • backend/src/services/dataAggregation.ts — Build MongoDB aggregation pipeline for reports
  • backend/src/controllers/analyticsController.js — Wire to real service calls
  • backend/src/models/ — Add aggregation helper methods to Course, Enrollment, User models

Definition of Done

  • Enrollment trend data aggregated from actual enrollment records
  • Course completion rates calculated from real progress data
  • Student performance metrics (avg scores, time to complete) from real quiz/submission data
  • Demographic breakdowns from user profile data (aggregated, anonymized)
  • All aggregation queries use database indexes for performance
  • No @ts-ignore comments remain in analytics code

Acceptance Criteria

  • GET /api/analytics/enrollment-trends returns real enrollment data over time
  • GET /api/analytics/completion-rates returns actual completion percentages
  • Analytics for specific course return that course's real metrics, not mocks
  • Large date range queries complete within 2 seconds
  • No PII exposed in aggregated analytics responses
  • TypeScript compiles cleanly with no @ts-ignore in analytics files

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaignarea: frontendNext.js/React frontendenhancementNew feature or requestpriority: mediumMedium priority - important

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions