Contact
Data Entity
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.
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
Columns: organization_id
idx_contact_local_association_id
Columns: local_association_id
idx_contact_assigned_peer_mentor_id
Columns: assigned_peer_mentor_id
idx_contact_name_search
Columns: organization_id, last_name, first_name
idx_contact_status
Columns: organization_id, status
idx_contact_soft_delete
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
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
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
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
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
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
local_association_id must belong to the contact's organization. Prevents cross-org local association assignment.
duplicate_contact_detection
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
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.