The CarbonIQ reward system gamifies waste reporting by awarding points, badges, and maintaining leaderboards to encourage user engagement and data quality. Users earn rewards for various actions and can compete in global and institutional leaderboards.
Users earn points for various activities:
- Base Report Creation: 10 points
- Report with Image: +5 bonus points
- Detailed Report: +3 points (includes measurements and feedback)
- Daily Streak: +2 points per consecutive day
- Weekly Goal: +25 points (5+ reports in a week)
- Monthly Goal: +100 points (20+ reports in a month)
- Badge Earned: +50 points
14 different badges available:
- First Steps - Create your first waste report
- Weekly Warrior - Create 5 reports in a week
- Monthly Champion - Create 20 reports in a month
- Eco Warrior - Create 100+ waste reports
- Photo Master - Include images in 25 reports
- Detail Oriented - Submit 10 detailed reports with measurements
- Safety First - Report 50 waste sites marked as safe
- Urban Guardian - Report 30 urban waste sites
- Rural Protector - Report 20 rural waste sites
- Waste Categorizer - Report all 7 waste types
- Streak Master - Maintain a 7-day reporting streak
- Early Adopter - Be among the first 100 users
- Community Leader - Have the most reports in your institution
Users progress through levels based on total points:
- Level 1: 0 points
- Level 2: 100 points
- Level 3: 250 points
- Level 4: 500 points
- Level 5: 1,000 points
- And so on... (15 levels total)
Multiple leaderboard views:
- Global Leaderboard - All users ranked by points
- Institution Leaderboard - Users within same institution
- Category Leaderboards - By reports, points, streaks, or badges
- Institution Rankings - Institutions ranked by collective performance
- Time-based Rankings - Weekly, monthly, or all-time
GET /rewards/profile
Returns comprehensive user profile including stats, recent rewards, and achievement progress.
GET /rewards/stats
Returns detailed statistics with points breakdown by category.
GET /rewards/history?limit=50&skip=0&reward_type=points
Returns paginated reward history with optional filtering.
GET /rewards/achievements
Returns progress towards all unearned badges.
GET /rewards/badges
Returns information about all available badges and requirements.
GET /rewards/leaderboard?period=all_time&limit=50
Returns global leaderboard, institution leaderboard (if applicable), and user's rank.
GET /rewards/leaderboard/global?period=weekly&limit=50
Returns global leaderboard across all users.
GET /rewards/leaderboard/institution/{institution_id}?period=monthly
Returns leaderboard for specific institution.
GET /rewards/leaderboard/category/reports?limit=20
Categories: reports, points, streak, badges
GET /rewards/leaderboard/institutions?limit=20
Returns institutions ranked by collective performance.
GET /rewards/my-rank?period=all_time
Returns current user's rank and position.
GET /rewards/recent-achievements?limit=20
Returns recent badge achievements across all users (community feed).
POST /rewards/sync-stats
Manually trigger user stats synchronization.
POST /rewards/admin/recalculate-ranks
Admin-only endpoint to recalculate all user ranks.
The reward system automatically processes rewards when reports are created. Each time a user creates a report via:
POST /reports/POST /reports/with-image
The system:
- Awards base points for report creation
- Awards bonus points for images and detailed reports
- Checks for streak milestones
- Evaluates badge requirements
- Updates user statistics
- Processes weekly/monthly goals
Stores individual rewards earned by users:
{
"_id": ObjectId,
"user_email": "user@example.com",
"reward_type": "points|badge",
"points": 10,
"badge_type": "first_report",
"action_type": "report_created",
"description": "Base points for creating a waste report",
"earned_at": ISODate,
"report_id": "report_object_id"
}Aggregated user statistics:
{
"_id": ObjectId,
"user_email": "user@example.com",
"full_name": "John Doe",
"total_points": 156,
"total_reports": 12,
"badges_earned": ["first_report", "weekly_warrior"],
"current_streak": 3,
"longest_streak": 5,
"reports_with_images": 8,
"reports_by_waste_type": {"organic": 5, "plastic": 4, "mixed": 3},
"last_report_date": ISODate,
"rank": 45,
"institution_id": "institution_object_id"
}# Create a report
curl -X POST "http://localhost:8000/reports/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"student_id": "12345",
"waste_type": "organic",
"location": {"type": "Point", "coordinates": [-1.286389, 36.817223]},
"safe": true,
"urban_area": true
}'
# Check your profile
curl -X GET "http://localhost:8000/rewards/profile" \
-H "Authorization: Bearer YOUR_TOKEN"# Get global leaderboard
curl -X GET "http://localhost:8000/rewards/leaderboard/global" \
-H "Authorization: Bearer YOUR_TOKEN"
# Get your rank
curl -X GET "http://localhost:8000/rewards/my-rank" \
-H "Authorization: Bearer YOUR_TOKEN"# See progress towards badges
curl -X GET "http://localhost:8000/rewards/achievements" \
-H "Authorization: Bearer YOUR_TOKEN"- Show Real-time Feedback: Display earned rewards immediately after report creation
- Progress Indicators: Show progress bars for badge achievements
- Leaderboard Updates: Refresh leaderboards regularly (consider caching)
- Achievement Notifications: Highlight when users earn new badges
- Streak Visualization: Show streak counters and streak risks
- Daily Goals: Encourage daily reporting for streak maintenance
- Weekly Challenges: Promote weekly goal achievements
- Social Features: Show recent community achievements
- Institution Competition: Highlight institution vs institution competition
- Personal Progress: Show level progression and next level targets
- Batch Processing: Reward calculations run asynchronously
- Caching: Cache leaderboards for better performance
- Indexing: Proper database indexes for fast queries
- Periodic Updates: Run rank recalculation periodically
- Seasonal Events: Special badges and multipliers during campaigns
- Team Challenges: Group challenges between institutions
- Referral Rewards: Points for bringing new users
- Quality Metrics: Rewards based on report accuracy/verification
- Environmental Impact: Track and reward actual environmental impact
- Social Sharing: Integration with social media for achievements
- Push Notifications: Alert users about achievements and leaderboard changes
- Rewards Not Processing: Check RewardsService logs for errors
- Incorrect Stats: Use
/rewards/sync-statsto recalculate - Missing Badges: Verify badge requirements in
BADGE_REQUIREMENTS - Leaderboard Issues: Run admin rank recalculation
- Performance Issues: Check database indexes and query optimization
The reward system is designed to not interfere with core functionality. If reward processing fails, report creation still succeeds, and rewards can be recalculated later.