Bufdir Data Aggregation
Feature Detail
Description
Automatically aggregates all registered peer mentor activities, events, and contact interactions across the reporting period into the structured metrics that Bufdir requires. This includes counting unique participants, activity types, hours delivered, and geographic distribution across organizational units (regions, local chapters). The aggregation must handle multi-organization contexts where the same app instance serves NHF, Blindeforbundet, HLF, and Barnekreftforeningen, ensuring each organization's data is isolated and correctly attributed. Activity records already captured during normal peer mentor workflows feed directly into this aggregation without requiring any re-entry.
Analysis
Eliminates the manual Excel aggregation that currently consumes significant coordinator time across all four organizations. Since Bufdir funding is contingent on accurate reporting, automation directly protects revenue streams. Reduces human error risk in grant reporting, which has compliance implications.
Requires a well-defined data model mapping internal activity types to Bufdir's official reporting categories. Supabase views or RPC functions are appropriate for the aggregation queries. Must account for coordinators who register on behalf of peer mentors (proxy/bulk registration) so these are not double-counted.
Components (206)
Shared Components
These components are reused across multiple features
User Interface (59)
Service Layer (52)
Data Layer (33)
Infrastructure (54)
User Stories (20)
As a As a Coordinator
I want to see how aggregated activities are distributed across geographic regions before submitting to Bufdir
So that I can verify that all regions are represented and identify any regions with unusually low activity that may indicate missing registrations
- Given aggregation completes, when the summary screen is shown, then a geographic distribution section lists activity counts grouped by region or municipality
- Given a region has zero activity, when the distribution is displayed, then that region appears with a count of zero and is visually distinguished from active regions
- Given the coordinator taps a region row, when the detail expands, then the underlying activity records contributing to that region's count are listed
- +2 more
As a As a Coordinator
I want to view a history of all previously generated and submitted Bufdir reports with their key metrics
So that I can audit past submissions, compare trends across reporting periods, and resubmit a previous report if Bufdir requests a correction
- Given the coordinator opens the report history screen, when history loads, then all past Bufdir exports for their organisation are listed in reverse chronological order
- Given a history entry is displayed, when the coordinator views it, then the period, export date, file format, total activities, and unique participant count are all shown
- Given the coordinator taps a history entry, when the detail opens, then a summary metrics widget shows the full breakdown of that report's aggregated data
- +3 more
As a As a Organization Administrator
I want to see how aggregated activities are distributed across geographic regions before submitting to Bufdir
So that I can verify that all regions are represented and identify any regions with unusually low activity that may indicate missing registrations
- Given aggregation completes, when the summary screen is shown, then a geographic distribution section lists activity counts grouped by region or municipality
- Given a region has zero activity, when the distribution is displayed, then that region appears with a count of zero and is visually distinguished from active regions
- Given the coordinator taps a region row, when the detail expands, then the underlying activity records contributing to that region's count are listed
- +2 more
As a As a Organization Administrator
I want to view a history of all previously generated and submitted Bufdir reports with their key metrics
So that I can audit past submissions, compare trends across reporting periods, and resubmit a previous report if Bufdir requests a correction
- Given the coordinator opens the report history screen, when history loads, then all past Bufdir exports for their organisation are listed in reverse chronological order
- Given a history entry is displayed, when the coordinator views it, then the period, export date, file format, total activities, and unique participant count are all shown
- Given the coordinator taps a history entry, when the detail opens, then a summary metrics widget shows the full breakdown of that report's aggregated data
- +3 more
As a As a Coordinator
I want the aggregation to check my data against Bufdir's alignment rules and flag any non-compliant values before I export
So that I am confident the submission meets Bufdir's acceptance criteria and will not be rejected after I send it
- Given aggregation completes, when the alignment validator runs, then all Bufdir-specified rules are checked against the aggregated dataset
- Given a critical violation is found, when validation results are shown, then the violation is marked as blocking and the export button is disabled until it is resolved
- Given a non-critical warning is found, when validation results are shown, then the warning is displayed with an explanation but the export button remains enabled
- +3 more
As a As a Coordinator
I want the aggregation to automatically identify and merge duplicate participant records that span multiple chapters
So that Bufdir receives a count of unique individuals rather than inflated counts caused by the same person appearing in several chapters
- Given activity records contain participants registered under multiple chapters, when aggregation runs, then the deduplication service identifies records belonging to the same individual
- Given duplicates are identified, when they are merged, then only one unique participant record is counted in the final Bufdir totals
- Given deduplication completes, when the aggregation summary is shown, then the number of detected duplicates and the resulting unique participant count are both visible
- +2 more
As a As a Coordinator
I want to preview the structured Bufdir report with all fields and values before I confirm the export
So that I can catch errors or omissions in the aggregated data while I can still correct them, rather than discovering problems after submission
- Given aggregation completes, when the coordinator navigates to the preview screen, then all Bufdir report sections are rendered with their computed field values
- Given a field value fails Bufdir's validation rules, when the preview renders, then that field row is highlighted and the validation summary banner shows the total number of errors
- Given the coordinator taps a validation error, when the detail expands, then the error description explains what is wrong and what value is expected
- +3 more
As a As a Organization Administrator
I want the aggregation to check my data against Bufdir's alignment rules and flag any non-compliant values before I export
So that I am confident the submission meets Bufdir's acceptance criteria and will not be rejected after I send it
- Given aggregation completes, when the alignment validator runs, then all Bufdir-specified rules are checked against the aggregated dataset
- Given a critical violation is found, when validation results are shown, then the violation is marked as blocking and the export button is disabled until it is resolved
- Given a non-critical warning is found, when validation results are shown, then the warning is displayed with an explanation but the export button remains enabled
- +3 more
As a As a Organization Administrator
I want the aggregation to automatically identify and merge duplicate participant records that span multiple chapters
So that Bufdir receives a count of unique individuals rather than inflated counts caused by the same person appearing in several chapters
- Given activity records contain participants registered under multiple chapters, when aggregation runs, then the deduplication service identifies records belonging to the same individual
- Given duplicates are identified, when they are merged, then only one unique participant record is counted in the final Bufdir totals
- Given deduplication completes, when the aggregation summary is shown, then the number of detected duplicates and the resulting unique participant count are both visible
- +2 more
As a As a Organization Administrator
I want to preview the structured Bufdir report with all fields and values before I confirm the export
So that I can catch errors or omissions in the aggregated data while I can still correct them, rather than discovering problems after submission
- Given aggregation completes, when the coordinator navigates to the preview screen, then all Bufdir report sections are rendered with their computed field values
- Given a field value fails Bufdir's validation rules, when the preview renders, then that field row is highlighted and the validation summary banner shows the total number of errors
- Given the coordinator taps a validation error, when the detail expands, then the error description explains what is wrong and what value is expected
- +3 more
As a As a Coordinator
I want to select a reporting period using presets or a custom date range before running Bufdir data aggregation
So that the aggregated data precisely covers the grant period Bufdir requires, avoiding under- or over-reporting
- Given the coordinator opens the period selection screen, when the screen loads, then a list of preset periods (full year, H1, H2, Q1–Q4) is displayed alongside a custom range option
- Given the coordinator taps a preset, when the preset is selected, then the start and end dates populate automatically and the record-count banner refreshes to show the matching activity count
- Given the coordinator chooses a custom date range, when they confirm the range, then the system validates that start date is before end date and that the range does not exceed allowed limits
- +2 more
As a As a Coordinator
I want the aggregation to automatically map each registered activity type to the corresponding Bufdir reporting category
So that the exported report uses Bufdir's taxonomy without requiring me to manually reclassify hundreds of activities
- Given activities are fetched for the selected period, when the aggregation service processes them, then each activity is assigned a Bufdir category according to the active mapping configuration
- Given all activities are successfully mapped, when the aggregation summary is displayed, then activity counts are grouped by Bufdir category
- Given one or more activity types have no mapping defined, when aggregation runs, then a warning lists the unmapped types and the coordinator is blocked from proceeding to export until the gap is resolved
- +2 more
As a As a Coordinator
I want the aggregation to strictly include only my organisation's data and exclude records from other organisations sharing the platform
So that Bufdir receives accurate data for my organisation alone and no cross-contamination of another organisation's activities inflates or distorts my report
- Given a coordinator from organisation A triggers aggregation, when the aggregation query runs, then only activity records with organisation A's tenant identifier are included
- Given the platform has records from multiple organisations, when aggregation completes, then the summary totals are consistent with the count of records belonging exclusively to the coordinator's organisation
- Given an attempt is made to access another organisation's records, when the query executes against Supabase, then row-level security policies block the access and no cross-org data is returned
- +2 more
As a As a Coordinator
I want to trigger the Bufdir data aggregation process and see real-time progress while it runs
So that I know the system is working and can intervene if the process stalls, rather than waiting with no feedback
- Given the coordinator initiates aggregation, when the process starts, then an aggregation progress indicator appears showing the current stage (fetching, categorising, deduplicating, distributing)
- Given aggregation is running, when a stage completes, then the progress indicator advances and labels the next stage
- Given aggregation completes successfully, when all stages finish, then an aggregation summary widget shows total activities, unique participants, category breakdown, and geographic distribution
- +2 more
As a As a Coordinator
I want to export the validated Bufdir aggregation as a properly formatted file (Excel, CSV, or PDF) ready for submission
So that I can submit the data to Bufdir using the format they accept without any further manual formatting
- Given the coordinator selects a file format (Excel, CSV, or PDF) and confirms export, when the export process runs, then a file is generated in the selected format with Bufdir's required column structure
- Given the file is generated, when the coordinator downloads it, then the file opens correctly in the corresponding application (Excel for .xlsx, spreadsheet viewer for .csv, PDF reader for .pdf)
- Given the export completes, when the coordinator checks report history, then a new entry appears with the correct period, timestamp, format, and metrics
- +3 more
As a As a Organization Administrator
I want to select a reporting period using presets or a custom date range before running Bufdir data aggregation
So that the aggregated data precisely covers the grant period Bufdir requires, avoiding under- or over-reporting
- Given the coordinator opens the period selection screen, when the screen loads, then a list of preset periods (full year, H1, H2, Q1–Q4) is displayed alongside a custom range option
- Given the coordinator taps a preset, when the preset is selected, then the start and end dates populate automatically and the record-count banner refreshes to show the matching activity count
- Given the coordinator chooses a custom date range, when they confirm the range, then the system validates that start date is before end date and that the range does not exceed allowed limits
- +2 more
As a As a Organization Administrator
I want the aggregation to automatically map each registered activity type to the corresponding Bufdir reporting category
So that the exported report uses Bufdir's taxonomy without requiring me to manually reclassify hundreds of activities
- Given activities are fetched for the selected period, when the aggregation service processes them, then each activity is assigned a Bufdir category according to the active mapping configuration
- Given all activities are successfully mapped, when the aggregation summary is displayed, then activity counts are grouped by Bufdir category
- Given one or more activity types have no mapping defined, when aggregation runs, then a warning lists the unmapped types and the coordinator is blocked from proceeding to export until the gap is resolved
- +2 more
As a As a Organization Administrator
I want the aggregation to strictly include only my organisation's data and exclude records from other organisations sharing the platform
So that Bufdir receives accurate data for my organisation alone and no cross-contamination of another organisation's activities inflates or distorts my report
- Given a coordinator from organisation A triggers aggregation, when the aggregation query runs, then only activity records with organisation A's tenant identifier are included
- Given the platform has records from multiple organisations, when aggregation completes, then the summary totals are consistent with the count of records belonging exclusively to the coordinator's organisation
- Given an attempt is made to access another organisation's records, when the query executes against Supabase, then row-level security policies block the access and no cross-org data is returned
- +2 more
As a As a Organization Administrator
I want to trigger the Bufdir data aggregation process and see real-time progress while it runs
So that I know the system is working and can intervene if the process stalls, rather than waiting with no feedback
- Given the coordinator initiates aggregation, when the process starts, then an aggregation progress indicator appears showing the current stage (fetching, categorising, deduplicating, distributing)
- Given aggregation is running, when a stage completes, then the progress indicator advances and labels the next stage
- Given aggregation completes successfully, when all stages finish, then an aggregation summary widget shows total activities, unique participants, category breakdown, and geographic distribution
- +2 more
As a As a Organization Administrator
I want to export the validated Bufdir aggregation as a properly formatted file (Excel, CSV, or PDF) ready for submission
So that I can submit the data to Bufdir using the format they accept without any further manual formatting
- Given the coordinator selects a file format (Excel, CSV, or PDF) and confirms export, when the export process runs, then a file is generated in the selected format with Bufdir's required column structure
- Given the file is generated, when the coordinator downloads it, then the file opens correctly in the corresponding application (Excel for .xlsx, spreadsheet viewer for .csv, PDF reader for .pdf)
- Given the export completes, when the coordinator checks report history, then a new entry appears with the correct period, timestamp, format, and metrics
- +3 more