core PK: id 9 required 1 unique

Description

An individual follow-up action item extracted from the 'way forward' section of a post-session report. Each item represents a specific coordinator task or service referral triggered by observations during the peer mentor visit. Items are tracked for resolution status and form the basis of coordinator workload management.

12
Attributes
5
Indexes
6
Validation Rules
10
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key. Auto-generated UUID for each way-forward action item.
PKrequiredunique
report_id uuid Foreign key referencing the post_session_report that generated this action item. Immutable after creation.
required
organization_id uuid Foreign key to the organization owning this record. Used for RLS-based multi-tenant data isolation.
required
coordinator_id uuid UUID of the coordinator responsible for acting on this item. Resolved from the parent report's assigned coordinator at creation time.
required
description text Plain-text description of the follow-up action or service referral. May be entered via keyboard or speech-to-text. Immutable once the parent report is submitted.
required
order_index integer Zero-based position of this item within the parent report's way-forward list. Used for deterministic ordering in UI display.
required
is_resolved boolean Whether this action item has been completed by the coordinator. Defaults to false on creation. When set to true, resolved_at must also be populated.
required
resolved_at datetime UTC timestamp of when the coordinator marked this item as resolved. Must be null when is_resolved is false, and must be non-null when is_resolved is true.
-
resolved_by uuid UUID of the user (coordinator or admin) who marked the item resolved. Used for audit trail purposes.
-
resolution_notes text Optional free-text notes recorded by the coordinator when resolving the item. Describes the action taken or outcome of the follow-up.
-
created_at datetime UTC timestamp of record creation. Auto-set on insert and immutable thereafter.
required
updated_at datetime UTC timestamp of the most recent update to any mutable field. Auto-updated by database trigger.
required

Database Indexes

idx_way_forward_item_report_id
btree

Columns: report_id

idx_way_forward_item_coordinator_unresolved
btree

Columns: coordinator_id, is_resolved

idx_way_forward_item_org_created
btree

Columns: organization_id, created_at

idx_way_forward_item_report_order
btree

Columns: report_id, order_index

idx_way_forward_item_coordinator_created
btree

Columns: coordinator_id, created_at

Validation Rules

description_non_empty error

Validation failed

description_max_length error

Validation failed

report_id_references_submitted_report error

Validation failed

resolved_at_after_created_at error

Validation failed

coordinator_id_is_valid_user error

Validation failed

resolution_notes_max_length error

Validation failed

Business Rules

items_created_on_report_submission
on_create

Way-forward items are created atomically when the parent post-session report is submitted. They cannot be created for draft or unsaved reports. The batch insert must succeed entirely or roll back with the report save.

description_immutable_after_submission
on_update

Once the parent report is submitted and the item is created, the description field is immutable. Only resolution-related fields (is_resolved, resolved_at, resolved_by, resolution_notes) may be updated.

resolved_at_required_on_resolution
on_update

When is_resolved is set to true, resolved_at must be set to the current UTC timestamp and resolved_by must reference the acting user. These fields must be cleared if resolution is reversed.

coordinator_id_matches_report_coordinator
on_create

The coordinator_id on the item must match the coordinator assigned to the parent post_session_report at creation time. This ensures workload attribution is consistent and coordinators only see their own outstanding items.

org_scoped_access
always

All reads and writes must be scoped to the authenticated user's organization_id via Supabase RLS. A coordinator may only read and resolve items belonging to their organization.

order_index_sequential_within_report
on_create

Items for a given report must have sequential order_index values starting at 0. Gaps are not permitted. This is enforced at batch creation time by the task service.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage

Entity Relationships

post_session_report
incoming one_to_many

A submitted post-session report generates one or more follow-up action items representing coordinator tasks derived from the visit

optional cascade delete