Bufdir Report Export
Feature Detail
Description
A one-tap export that compiles all activity data for a reporting period into the format required by Bufdir (Norwegian Directorate for Children, Youth and Family Affairs). The export aggregates across all peer mentors in the organisation for the selected period, maps internal activity types to Bufdir categories, and produces output in whatever format Bufdir accepts — currently expected to be a structured document or API submission once Norse Digital Products completes negotiations with Bufdir. The feature must handle the organisational hierarchy correctly: NHF has 12 national associations, 9 regions, and 1 400 local chapters, each of which may need to report separately or roll up. The export UI should let the user select the reporting scope (local chapter, region, national) and period, preview a summary of what will be included, and confirm before generating. A PDF or CSV download serves as the fallback before any Bufdir API is available.
Analysis
Directly replaces the most time-consuming administrative task for all four organisations. Grant funding depends on accurate and timely Bufdir submissions; errors or missed deadlines have direct financial consequences. A one-tap export also removes the main coordinator objection to adopting the app, since the reporting payoff is immediate.
Export logic runs in a Supabase Edge Function to avoid client-side memory issues with large datasets. The function accepts org_id, scope_id (chapter/region/national), and date range, and returns a structured JSON payload that the client renders as a preview before the user confirms. PDF generation via a server-side library; CSV as a simpler fallback. Bufdir API integration is a Phase 3 dependency — design the internal data model now to make the mapping straightforward later. Store each export as a record in generated_reports for audit purposes.
Components (215)
Shared Components
These components are reused across multiple features
User Interface (59)
Service Layer (52)
Data Layer (33)
Infrastructure (54)
User Stories (16)
As a As a Coordinator
I want to see a real-time progress indicator during Bufdir report generation that shows which processing stage is currently running
So that I know the export is actively processing, understand how long it will take, and can identify if the process has stalled
- Given an export is triggered, when processing begins, then a progress indicator immediately appears showing the current stage name and a progress bar
- Given the export moves through processing stages, when each stage completes, then the stage label updates to the next stage and the progress bar advances proportionally
- Given the export takes longer than 30 seconds, when the coordinator is waiting, then an estimated time remaining is displayed based on the volume of records being processed
- +3 more
As a As a Coordinator
I want to include supporting attachments (e.g., event invitations, participation documentation) bundled with the Bufdir export
So that I can provide Bufdir with the documentary evidence they may require for verification of grant-funded activities, particularly for NHF where document attachments to activities are a specific requirement
- Given the coordinator is on the export configuration screen, when they see the attachment option, then a toggle is shown with the count of available attachments for the selected period and scope
- Given the coordinator enables attachment bundling, when the export is triggered, then all files attached to in-scope activities are collected and included in a ZIP archive alongside the main report
- Given an activity has no attachments, when the bundle is created, then the missing attachment does not cause an error — the export proceeds with only the files that exist
- +3 more
As a As a Organization Administrator
I want to see a real-time progress indicator during Bufdir report generation that shows which processing stage is currently running
So that I know the export is actively processing, understand how long it will take, and can identify if the process has stalled
- Given an export is triggered, when processing begins, then a progress indicator immediately appears showing the current stage name and a progress bar
- Given the export moves through processing stages, when each stage completes, then the stage label updates to the next stage and the progress bar advances proportionally
- Given the export takes longer than 30 seconds, when the coordinator is waiting, then an estimated time remaining is displayed based on the volume of records being processed
- +3 more
As a As a Organization Administrator
I want to include supporting attachments (e.g., event invitations, participation documentation) bundled with the Bufdir export
So that I can provide Bufdir with the documentary evidence they may require for verification of grant-funded activities, particularly for NHF where document attachments to activities are a specific requirement
- Given the coordinator is on the export configuration screen, when they see the attachment option, then a toggle is shown with the count of available attachments for the selected period and scope
- Given the coordinator enables attachment bundling, when the export is triggered, then all files attached to in-scope activities are collected and included in a ZIP archive alongside the main report
- Given an activity has no attachments, when the bundle is created, then the missing attachment does not cause an error — the export proceeds with only the files that exist
- +3 more
As a As a Coordinator
I want to choose between PDF, CSV, and Excel export formats when generating a Bufdir report
So that I can produce the exact file format required by Bufdir's current submission process or by my organization's internal archiving requirements
- Given the coordinator is on the export format selection screen, when they view the options, then PDF, CSV, and Excel formats are presented with a 'Recommended for Bufdir portal' label on the appropriate format
- Given the coordinator selects Excel format, when the export completes, then the generated .xlsx file contains all required Bufdir columns with correct headers and data types
- Given the coordinator selects CSV format, when the export completes, then the generated .csv file uses the delimiter and encoding expected by the Bufdir import system
- +3 more
As a As a Coordinator
I want to access a complete history of all previously generated Bufdir export reports with their metadata and to re-export any previous report
So that I can retrieve filed reports for audits, compare submissions across periods, and regenerate a report if the original file is lost or needs to be resubmitted
- Given the coordinator navigates to export history, when the screen loads, then a list of all previous exports is displayed ordered by date descending, showing period, format, file size, and generating user
- Given the coordinator taps a history entry, when they open it, then they can re-download the stored file without re-running aggregation
- Given the coordinator initiates a re-export for a period that already has an export, when they confirm, then the system logs both the original and re-export with timestamps for audit purposes
- +3 more
As a As a Coordinator
I want to preview the complete Bufdir report with all aggregated data and field-level validation results before triggering the final export
So that I can identify and correct any data quality issues before submitting an incorrect report to Bufdir
- Given the coordinator proceeds to preview, when the preview screen loads, then all Bufdir report sections are rendered with their field names, aggregated values, and validation status icons
- Given there are validation errors in the report, when the preview loads, then a validation summary banner is displayed at the top listing all failed fields with explanations
- Given the coordinator wants to compare with prior period, when they tap the period comparison toggle, then a diff view shows the delta between current and previous period values for each field
- +3 more
As a As a Coordinator
I want to select which organizational units (chapters, regions, local branches) are included in a Bufdir export
So that I can generate reports that correctly reflect the organizational scope of my grant agreement without including activity data from units covered under separate grant applications
- Given the coordinator opens scope selection, when the hierarchy loads, then all organization units they have access to are displayed in a tree structure with checkboxes
- Given the coordinator selects a parent node (e.g., a region), when the selection is applied, then all child units under that region are automatically included in scope
- Given a peer mentor belongs to multiple chapters within the selected scope, when the export aggregates participants, then that peer mentor is counted only once in the participant total
- +3 more
As a As a Organization Administrator
I want to choose between PDF, CSV, and Excel export formats when generating a Bufdir report
So that I can produce the exact file format required by Bufdir's current submission process or by my organization's internal archiving requirements
- Given the coordinator is on the export format selection screen, when they view the options, then PDF, CSV, and Excel formats are presented with a 'Recommended for Bufdir portal' label on the appropriate format
- Given the coordinator selects Excel format, when the export completes, then the generated .xlsx file contains all required Bufdir columns with correct headers and data types
- Given the coordinator selects CSV format, when the export completes, then the generated .csv file uses the delimiter and encoding expected by the Bufdir import system
- +3 more
As a As a Organization Administrator
I want to access a complete history of all previously generated Bufdir export reports with their metadata and to re-export any previous report
So that I can retrieve filed reports for audits, compare submissions across periods, and regenerate a report if the original file is lost or needs to be resubmitted
- Given the coordinator navigates to export history, when the screen loads, then a list of all previous exports is displayed ordered by date descending, showing period, format, file size, and generating user
- Given the coordinator taps a history entry, when they open it, then they can re-download the stored file without re-running aggregation
- Given the coordinator initiates a re-export for a period that already has an export, when they confirm, then the system logs both the original and re-export with timestamps for audit purposes
- +3 more
As a As a Organization Administrator
I want to preview the complete Bufdir report with all aggregated data and field-level validation results before triggering the final export
So that I can identify and correct any data quality issues before submitting an incorrect report to Bufdir
- Given the coordinator proceeds to preview, when the preview screen loads, then all Bufdir report sections are rendered with their field names, aggregated values, and validation status icons
- Given there are validation errors in the report, when the preview loads, then a validation summary banner is displayed at the top listing all failed fields with explanations
- Given the coordinator wants to compare with prior period, when they tap the period comparison toggle, then a diff view shows the delta between current and previous period values for each field
- +3 more
As a As a Organization Administrator
I want to select which organizational units (chapters, regions, local branches) are included in a Bufdir export
So that I can generate reports that correctly reflect the organizational scope of my grant agreement without including activity data from units covered under separate grant applications
- Given the coordinator opens scope selection, when the hierarchy loads, then all organization units they have access to are displayed in a tree structure with checkboxes
- Given the coordinator selects a parent node (e.g., a region), when the selection is applied, then all child units under that region are automatically included in scope
- Given a peer mentor belongs to multiple chapters within the selected scope, when the export aggregates participants, then that peer mentor is counted only once in the participant total
- +3 more
As a As a Coordinator
I want to select the reporting period for a Bufdir export using preset options (e.g., H1, H2, full year) or a custom date range
So that I can generate reports that match exactly the grant period Bufdir requires without manually calculating date boundaries
- Given the coordinator opens period selection, when they view the screen, then they see preset options for H1, H2, and full year of the current and previous calendar year
- Given the coordinator selects a preset period, when the period is applied, then the record count banner updates immediately to show how many activities fall within that period
- Given the coordinator wants a non-standard period, when they tap custom date range, then a date range picker opens allowing them to set any start and end date
- +3 more
As a As a Coordinator
I want to generate a complete Bufdir-compliant activity report for my organization with a single export action
So that I can submit required government grant reporting without manual data aggregation or spreadsheet work
- Given a coordinator is on the Bufdir export screen, when they tap the export button, then the system initiates aggregation across all activities in scope without requiring manual configuration
- Given an export is triggered, when the system aggregates data, then all peer mentor activities are mapped to the correct Bufdir activity categories using the category mapping configuration
- Given aggregation completes, when the report is generated, then the output file conforms to the current Bufdir schema and passes format validation
- +2 more
As a As a Organization Administrator
I want to select the reporting period for a Bufdir export using preset options (e.g., H1, H2, full year) or a custom date range
So that I can generate reports that match exactly the grant period Bufdir requires without manually calculating date boundaries
- Given the coordinator opens period selection, when they view the screen, then they see preset options for H1, H2, and full year of the current and previous calendar year
- Given the coordinator selects a preset period, when the period is applied, then the record count banner updates immediately to show how many activities fall within that period
- Given the coordinator wants a non-standard period, when they tap custom date range, then a date range picker opens allowing them to set any start and end date
- +3 more
As a As a Organization Administrator
I want to generate a complete Bufdir-compliant activity report for my organization with a single export action
So that I can submit required government grant reporting without manual data aggregation or spreadsheet work
- Given a coordinator is on the Bufdir export screen, when they tap the export button, then the system initiates aggregation across all activities in scope without requiring manual configuration
- Given an export is triggered, when the system aggregates data, then all peer mentor activities are mapped to the correct Bufdir activity categories using the category mapping configuration
- Given aggregation completes, when the report is generated, then the output file conforms to the current Bufdir schema and passes format validation
- +2 more