core PK: id 6 required 1 unique

Description

Represents a local chapter or branch within a parent organization (e.g. one of NHF's 1,400 lokallag). Local associations are the operational unit to which peer mentors and coordinators belong, enabling activity reporting, role scoping, and hierarchy traversal within the multi-organization structure.

13
Attributes
4
Indexes
5
Validation Rules
15
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key
PKrequiredunique
organization_id uuid FK to the parent organization this local association belongs to
required
name string Display name of the local association (e.g. 'NHF Oslo Lokallag')
required
short_code string Optional short identifier used in reports and exports (e.g. 'NHF-OSL')
-
region string Geographic or administrative region this local association belongs to (e.g. 'Oslo', 'Vestland')
-
contact_email string Primary contact email for this local association
-
contact_phone string Primary contact phone number
-
address text Physical address of the local association office, if applicable
-
is_active boolean Whether this local association is currently active. Inactive associations are hidden from user-facing flows but retained for historical reporting.
required
external_id string ID from the parent organization's external membership system or portal (e.g. HLF Dynamics portal, NHF member registry). Used for sync and deduplication.
-
metadata json Freeform org-specific configuration (e.g. Bufdir reporting codes, custom labels). Kept as JSON to avoid schema churn for org-specific needs.
-
created_at datetime Record creation timestamp
required
updated_at datetime Last modification timestamp
required

Database Indexes

idx_local_associations_organization_id
btree

Columns: organization_id

idx_local_associations_organization_name
btree unique

Columns: organization_id, name

idx_local_associations_external_id
btree

Columns: organization_id, external_id

idx_local_associations_is_active
btree

Columns: is_active

Validation Rules

name_not_empty error

Validation failed

contact_email_format error

Validation failed

organization_id_exists error

Validation failed

external_id_unique_per_org error

Validation failed

metadata_valid_json error

Validation failed

Business Rules

local_association_scoped_to_organization
on_create

A local association must always belong to exactly one parent organization. Cross-organization local associations are not permitted.

Enforced by: OrgHierarchyService
unique_name_within_organization
on_create

Local association names must be unique within the same parent organization to prevent confusion in dropdown selectors and reports.

Enforced by: OrgHierarchyService
deactivation_does_not_delete
on_delete

Local associations with historical activity data, member associations, or users cannot be hard-deleted. Setting is_active=false hides them from operational flows while preserving reporting data.

Enforced by: OrgHierarchyService
bufdir_reporting_scope
always

Activities submitted by peer mentors belonging to a local association are scoped to that association in Bufdir exports. Local association must be correctly assigned to prevent reporting errors.

multi_membership_deduplication
always

NHF peer mentors may belong to up to 5 local associations. Activity reporting must tag activities with the correct local association to prevent double-counting in statistics and Bufdir exports.

external_portal_sync_on_update
on_update

When HLF's external portal integration is active, changes to a local association's name or external_id must be propagated via ExternalPortalSyncService to avoid divergence with the Dynamics portal.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage