Skip to content

feat: implement campaign analytics rollups, trending, and impact metr…#110

Merged
BarryArinze merged 4 commits into
aid-linkk:masterfrom
omolobamoyinoluwa-max:feature/85-campaign-analytics-rollups
Jun 22, 2026
Merged

feat: implement campaign analytics rollups, trending, and impact metr…#110
BarryArinze merged 4 commits into
aid-linkk:masterfrom
omolobamoyinoluwa-max:feature/85-campaign-analytics-rollups

Conversation

@omolobamoyinoluwa-max

Copy link
Copy Markdown
Contributor

…ics (#85)

  • Add CampaignHourlyStat, CampaignMonthlyStat, CampaignTrending, RollupTracker models
  • Extend JobType enum with analytics job types
  • Add analytics config block with configurable cron patterns and feature flag
  • Add new types: TrendingCampaign, ImpactMetrics, HistoricalStats
  • Implement Redis-backed cache layer for real-time campaign stats
  • Add getTrendingCampaigns, getCampaignImpactMetrics, getCampaignHistoricalStats
  • Add getAggregatedCampaignAnalytics for admin dashboards
  • Implement hourly/monthly rollup logic (idempotent via upsert)
  • Implement trending campaign refresh with composite scoring
  • Add new endpoints: GET /campaigns/trending (period, sortBy, limit) GET /campaigns/:id/impact-metrics GET /campaigns/:id/statistics/historical (granularity, date range) GET /analytics/campaigns (admin, paginated rollup data)
  • Hook real-time cache updates into DonationService and DistributionService
  • Create analytics worker with scheduled jobs (hourly, monthly, trending, reconcile)
  • Feature-flag analytics worker via ANALYTICS_WORKER_ENABLED
  • Document new endpoints in API.md

Closes #85

…ics (aid-linkk#85)

- Add CampaignHourlyStat, CampaignMonthlyStat, CampaignTrending, RollupTracker models
- Extend JobType enum with analytics job types
- Add analytics config block with configurable cron patterns and feature flag
- Add new types: TrendingCampaign, ImpactMetrics, HistoricalStats
- Implement Redis-backed cache layer for real-time campaign stats
- Add getTrendingCampaigns, getCampaignImpactMetrics, getCampaignHistoricalStats
- Add getAggregatedCampaignAnalytics for admin dashboards
- Implement hourly/monthly rollup logic (idempotent via upsert)
- Implement trending campaign refresh with composite scoring
- Add new endpoints:
  GET /campaigns/trending (period, sortBy, limit)
  GET /campaigns/:id/impact-metrics
  GET /campaigns/:id/statistics/historical (granularity, date range)
  GET /analytics/campaigns (admin, paginated rollup data)
- Hook real-time cache updates into DonationService and DistributionService
- Create analytics worker with scheduled jobs (hourly, monthly, trending, reconcile)
- Feature-flag analytics worker via ANALYTICS_WORKER_ENABLED
- Document new endpoints in API.md

Closes aid-linkk#85
…type errors

- Add missing AnalyticsService imports in donation.service.ts and distribution.service.ts
- Remove unused CACHE_PREFIX_TRENDING_ZSET constant in analytics.service.ts
- Remove unused 'amount' variable in donation.service.ts refund handler
- Fix Prisma JSON null type errors in recovery.service.ts (writeAuditLog helper and create functions)
@BarryArinze BarryArinze merged commit 3accbc3 into aid-linkk:master Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Campaign Statistics Performance & Trending Metrics

2 participants