Activity Type
Data Entity
Description
Configuration entity defining the categorized types of peer mentor activities that can be logged, enabling structured reporting, Bufdir compliance, and organization-specific activity classification.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key | PKrequiredunique |
organization_id |
uuid |
Organization this activity type belongs to. NULL means platform-wide default available to all orgs. | - |
code |
string |
Machine-readable identifier used in Bufdir exports and API responses (e.g. 'home_visit', 'phone_call', 'group_meeting') | required |
name |
string |
Display name shown in UI (may be overridden via org terminology system) | required |
description |
text |
Optional longer description explaining when to use this activity type | - |
bufdir_category |
enum |
Maps to Bufdir's official activity categories for compliance reporting | - |
requires_contact |
boolean |
If true, an activity of this type must be linked to a contact record | required |
requires_duration |
boolean |
If true, duration is mandatory when logging this activity type | required |
allows_expense |
boolean |
Whether expense registration is permitted for this activity type | required |
allows_document_attachments |
boolean |
Whether documents can be attached to activities of this type | required |
is_active |
boolean |
Soft-delete flag. Inactive types are hidden from selection but preserved for historical records. | required |
sort_order |
integer |
Display ordering within pickers and dropdowns | required |
is_platform_default |
boolean |
True for built-in types provided by the platform (organization_id IS NULL). False for org-custom types. | required |
created_at |
datetime |
Record creation timestamp | required |
updated_at |
datetime |
Last modification timestamp | required |
Database Indexes
idx_activity_types_org_id
Columns: organization_id
idx_activity_types_code_org
Columns: code, organization_id
idx_activity_types_active
Columns: is_active
idx_activity_types_bufdir_category
Columns: bufdir_category
Validation Rules
code_format
error
Validation failed
code_unique_per_scope
error
Validation failed
name_non_empty
error
Validation failed
sort_order_non_negative
error
Validation failed
Business Rules
platform_defaults_immutable
Activity types with is_platform_default=true and organization_id=NULL cannot be modified or deleted by any organization. Only Global Admins may alter platform defaults.
inactive_type_no_new_activities
Activities cannot be created with an inactive (is_active=false) activity_type_id. Existing historical activities retain their type for reporting integrity.
expense_type_consistency
If an activity is logged with an activity type where allows_expense=false, any attached expense records must be rejected at save time.
bufdir_category_required_for_export
Activity types used in activities that appear in Bufdir reports must have a non-null bufdir_category. Warn org admins when setting up a custom type without it.
org_scoped_visibility
When fetching available activity types for a user, return platform defaults (organization_id IS NULL) UNION org-specific types for the user's organization only.