core PK: id 9 required 1 unique

Description

An individual receiving peer mentor support within an organization. Contacts are the operational core of the peer mentor program — every activity, note, and assignment links to a contact. Contacts hold personal, demographic, and health-related information, are organization-scoped for multi-tenancy, and drive Bufdir reporting.

22
Attributes
6
Indexes
10
Validation Rules
31
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key. Generated server-side on creation.
PKrequiredunique
organization_id uuid Foreign key to organizations. Multi-tenant isolation boundary. All queries must scope to this value.
required
local_association_id uuid Foreign key to local_associations. Determines which local association the contact belongs to for coordinator-scoped access and duplicate-reporting detection.
-
first_name string Contact's given name. Organization terminology may relabel this field.
required
last_name string Contact's family name.
required
phone string Primary phone number. Sensitive field — triggers screen-reader readout warning when VoiceOver/TalkBack is active.
-
email string Email address. Optional but must be valid format if provided.
-
address string Street address. Classified as sensitive — triggers screen-reader readout warning. Required by Blindeforbundet for home-visit coordination.
-
postal_code string Norwegian postal code (postnummer). Used for geographic routing and Bufdir demographic reporting.
-
city string City or municipality derived from or alongside postal code.
-
date_of_birth datetime Date of birth. Classified as sensitive — triggers screen-reader readout warning. Used for Bufdir age-group reporting.
-
gender enum Gender identity for Bufdir demographic reporting.
-
status enum Lifecycle status of the contact within the program.
required
assigned_peer_mentor_id uuid Foreign key to users. The primary peer mentor responsible for this contact. Used for role-based read scoping on the mobile app.
-
health_summary text Free-text health and situation notes for context. Classified as highly sensitive — screen reader must display warning before readout. Modelled after Blindeforbundet's formalisert rapportstruktur (health status, aids situation, next steps).
-
special_needs text Notes on accessibility requirements, communication preferences, or care considerations relevant to the peer mentor.
-
course_interest text Contact's expressed interest in courses or training opportunities. Feeds into Blindeforbundet's home-visit report structure.
-
next_steps text Coordinator-facing follow-up instructions arising from peer mentor interactions. Used as a task queue for the coordinator.
-
created_by_user_id uuid Foreign key to users. The user who created this contact record. Used for audit purposes.
required
created_at datetime UTC timestamp of record creation.
required
updated_at datetime UTC timestamp of last update. Maintained automatically on every write.
required
is_deleted boolean Soft-delete flag. Contacts are never hard-deleted to preserve activity history and Bufdir audit trails.
required

Database Indexes

idx_contact_organization_id
btree

Columns: organization_id

idx_contact_local_association_id
btree

Columns: local_association_id

idx_contact_assigned_peer_mentor_id
btree

Columns: assigned_peer_mentor_id

idx_contact_name_search
btree

Columns: organization_id, last_name, first_name

idx_contact_status
btree

Columns: organization_id, status

idx_contact_soft_delete
btree

Columns: organization_id, is_deleted

Validation Rules

first_name_required error

Validation failed

last_name_required error

Validation failed

email_format error

Validation failed

phone_format error

Validation failed

at_least_one_contact_method warning

Validation failed

date_of_birth_not_future error

Validation failed

date_of_birth_reasonable_range error

Validation failed

status_valid_enum error

Validation failed

organization_id_immutable error

Validation failed

postal_code_format warning

Validation failed

Business Rules

tenant_isolation
always

All read and write operations on contacts must be scoped to the authenticated user's organization_id. Cross-organization contact access is never permitted, even for coordinators and org admins.

role_based_read_scoping
always

Peer mentors may only view contacts assigned to them via assigned_peer_mentor_id. Coordinators may view all contacts within their local_association_id. Org admins may view all contacts in their organization.

soft_delete_only
on_delete

Contacts must never be hard-deleted. Setting is_deleted=true preserves activity history and satisfies Bufdir audit trail requirements. All queries must filter is_deleted=false by default.

sensitive_field_readout_warning
always

Fields address, date_of_birth, phone, and health_summary are classified as sensitive. When a screen reader (VoiceOver or TalkBack) is active, the app must display a readout warning before speaking these fields.

assigned_mentor_org_scope
on_create

assigned_peer_mentor_id must reference a user who belongs to the same organization as the contact. Cross-org peer mentor assignment is forbidden.

local_association_org_scope
on_create

local_association_id must belong to the contact's organization. Prevents cross-org local association assignment.

duplicate_contact_detection
on_create

Warn coordinators when a contact with the same (first_name, last_name, organization_id) already exists as active, to prevent double-registration across local associations (NHF requirement).

offline_sync_eligibility
always

Contact records for the authenticated user's assigned scope are pre-seeded into local SQLite at login and kept in sync via background sync. Deletions (soft) must propagate to the local store.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage

Components Managing This Entity

service Permission Validation Middleware ["backend"] service Role Guard Service ["mobile"] service Role Guard Service ["mobile","backend"] service Activity Service ["mobile"] service Activity Service ["mobile"] service Default Value Resolver ["mobile"] ui Quick Log Widget ["mobile"] ui Quick Log Widget ["mobile"] service Activity Service ["mobile"] data Bulk Import Store ["mobile"] data Bulk Import Store ["backend"] service Bulk Processing Service ["mobile"] service Bulk Processing Service ["backend"] ui Bulk Upload Screen ["mobile"] ui Bulk Upload Screen ["mobile"] data Contact Store ["mobile"] data Contact Store ["mobile"] infrastructure Contact Pagination Adapter ["mobile"] service Contact Service ["mobile"] service Contact Service ["mobile"] ui Contact Search Widget ["mobile"] ui Contact Search Widget ["mobile"] ui Contacts List Screen ["mobile"] ui Contacts List Screen ["mobile"] data Contact Store ["mobile"] service Contact Detail Service ["mobile"] service Contact Update Service ["mobile"] service Contact Update Service ["mobile"] ui Contact Detail Screen ["mobile"] ui Contact Detail Screen ["mobile"] ui Contact Edit Screen ["mobile"] ui Contact Edit Screen ["mobile"] service Caregiver Service ["mobile"] service Caregiver Service ["mobile"] ui Caregiver Screen ["mobile"] ui Caregiver Screen ["mobile"] ui Contact Search Widget ["mobile"] service Stats Aggregation Service ["backend"] service Stats Aggregation Service ["backend","mobile"] service Report Data Aggregator ["backend"] ui Assignment Compose Screen ["mobile"] ui Workshop Participant Roster Widget ["mobile"] service Summary Aggregation Service ["backend"] data Sensitive Field Config Store ["mobile"] data Sensitive Field Config Store ["mobile"] service Readout Warning Service ["mobile"] service Readout Warning Service ["mobile"] ui Sensitive Field Widget ["mobile"] ui Sensitive Field Widget ["mobile"] data Local SQLite Database ["mobile"] data Local SQLite Database ["mobile"] service Local Data Seeder ["mobile"] service Repository Data Source Router ["mobile"] service Background Sync Service ["mobile"] service Background Sync Service ["mobile"] data Activity Feed Query Builder ["backend"] service Activity Feed Service ["backend"] service Activity Feed Service ["backend"] service Duplicate Detection Service ["backend"]