Contacts
Data Entity
Description
Represents individuals receiving peer mentor support within the Meander platform. Each contact record stores personal details, organizational affiliation, assigned peer mentor, and serves as the central reference point linking activities, notes, assignments, caregivers, and expense records. Contacts are scoped to organizations and filtered by local association membership for role-based access control.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Unique identifier for the contact record | PKrequiredunique |
organization_id |
uuid |
Foreign key to the organization this contact belongs to, enforcing multi-tenant data isolation | required |
local_association_id |
uuid |
Foreign key to the local association within the organization hierarchy that manages this contact | - |
assigned_peer_mentor_id |
uuid |
Foreign key to the user (peer mentor) currently assigned to support this contact | - |
first_name |
string |
Contact's given name | required |
last_name |
string |
Contact's family name | required |
phone |
string |
Primary phone number in E.164 or Norwegian format | - |
email |
string |
Email address for the contact | - |
address_street |
string |
Street address line | - |
address_postal_code |
string |
Norwegian postal code (postnummer) | - |
address_city |
string |
City or municipality name | - |
date_of_birth |
datetime |
Contact's date of birth, used for demographic reporting and age-appropriate service matching | - |
gender |
enum |
Contact's gender for demographic reporting to Bufdir | - |
status |
enum |
Current lifecycle status of the contact within the peer mentor program | required |
notes_text |
text |
Free-text general notes about the contact visible to assigned peer mentor and coordinator | - |
tags |
json |
Array of string tags for categorization and filtering (e.g. support type, needs) | - |
preferred_language |
string |
Preferred communication language (ISO 639-1 code, e.g. 'nb' for Norwegian Bokmål, 'se' for Northern Sami) | - |
preferred_contact_method |
enum |
How the contact prefers to be reached by their peer mentor | - |
sensitivity_level |
enum |
Data sensitivity classification for screen reader warning system and access control | required |
source |
enum |
How this contact was added to the system | - |
created_by |
uuid |
User ID of the person who created this contact record | required |
created_at |
datetime |
Timestamp when the contact record was created | required |
updated_at |
datetime |
Timestamp of the last modification to the contact record | required |
deleted_at |
datetime |
Soft-delete timestamp; non-null indicates the record is logically deleted for GDPR compliance | - |
Database Indexes
idx_contacts_organization
Columns: organization_id
idx_contacts_local_association
Columns: organization_id, local_association_id
idx_contacts_assigned_mentor
Columns: assigned_peer_mentor_id
idx_contacts_status
Columns: organization_id, status
idx_contacts_name_search
Columns: organization_id, last_name, first_name
idx_contacts_created_at
Columns: organization_id, created_at
idx_contacts_soft_delete
Columns: deleted_at
idx_contacts_fulltext
Columns: first_name, last_name, email, phone
Validation Rules
required_name_fields
error
Validation failed
valid_phone_format
error
Validation failed
valid_email_format
error
Validation failed
valid_postal_code
warning
Validation failed
date_of_birth_in_past
error
Validation failed
organization_id_exists
error
Validation failed
local_association_within_organization
error
Validation failed
status_transition_validity
error
Validation failed
tags_json_array_format
error
Validation failed
at_least_one_contact_method
warning
Validation failed
Business Rules
organization_scoped_access
All contact queries must be scoped to the requesting user's organization_id extracted from JWT claims. No cross-organization contact access is permitted except for Global Admins performing system operations.
local_association_visibility
Peer mentors can only view contacts assigned to them. Coordinators can view all contacts within their local association scope. Org Admins can view all contacts within the organization.
assigned_mentor_must_be_valid
The assigned_peer_mentor_id must reference a user with the Peer Mentor role within the same organization. Coordinators may reassign contacts to different peer mentors within their local association.
soft_delete_for_gdpr
Contacts are never hard-deleted. Deletion sets deleted_at timestamp and redacts PII fields after a configurable retention period. This preserves referential integrity for activities, notes, and Bufdir reporting history.
prevent_duplicate_contacts
Within the same organization, warn when creating a contact with matching first_name + last_name + phone or first_name + last_name + date_of_birth to prevent duplicate records across local associations (NHF requirement for handling members in up to 5 local associations).
cascade_status_to_assignments
When a contact's status changes to archived or inactive, all open assignments linked to this contact should be flagged for coordinator review. Active activities should not be retroactively affected.
audit_all_modifications
Every create, update, and delete operation on contact records must produce an audit log entry capturing the actor, timestamp, changed fields, and organization context.
sensitive_field_readout_protection
Fields marked in the organization's sensitive field configuration (address, date_of_birth, phone) must trigger a screen reader warning before being read aloud, per NHF accessibility requirement.
offline_sync_conflict_resolution
When contacts are edited offline on multiple devices, server timestamp wins. The most recent server-confirmed update takes precedence, and local changes are queued for re-application if they do not conflict on the same fields.