Contact Caregiver
Data Entity
Description
Records caregiver and next-of-kin relationships for contacts (people receiving peer mentor support). Stores contact details and relationship metadata for emergency or coordination purposes, scoped to the contact's organization for multi-tenancy isolation.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key, generated on creation | PKrequiredunique |
contact_id |
uuid |
Foreign key referencing the contact this caregiver is associated with | required |
first_name |
string |
Caregiver's first name | required |
last_name |
string |
Caregiver's last name | required |
relationship |
enum |
The caregiver's relationship to the contact | required |
phone_number |
string |
Caregiver's phone number (E.164 format preferred) | - |
email |
string |
Caregiver's email address | - |
address |
text |
Caregiver's physical address (free text to accommodate varying formats) | - |
is_primary_caregiver |
boolean |
Whether this is the primary/emergency contact for the contact person. At most one caregiver per contact may be primary. | required |
notes |
text |
Free-text notes about availability, preferences, or context for this caregiver | - |
created_by |
uuid |
User ID of the peer mentor or coordinator who created this record | required |
created_at |
datetime |
Timestamp when the record was created (UTC) | required |
updated_at |
datetime |
Timestamp when the record was last modified (UTC) | required |
Database Indexes
idx_contact_caregivers_contact_id
Columns: contact_id
idx_contact_caregivers_primary_per_contact
Columns: contact_id, is_primary_caregiver
idx_contact_caregivers_created_by
Columns: created_by
Validation Rules
valid_email_format
error
Validation failed
phone_number_format
error
Validation failed
name_not_blank
error
Validation failed
relationship_enum_valid
error
Validation failed
contact_exists
error
Validation failed
Business Rules
single_primary_caregiver_per_contact
A contact may have at most one primary caregiver (is_primary_caregiver = true). When a new caregiver is set as primary, any existing primary caregiver for that contact must be demoted to non-primary atomically.
at_least_one_contact_method
A caregiver record must have at least one of: phone_number or email populated. A caregiver with no way to be contacted is not useful for emergency coordination.
org_scoped_access
A user may only read or write caregiver records whose parent contact belongs to the same organization as the user. Cross-organization access is forbidden.
cascade_delete_with_contact
When a contact record is deleted, all associated caregiver records are deleted. Orphaned caregiver records must not exist.