core PK: id 17 required 1 unique

Description

Encrypted sensitive data dispatches from coordinators to peer mentors, containing personal information such as names, addresses, and medical summaries (epikriser) about contacts requiring support. Assignments track the full lifecycle from dispatch through delivery confirmation, read receipt, and contact establishment, with automatic reminders and threshold-based honorarium tracking.

27
Attributes
8
Indexes
10
Validation Rules
15
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Unique identifier for the assignment
PKrequiredunique
organization_id uuid Organization that owns this assignment for multi-tenant isolation
required
contact_id uuid The contact (person receiving support) this assignment relates to
required
assigned_to_user_id uuid The peer mentor user who receives and acts on this assignment
required
dispatched_by_user_id uuid The coordinator who created and dispatched this assignment
required
status enum Current lifecycle status of the assignment
required
encrypted_payload text End-to-end encrypted content containing sensitive contact information (name, address, medical summary). Encrypted client-side with recipient's public key before transmission.
required
encryption_key_id string Identifier of the recipient's public key used for encryption, enabling key rotation tracking
required
encryption_algorithm string Encryption algorithm used (e.g., ECDH-ES+A256KW) for forward compatibility
required
title string Non-sensitive title or reference label for the assignment visible in list views
required
priority enum Assignment urgency level affecting reminder schedules
required
dispatched_at datetime Timestamp when the coordinator dispatched the assignment
required
delivered_at datetime Timestamp when the assignment was first fetched by the peer mentor's device
-
read_at datetime Timestamp when the peer mentor decrypted and viewed the assignment content
-
contact_established_at datetime Timestamp when the peer mentor confirmed they have established contact with the person
-
completed_at datetime Timestamp when the assignment was marked as fully completed
-
cancelled_at datetime Timestamp when the assignment was cancelled by coordinator
-
cancellation_reason text Reason provided by coordinator when cancelling an assignment
-
reminder_due_at datetime Next automatic reminder date, initially set to 10 days after dispatch per Blindeforbundet requirement
-
reminder_count integer Number of automatic reminders sent for this assignment
required
last_reminder_sent_at datetime Timestamp of the most recent reminder notification sent
-
notes text Non-encrypted coordinator notes about the assignment (e.g., special instructions)
-
reporting_period string Reporting period identifier for threshold tracking (e.g., 2026-H1)
required
counts_toward_threshold boolean Whether this assignment counts toward the peer mentor's honorarium threshold
required
local_association_id uuid Local association context for scoping assignment visibility to coordinators
-
created_at datetime Record creation timestamp
required
updated_at datetime Record last modification timestamp
required

Database Indexes

idx_assignments_assigned_to
btree

Columns: assigned_to_user_id, status

idx_assignments_dispatched_by
btree

Columns: dispatched_by_user_id

idx_assignments_contact
btree

Columns: contact_id

idx_assignments_org_status
btree

Columns: organization_id, status

idx_assignments_reminder_due
btree

Columns: reminder_due_at, status

idx_assignments_threshold
btree

Columns: assigned_to_user_id, reporting_period, counts_toward_threshold

idx_assignments_dispatched_at
btree

Columns: organization_id, dispatched_at

idx_assignments_local_association
btree

Columns: local_association_id, status

Validation Rules

encrypted_payload_not_empty error

Validation failed

valid_encryption_key_id error

Validation failed

assigned_user_must_be_peer_mentor error

Validation failed

dispatcher_must_be_coordinator error

Validation failed

contact_belongs_to_organization error

Validation failed

valid_reporting_period_format error

Validation failed

title_required_and_non_sensitive error

Validation failed

status_transition_validity error

Validation failed

timestamps_set_on_status_change error

Validation failed

cancellation_reason_required error

Validation failed

Business Rules

coordinator_only_dispatch
on_create

Only users with coordinator or org admin role can create and dispatch assignments. Peer mentors can only receive assignments.

end_to_end_encryption_required
on_create

Assignment payload containing sensitive personal data (name, address, medical summary) must be encrypted client-side with the recipient's public key before transmission. The server never sees plaintext content.

auto_reminder_after_10_days
always

If contact has not been established within 10 days of dispatch, an automatic reminder notification is sent to the peer mentor. Subsequent reminders follow at configurable intervals.

delivery_receipt_on_fetch
on_update

When a peer mentor's device first fetches an assignment, the delivered_at timestamp is automatically recorded and a delivery receipt is sent to the dispatching coordinator.

read_receipt_on_decrypt
on_update

When the peer mentor decrypts and views assignment content, read_at is recorded and the coordinator is notified with a read receipt.

threshold_honorarium_tiers
on_update

Completed assignments that count toward threshold increment the peer mentor's assignment counter for the reporting period. Honorarium tiers trigger at organization-configured thresholds (e.g., 3rd assignment for base honorarium, 15th for higher rate per Blindeforbundet).

status_transitions_are_forward_only
on_update

Assignment status can only move forward through the lifecycle: dispatched → delivered → read → contact_established → completed. Cancellation is allowed from any active status. Completed or cancelled assignments cannot be reopened.

overdue_detection
always

Assignments where reminder_due_at has passed without contact_established_at being set are automatically marked as overdue. Coordinators see overdue assignments prominently in their status overview.

tenant_isolation
always

Assignments are scoped to a single organization. Users can only access assignments belonging to their own organization. Coordinator access is further scoped to their local association.

no_hard_delete
on_delete

Assignments are never physically deleted due to audit and compliance requirements. Cancellation is the mechanism for removing assignments from active workflows.

Enforced by: Assignment Store
completed_counts_toward_threshold_only
on_update

Only assignments with status 'completed' and counts_toward_threshold=true are counted for honorarium threshold calculations.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage