Contact Caregiver
Data Entity
Description
Represents a caregiver or next-of-kin relationship associated with a contact in the peer mentor program. Each contact can have one or more registered caregivers — typically family members, spouses, or emergency contacts who are involved in the contact's support network. This entity enables peer mentors and coordinators to reach relevant parties when needed, particularly for elderly contacts, contacts with disabilities, or those in vulnerable situations.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key — unique identifier for the caregiver record | PKrequiredunique |
contact_id |
uuid |
Foreign key referencing the contact this caregiver is associated with | required |
name |
string |
Full name of the caregiver or next-of-kin | required |
relationship_type |
enum |
Nature of the relationship between the caregiver and the contact | required |
phone |
string |
Primary phone number for reaching the caregiver — Norwegian format preferred | - |
email |
string |
Email address of the caregiver | - |
address |
text |
Physical address of the caregiver — classified as a sensitive field; triggers screen reader warning when VoiceOver or TalkBack is active | - |
is_primary |
boolean |
Whether this caregiver is designated as the primary contact for the associated contact record. Only one caregiver per contact may be primary. | required |
is_emergency_contact |
boolean |
Whether this caregiver should be contacted in emergency situations | required |
notes |
text |
Free-text notes about the caregiver relationship or relevant context for peer mentors | - |
organization_id |
uuid |
Organization context for multi-tenant isolation — inherited from the associated contact's organization | required |
created_by |
uuid |
User ID of the peer mentor or coordinator who created this caregiver record | required |
created_at |
datetime |
Timestamp when the caregiver record was first created | required |
updated_at |
datetime |
Timestamp of the most recent update to this caregiver record | required |
Database Indexes
idx_contact_caregiver_contact_id
Columns: contact_id
idx_contact_caregiver_org_id
Columns: organization_id
idx_contact_caregiver_primary
Columns: contact_id, is_primary
idx_contact_caregiver_contact_org
Columns: contact_id, organization_id
Validation Rules
contact_id_exists
error
Validation failed
name_not_empty
error
Validation failed
relationship_type_valid
error
Validation failed
phone_format
warning
Validation failed
email_format
error
Validation failed
name_max_length
error
Validation failed
notes_max_length
error
Validation failed
organization_id_matches_contact
error
Validation failed
Business Rules
single_primary_caregiver
At most one caregiver record per contact may have is_primary = true. When a new caregiver is set as primary, any existing primary caregiver for the same contact must be demoted (is_primary set to false) within the same transaction.
single_primary_caregiver_on_update
When updating is_primary to true, enforce uniqueness of primary caregiver per contact by clearing the flag on the previously primary record.
at_least_one_contact_method
A caregiver record should have at least one contact method — either phone or email — to be useful. This is enforced as a warning rather than a hard error to allow incomplete records during data entry.
role_based_access
Only peer mentors assigned to the contact and coordinators within the contact's local association may create, read, update, or delete caregiver records. Org Admins may read all caregiver records for their organization.
tenant_isolation
All queries against contact_caregivers must include an organization_id filter matching the authenticated user's organization to prevent cross-tenant data access.
cascade_delete_with_contact
When a contact record is deleted, all associated caregiver records are automatically deleted via ON DELETE CASCADE to prevent orphaned records.
sensitive_address_warning
When the address field is rendered on screen with an active screen reader (VoiceOver or TalkBack), the Sensitive Field Widget must intercept the readout and display a warning before proceeding. This is required per the WCAG 2.2 AA accessibility mandate and NHF's explicit requirement.