core PK: id 8 required 2 unique

Description

Structured post-visit or post-activity report capturing formalized observations and follow-up actions after a home visit or interaction, used by Blindeforbundet and Barnekreftforeningen to document health status, course interest, assistive device needs, and next steps for the coordinator.

19
Attributes
6
Indexes
6
Validation Rules
13
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key
PKrequiredunique
activity_id uuid Foreign key to the parent activity this report documents
requiredunique
submitted_by_user_id uuid Foreign key to the peer mentor who submitted the report
required
organization_id uuid Tenant scoping — which organization this report belongs to
required
health_status text Free-text observation of the contact's health status during the visit
-
course_interest text Notes on whether the contact expressed interest in courses or training
-
assistive_device_situation text Free-text notes on the contact's assistive device needs or current situation
-
next_steps text Action items or follow-up requests directed to the coordinator ('veien videre')
-
general_notes text Additional free-text observations not covered by structured fields
-
checklist_items json Structured checklist responses (checkbox fields from the report template, e.g. topics discussed)
-
report_template_id string Identifier for the report template version used to generate this report, enabling future template migrations
-
status enum Lifecycle state of the report
required
submitted_at datetime Timestamp when the report was submitted by the peer mentor
-
reviewed_at datetime Timestamp when a coordinator marked the report as reviewed
-
reviewed_by_user_id uuid Foreign key to the coordinator who reviewed this report
-
coordinator_response text Coordinator's reply or acknowledgement of the next steps requested in the report
-
is_sensitive boolean Whether this report contains sensitive health or personal data requiring access restriction
required
created_at datetime Record creation timestamp
required
updated_at datetime Last update timestamp
required

Database Indexes

idx_activity_reports_activity_id
btree unique

Columns: activity_id

idx_activity_reports_submitted_by_user_id
btree

Columns: submitted_by_user_id

idx_activity_reports_organization_id
btree

Columns: organization_id

idx_activity_reports_status
btree

Columns: status

idx_activity_reports_org_status
btree

Columns: organization_id, status

idx_activity_reports_submitted_at
btree

Columns: submitted_at

Validation Rules

activity_id_must_exist error

Validation failed

status_transition_valid error

Validation failed

text_field_max_length error

Validation failed

checklist_items_valid_json error

Validation failed

reviewed_fields_consistent error

Validation failed

submitted_at_not_before_activity_date warning

Validation failed

Business Rules

one_report_per_activity
on_create

Each activity may have at most one activity report. The activity_id column has a UNIQUE constraint enforcing this 1:1 relationship.

report_requires_submitted_activity
on_create

A report can only be created for an activity that has been saved (not in draft). Prevents orphan reports.

submitted_at_set_on_submit
on_update

submitted_at is set to current timestamp when status transitions from draft to submitted. Cannot be manually overridden.

Enforced by: Activity Service
reviewed_by_coordinator_only
on_update

Only users with the Coordinator or Org Admin role may set status to 'reviewed' and populate reviewed_by_user_id.

no_edit_after_reviewed
on_update

Peer mentors may not edit a report once it has been marked reviewed. Coordinators may add a coordinator_response at any time.

organization_scoped_access
always

A report is only accessible to users belonging to the same organization_id. Cross-tenant access is denied.

sensitive_flag_triggers_access_restriction
always

When is_sensitive is true, the report content is only served to the submitting peer mentor and coordinators of that organization. Sensitive field readout warning is displayed in the UI.

bufdir_report_includes_submitted_reports
always

Only reports with status 'submitted' or 'reviewed' are included in Bufdir export aggregations. Draft reports are excluded.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage