Peer Mentor Profile
Data Entity
Description
Extended profile record for users with the Peer Mentor role, capturing operational status, geographic location, certification state, assignment thresholds, and opt-in preferences specific to peer mentor workflows. One-to-one with users; the authoritative source for mentor availability and eligibility.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key, matches users.id for the owning peer mentor | PKrequiredunique |
user_id |
uuid |
Foreign key to users table; enforces one-to-one relationship | requiredunique |
organization_id |
uuid |
Owning organization for tenant isolation; denormalized from user_organization_memberships for fast eligibility queries | required |
status |
enum |
Current operational status of the peer mentor | required |
paused_at |
datetime |
Timestamp when the mentor entered paused status; null if currently active | - |
pause_reason |
text |
Optional free-text reason provided by mentor or coordinator when pausing | - |
resume_at |
datetime |
Scheduled date for automatic resume; null if no auto-resume planned | - |
geographic_location_id |
uuid |
FK to geographic_locations; used for map display and assignment matching by geography | - |
location_last_updated_at |
datetime |
When geographic_location_id was last set or verified; used to detect stale location data | - |
assignment_count_current_period |
integer |
Running count of completed assignments in the current billing/reporting period; drives threshold-based honorar logic (3rd = office honorar, 15th = higher rate) | required |
assignment_period_start |
datetime |
Start of the current assignment counting period; counter resets when a new period begins | - |
certification_expiry_date |
datetime |
Date the peer mentor's active certification expires; CertificationExpiryMonitor watches this to trigger auto-pause | - |
certification_status |
enum |
Current certification validity state | required |
digital_certificate_url |
string |
URL or storage reference to the mentor's digital peer mentor certificate asset | - |
referral_code |
string |
Unique invite code used by the referral program for this mentor; corresponds to referral_links records | unique |
consent_given_at |
datetime |
Timestamp of the most recent progressive digital consent acceptance for encrypted assignment handling | - |
consent_version |
string |
Version identifier of the consent document accepted; used to detect when re-consent is needed | - |
accepts_encrypted_assignments |
boolean |
Whether the mentor has consented to receive encrypted assignment dispatches; gates EncryptedAssignmentService delivery | required |
bio |
text |
Short mentor biography shown on profile screen; optional free text | - |
profile_photo_url |
string |
URL to mentor's profile photo in cloud storage | - |
notification_opt_ins |
json |
JSON object of scenario-level notification preferences specific to peer mentor role (e.g. new_assignment, assignment_reminder_10d); complements notification_preferences table | - |
is_visible_on_map |
boolean |
Whether this mentor appears on the geographic map view for coordinators; mentor can opt out | required |
years_of_experience |
integer |
Self-reported years of peer mentor experience; shown on profile and used in assignment matching scoring | - |
specializations |
json |
Array of specialization tags (e.g. hearing_loss, visual_impairment, stroke) used for assignment matching eligibility filters | - |
created_at |
datetime |
Record creation timestamp | required |
updated_at |
datetime |
Last modification timestamp; updated on every write | required |
Database Indexes
idx_peer_mentor_profiles_user_id
Columns: user_id
idx_peer_mentor_profiles_organization_id
Columns: organization_id
idx_peer_mentor_profiles_status
Columns: status
idx_peer_mentor_profiles_org_status
Columns: organization_id, status
idx_peer_mentor_profiles_certification_expiry
Columns: certification_expiry_date
idx_peer_mentor_profiles_geographic_location
Columns: geographic_location_id
idx_peer_mentor_profiles_referral_code
Columns: referral_code
idx_peer_mentor_profiles_map_visible
Columns: organization_id, is_visible_on_map, status
Validation Rules
status_transition_guard
error
Validation failed
pause_reason_length
error
Validation failed
certification_expiry_future_date
error
Validation failed
referral_code_format
error
Validation failed
assignment_count_non_negative
error
Validation failed
consent_version_required_with_timestamp
error
Validation failed
years_of_experience_range
error
Validation failed
specializations_known_values
warning
Validation failed
tenant_isolation
error
Validation failed
Business Rules
one_profile_per_peer_mentor
Exactly one peer_mentor_profiles record must exist for each user with the peer_mentor role. Created automatically when an admin assigns the peer_mentor role; deleted (or soft-deactivated) when role is revoked.
auto_pause_on_certification_expiry
When certification_expiry_date is reached and certification_status is not 'not_required', status must transition to 'auto_paused'. Coordinator is notified via notification scenario engine.
assignment_threshold_honorar
When assignment_count_current_period reaches 3, the 'office honorar' rate is unlocked. When it reaches 15, the higher honorar rate is unlocked. assignment-threshold-service must record a threshold log entry on each milestone crossing.
encrypted_assignment_consent_gate
A mentor may only receive encrypted assignment dispatches when accepts_encrypted_assignments is true. EncryptedAssignmentService must check this flag before dispatching.
paused_mentor_hidden_from_assignment_matching
Mentors with status 'paused' or 'auto_paused' must be excluded from geography matching results and map display regardless of is_visible_on_map flag.
coordinator_notified_on_pause
When status transitions to 'paused' or 'auto_paused', a notification must be dispatched to the owning coordinator via the notification scenario engine.
assignment_count_period_reset
assignment_count_current_period resets to 0 and assignment_period_start advances when a new reporting period begins. Period boundary is defined by the organization's Bufdir reporting cycle.
map_visibility_requires_location
is_visible_on_map may only be true if geographic_location_id is set. Setting is_visible_on_map=true without a location must be rejected.