Activity Aggregation Service
API Contract
REST
/api/v1/activity-aggregations
4 endpoints
POST
/api/v1/activity-aggregations/api/v1/activity-aggregations/aggregate
Aggregate activities for org/scope/date range
Public
Request Example
{
"org_id": "org_482",
"scope_id": "scope_region_07",
"scope_level": "region",
"date_range": {
"from": "2025-01-01",
"to": "2025-12-31"
}
}
Response Example
{
"org_id": "org_482",
"scope_id": "scope_region_07",
"scope_level": "region",
"date_range": {
"from": "2025-01-01",
"to": "2025-12-31"
},
"total_activities": 1247,
"total_hours": 9832.5,
"activity_type_breakdown": [
{
"type_id": "act_type_01",
"bufdir_category": "individual_mentoring",
"count": 842,
"hours": 6740
},
{
"type_id": "act_type_02",
"bufdir_category": "group_activity",
"count": 405,
"hours": 3092.5
}
],
"aggregated_at": "2026-03-26T10:15:00Z"
}
GET
/api/v1/activity-aggregations/api/v1/activity-aggregations/rollup/:scope_id
Get rollup totals for a scope
Public
Request Example
{}
Response Example
{
"scope_id": "scope_region_07",
"level": "region",
"rollup": {
"total_activities": 1247,
"total_hours": 9832.5,
"total_mentors": 83,
"total_youth": 412
},
"child_chapters": [
{
"chapter_id": "ch_071",
"chapter_name": "Stavanger Røde Kors",
"activities": 310,
"hours": 2450
},
{
"chapter_id": "ch_072",
"chapter_name": "Sandnes Røde Kors",
"activities": 287,
"hours": 2180.5
}
]
}
POST
/api/v1/activity-aggregations/api/v1/activity-aggregations/mentor-breakdown
Get mentor participation breakdown for a scope/date range
Public
Request Example
{
"scope_id": "scope_region_07",
"date_range": {
"from": "2025-01-01",
"to": "2025-12-31"
}
}
Response Example
{
"scope_id": "scope_region_07",
"date_range": {
"from": "2025-01-01",
"to": "2025-12-31"
},
"total_mentors": 83,
"mentor_details": [
{
"mentor_id": "usr_1021",
"mentor_name": "Kari Andersen",
"activity_count": 24,
"total_hours": 192,
"chapters": [
"ch_071"
]
},
{
"mentor_id": "usr_1042",
"mentor_name": "Lars Eriksen",
"activity_count": 18,
"total_hours": 144,
"chapters": [
"ch_072",
"ch_073"
]
}
]
}
POST
/api/v1/activity-aggregations/api/v1/activity-aggregations/detect-duplicates
Detect duplicate activities in aggregation scope
Public
Request Example
{
"scope_id": "scope_region_07",
"date_range": {
"from": "2025-01-01",
"to": "2025-12-31"
}
}
Response Example
{
"scope_id": "scope_region_07",
"duplicates_found": 3,
"duplicate_groups": [
{
"activity_ids": [
"act_8821",
"act_8822"
],
"reason": "same_mentor_same_youth_same_date",
"date": "2025-06-15",
"mentor_id": "usr_1021"
}
]
}