Contact
Data Entity
Description
A person receiving support from a peer mentor, managed within an organization's context. The term 'Contact' is overrideable per organization via the Organization Labels system (e.g. 'Familie' for Barnekreftforeningen, 'Bruker' for others).
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key | PKrequiredunique |
organization_id |
uuid |
Organization this contact belongs to (tenant isolation) | required |
assigned_peer_mentor_id |
uuid |
Primary peer mentor (user) currently assigned to this contact | - |
first_name |
string |
Contact's first name | required |
last_name |
string |
Contact's last name | required |
phone |
string |
Primary phone number (Norwegian format preferred) | - |
email |
string |
Email address | - |
address_line1 |
string |
Street address line 1 | - |
address_line2 |
string |
Street address line 2 (apartment, suite, etc.) | - |
postal_code |
string |
Postal/ZIP code | - |
city |
string |
City of residence | - |
date_of_birth |
datetime |
Date of birth (date only, used for age calculations and Bufdir reporting) | - |
gender |
enum |
Gender for Bufdir reporting purposes | - |
notes |
text |
General free-text notes about this contact visible to peer mentors and coordinators | - |
status |
enum |
Active/inactive state of the contact record | required |
display_label |
string |
Organization-specific label override for what this contact is called (e.g. 'Familie', 'Bruker'). Null means use platform default 'Contact'. | - |
external_id |
string |
Reference ID in an external member system (e.g. HLF Dynamics portal, NHF membership system) | - |
bufdir_category |
enum |
Category used for Bufdir reporting aggregation | - |
created_by_user_id |
uuid |
User who created this contact record | required |
created_at |
datetime |
Timestamp of record creation | required |
updated_at |
datetime |
Timestamp of last modification | required |
deleted_at |
datetime |
Soft-delete timestamp; null means active | - |
Database Indexes
idx_contacts_organization_id
Columns: organization_id
idx_contacts_assigned_peer_mentor_id
Columns: assigned_peer_mentor_id
idx_contacts_org_status
Columns: organization_id, status
idx_contacts_org_name
Columns: organization_id, last_name, first_name
idx_contacts_external_id
Columns: organization_id, external_id
idx_contacts_deleted_at
Columns: deleted_at
Validation Rules
required_name_fields
error
Validation failed
email_format_check
error
Validation failed
phone_format_check
error
Validation failed
date_of_birth_past
error
Validation failed
status_transition
error
Validation failed
organization_id_immutable
error
Validation failed
sensitive_field_readout_warning
warning
Validation failed
Business Rules
tenant_isolation
A contact always belongs to exactly one organization. No query may return contacts across organization boundaries without explicit support-access grant. Global admins see contacts only when the org has granted time-bounded support access.
soft_delete_only
Contacts must never be hard-deleted. Set deleted_at to mark as removed. This preserves referential integrity with activities and Bufdir report data.
peer_mentor_assignment_within_org
The assigned_peer_mentor_id must reference a user who is a member of the same organization as the contact.
activity_contact_linkage
Activities logged against a contact must reference a contact in the same organization as the peer mentor logging the activity.
label_override_respected
UI layers must display the organization's terminology override for 'Contact' (e.g. 'Familie' for Barnekreftforeningen) using the Organization Labels system. The stored entity ID and field names are always 'contacts'.
bufdir_data_completeness
Contacts used in Bufdir-reportable activities should have at minimum gender and date_of_birth populated. Missing fields trigger a warning to the coordinator.