Activity Type
Data Entity
Description
Configuration lookup table defining the taxonomy of activity categories that peer mentors and coordinators can log. Supports both global platform-wide types and organization-specific overrides. Drives Bufdir reporting category mapping and controls UI behavior (required fields, defaults) per type.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key, generated server-side | PKrequiredunique |
organization_id |
uuid |
Foreign key to organizations. NULL means this is a global platform type visible to all tenants. Non-null means org-specific type visible only to that tenant. | - |
name |
string |
Human-readable display label shown in activity form dropdowns and wizard steps. Max 120 characters. | required |
slug |
string |
URL-safe machine identifier. Unique within scope (global types share a namespace; org types unique within their org). Used for API references and Bufdir mapping keys. | required |
description |
text |
Optional clarifying text shown as a tooltip or subtitle in the activity type selector to help users choose the correct type. | - |
category |
enum |
Broad grouping used to cluster types in the selector UI and drive Bufdir aggregate reporting (e.g. in-person visits vs. remote contact). | required |
bufdir_category_code |
string |
Bufdir's official activity category code used when generating government funding reports. Required when is_bufdir_reportable is true. | - |
is_bufdir_reportable |
boolean |
Whether activities of this type count toward Bufdir funding reports. Global types representing core peer-mentor activities are reportable; administrative types typically are not. | required |
requires_contact |
boolean |
Enforces that a contact record must be linked when logging an activity of this type. True for all direct peer-mentor interaction types. | required |
requires_duration |
boolean |
Enforces that a duration value must be recorded. False for purely administrative types where time tracking is not meaningful. | required |
default_duration_minutes |
integer |
Pre-filled duration value in the activity form to reduce input friction. HLF use case: 30 min default covers 60-70% of registrations unchanged. | - |
display_order |
integer |
Sort position within the type selector dropdown. Lower values appear first. Allows orgs to promote their most-used types to the top. | required |
is_active |
boolean |
Soft-delete flag. Inactive types are hidden from the selector UI but retained for historical activity records to preserve reporting integrity. | required |
created_at |
datetime |
Record creation timestamp (UTC). | required |
updated_at |
datetime |
Last modification timestamp (UTC). Auto-updated on any field change. | required |
Database Indexes
idx_activity_types_org_slug
Columns: organization_id, slug
idx_activity_types_organization_id
Columns: organization_id
idx_activity_types_is_active
Columns: is_active
idx_activity_types_bufdir_reportable
Columns: is_bufdir_reportable, is_active
idx_activity_types_category
Columns: category, is_active
Validation Rules
name_not_empty
error
Validation failed
slug_format
error
Validation failed
slug_unique_within_scope
error
Validation failed
default_duration_range
error
Validation failed
bufdir_code_format
error
Validation failed
display_order_positive
error
Validation failed
Business Rules
global_types_immutable_by_orgs
Activity types with organization_id = NULL are platform-defined and cannot be modified or deactivated by org admins. Only global admins may alter them.
no_hard_delete_with_activities
An activity type that has one or more associated activity records must not be hard-deleted. Deactivation via is_active = false is the only permitted removal path.
bufdir_reportable_requires_code
When is_bufdir_reportable is true, bufdir_category_code must be provided and must match a known Bufdir taxonomy code. Bufdir reports cannot include activities whose type lacks this mapping.
at_least_one_active_type_per_org
Deactivating an activity type is rejected if it would leave the organization (or the global pool, for orgs with no org-specific types) with zero active types. Activity logging would become impossible.
org_type_scoped_to_tenant
Org-specific activity types (organization_id != NULL) are only visible to users belonging to that organization. The API enforces tenant scoping on all list and read endpoints.
offline_sync_required
Activity types must be synced to the local Drift database on app start and kept current so the activity wizard functions without connectivity.