Custom Report
Data Entity
Description
User-defined report configurations allowing org admins to define tailored report queries beyond standard Bufdir and team reports, specifying filters, groupings, and output formats for custom analytics.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key | PKrequiredunique |
organization_id |
uuid |
Foreign key to organizations — report belongs to this tenant | required |
created_by_user_id |
uuid |
User (org admin) who created the report definition | required |
name |
string |
Human-readable report name | required |
description |
text |
Optional description of report purpose | - |
report_type |
enum |
Category of data the report queries | required |
filters |
json |
JSON object defining filter criteria (date ranges, roles, areas, organizations) | - |
groupings |
json |
JSON array defining how results are grouped (by user, area, date, organization) | - |
columns |
json |
JSON array of column definitions to include in output | required |
output_format |
enum |
File format for export | required |
date_range_type |
enum |
Whether the report uses a fixed or rolling date window | required |
date_from |
datetime |
Start of fixed date range (null for rolling ranges) | - |
date_to |
datetime |
End of fixed date range (null for rolling ranges) | - |
is_scheduled |
boolean |
Whether this report runs on a schedule | required |
schedule_cron |
string |
Cron expression for scheduled execution (null if not scheduled) | - |
last_run_at |
datetime |
Timestamp of most recent execution | - |
last_run_status |
enum |
Result of most recent execution | - |
last_run_row_count |
integer |
Number of rows returned in the last execution | - |
last_output_file_url |
string |
Signed URL or file path of the most recent export file | - |
is_active |
boolean |
Soft-delete / disable flag | required |
created_at |
datetime |
Record creation timestamp | required |
updated_at |
datetime |
Last modification timestamp | required |
Database Indexes
idx_custom_reports_organization_id
Columns: organization_id
idx_custom_reports_created_by
Columns: created_by_user_id
idx_custom_reports_org_active
Columns: organization_id, is_active
idx_custom_reports_scheduled
Columns: is_scheduled, is_active
Validation Rules
name_not_empty
error
Validation failed
columns_not_empty
error
Validation failed
valid_output_format
error
Validation failed
valid_cron_expression
error
Validation failed
filters_valid_json
error
Validation failed
Business Rules
org_scoped_access
A custom report is always scoped to one organization. Users from org A cannot read or execute reports belonging to org B.
org_admin_only_create
Only users with the Organization Admin or Global Admin role may create, edit, or delete custom report definitions.
fixed_range_requires_dates
When date_range_type is 'fixed', both date_from and date_to must be provided and date_from must be before date_to.
schedule_requires_cron
If is_scheduled is true, schedule_cron must be a valid cron expression.
bufdir_excluded_from_custom_reports
Custom reports must not duplicate Bufdir compliance data — they are for supplementary analytics only. Bufdir export is handled exclusively by BufdirExportService.
test_org_excluded_from_output
Data belonging to Norse Test Organization must not appear in any custom report output, consistent with the rule that test data is excluded from all external reporting.