Relative
Data Entity
Description
A family member or next-of-kin contact registered in relation to a primary case or contact record. Used by Barnekreftforeningen to track parents, siblings, and primary caregivers of children with cancer, and by other organizations for caregiver/next-of-kin tracking linked to peer mentor cases.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key | PKrequiredunique |
organization_id |
uuid |
Tenant isolation — the organization this relative record belongs to | required |
first_name |
string |
Relative's first name | required |
last_name |
string |
Relative's last name | required |
phone |
string |
Primary phone number for reaching this relative | - |
email |
string |
Email address for this relative | - |
date_of_birth |
datetime |
Date of birth, used for age-sensitive context (e.g. minor siblings) | - |
relation_type |
enum |
Semantic relationship to the primary contact/case (e.g. parent, sibling, spouse, caregiver) | required |
role_tag |
string |
Free-form role label assigned via Relative Role Tagging, e.g. 'primary caregiver', 'legal guardian'. Supplements relation_type with org-specific semantics. | - |
notes |
text |
Internal notes about this relative relevant to the case context | - |
is_primary_contact |
boolean |
Flags this relative as the primary point of contact for the linked case | required |
consent_given |
boolean |
Whether this relative has given consent for their data to be stored and used in the platform | required |
consent_date |
datetime |
Timestamp when consent was recorded | - |
created_by_user_id |
uuid |
User who created this relative record | required |
created_at |
datetime |
Record creation timestamp | required |
updated_at |
datetime |
Last update timestamp | required |
deleted_at |
datetime |
Soft-delete timestamp; null means record is active | - |
Database Indexes
idx_relatives_organization_id
Columns: organization_id
idx_relatives_created_by_user_id
Columns: created_by_user_id
idx_relatives_relation_type
Columns: organization_id, relation_type
idx_relatives_deleted_at
Columns: deleted_at
idx_relatives_name_search
Columns: organization_id, last_name, first_name
Validation Rules
name_not_empty
error
Validation failed
email_format
error
Validation failed
phone_format
error
Validation failed
relation_type_valid_enum
error
Validation failed
date_of_birth_past
error
Validation failed
consent_date_set_with_consent
error
Validation failed
role_tag_max_length
error
Validation failed
organization_id_immutable
error
Validation failed
Business Rules
tenant_isolation
Relative records are scoped to an organization. A peer mentor or coordinator may only create, view, or edit relatives belonging to their own organization.
consent_required_before_storage
A relative's personal data (name, phone, email) must not be persisted without consent_given = true. The registration screen must capture consent before submitting.
single_primary_contact_per_case
Within the set of relatives linked to a given case (via relative_case_links), at most one relative may have is_primary_contact = true. Setting a new primary contact must clear the flag on any existing primary.
soft_delete_only
Relatives are never hard-deleted. Setting deleted_at marks the record inactive and removes it from normal queries, but the record is retained for audit purposes.
role_tag_requires_case_link
A role tag may only be assigned to a relative that is already linked to at least one case via relative_case_links. Role tagging without a case link is meaningless.
offline_sync_eligibility
Relative records created offline are queued in the mutation outbox and synced when connectivity is restored. Conflict resolution favors server state for shared fields (name, phone) and merges role tags.