AnnualSummaryService
Component Detail
Service Layer
medium complexity
backend
0
Dependencies
0
Dependents
3
Entities
0
Integrations
Description
Aggregates activity data for a given peer mentor across a full calendar year to produce the wrapped summary payload. Computes totals, streaks, top visit types, and milestone achievements by coordinating with activity and statistics repositories. Formats the result into a structured summary suitable for display and optional caching.
annual-summary-service
Sources & reasoning
Three of four organizations explicitly requested a Spotify Wrapped-style summary in workshops (line 76). The priority matrix places it NICE TO HAVE in Phase 3 (line 149), and the Phase 3 roadmap confirms it alongside badges and Advantage Calculator (line 353). Phase 3 normalizes to v1.1.
-
docs/source/likeperson.md · line 76Tre organisasjoner er inspirert av Spotify Wrapped og ønsker en funksjon som viser likepersonens bidrag over tid - «Din likepersonsårek». Målet er å gi frivillige stolthet og motivasjon
-
docs/source/likeperson.md · line 149| Gamification / Spotify Wrapped | ✓ | ✓ | - | ✓ | ✓ | NICE TO HAVE | 3 |
-
docs/source/likeperson.md · line 353Gamification / «Ditt likepersonsår» (Wrapped, badges, Advantage Calculator)
Responsibilities
- Aggregate total contacts, hours, and visit type distributions for the target year
- Identify milestones and personal bests from historical activity records
- Compute engagement streaks and peak activity periods
- Cache generated summaries to avoid redundant recomputation
- Validate that sufficient activity data exists before generating a summary
Interfaces
generateAnnualSummary(userId: string, year: number): Promise<AnnualSummary>
getCachedSummary(userId: string, year: number): Promise<AnnualSummary | null>
invalidateCache(userId: string, year: number): Promise<void>
Related Data Entities (3)
Data entities managed by this component