core PK: id 6 required 1 unique

Description

Represents a local branch or chapter of an organization within the Meander platform. Local associations are the operational units to which peer mentors and coordinators are assigned. They define the scope boundary for activity reporting, expense approval, user management, and data access control. A single organization (e.g., NHF with 1,400 local associations) may have hundreds of local associations arranged in a hierarchy.

13
Attributes
5
Indexes
7
Validation Rules
25
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key. Stable, globally unique identifier for the local association.
PKrequiredunique
organization_id uuid Foreign key to the parent organization. Every local association belongs to exactly one organization.
required
name string Full display name of the local association (e.g., 'NHF Oslo og Akershus', 'HLF Bergen lokallag'). Used in all UI surfaces and reports.
required
short_name string Abbreviated or shortened name for compact UI contexts such as dropdowns, badges, and coordinator scope switchers.
-
external_id string Identifier used in external systems (e.g., Dynamics portal, Xledger) to enable sync and deduplication during integration. Scoped unique per organization.
-
region string Optional regional grouping label. Used by NHF (12 national associations, 9 regions) and similar multi-tier organizations to group local associations for aggregate reporting.
-
is_active boolean Soft-delete flag. Inactive local associations are hidden from coordinator scope selectors and user assignment flows but preserved for historical audit and reporting integrity.
required
address string Physical or postal address of the local association's office or meeting point. Used in Bufdir reports and coordinator communications.
-
contact_email string Primary contact email address for the local association, used for notifications and administrative correspondence.
-
contact_phone string Primary contact phone number for the local association. Stored in E.164 format.
-
metadata json Flexible key-value store for organization-specific attributes such as Bufdir registration numbers, regional codes, or integration-specific identifiers not covered by core fields.
-
created_at datetime UTC timestamp when this local association record was created.
required
updated_at datetime UTC timestamp of the most recent update to this record. Automatically maintained by the application layer.
required

Database Indexes

idx_local_association_org_id
btree

Columns: organization_id

idx_local_association_org_name
btree unique

Columns: organization_id, name

idx_local_association_org_external
btree unique

Columns: organization_id, external_id

idx_local_association_active
btree

Columns: organization_id, is_active

idx_local_association_region
btree

Columns: organization_id, region

Validation Rules

name_not_empty error

Validation failed

organization_id_exists error

Validation failed

contact_email_format error

Validation failed

contact_phone_e164 error

Validation failed

metadata_valid_json error

Validation failed

external_id_no_whitespace error

Validation failed

region_max_length error

Validation failed

Business Rules

single_org_ownership
on_create

Every local association must belong to exactly one organization. Reassigning a local association to a different organization is not permitted — it must be deactivated and recreated under the new organization.

unique_name_per_org
on_create

No two active local associations within the same organization may share the same name. This prevents duplicate scope selectors in coordinator UIs and ambiguous Bufdir report data.

soft_delete_only
on_delete

Local associations may not be hard-deleted once they have been used as a scope reference in activities, user assignments, or reports. They must be deactivated (is_active = false) to preserve historical data integrity and audit trails.

coordinator_scope_enforcement
always

Coordinator users may only read and write data (activities, contacts, expenses, users) scoped to the local association(s) they are assigned to. Cross-association access requires Org Admin role or explicit multi-association assignment.

deactivation_cascade_warning
on_update

When a local association is deactivated, all active users whose primary association is this one must be flagged for reassignment. The deactivation is blocked if any user has no alternative primary association.

duplicate_reporting_guard
always

When a user belongs to multiple local associations, the system must detect and flag activities that may represent double-counting across association boundaries in Bufdir reports. This is critical for NHF which has users spanning up to 5 local associations.

external_id_org_scoped_uniqueness
on_create

The external_id field must be unique within an organization to enable reliable sync with external systems (Dynamics, Xledger). Null values are permitted and exempt from this constraint.

hierarchy_closure_table_sync
on_create

When a local association is created or moved within the organizational hierarchy, the closure table must be updated atomically in the same transaction to maintain ancestor/descendant query correctness.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage

Components Managing This Entity

service Proxy Scope Validator ["mobile"] data Team Stats Store ["mobile"] service Team Stats Service ["mobile","backend"] service Team Stats Service ["backend","mobile"] ui Association Context Switcher Widget ["mobile"] data Report Store ["backend"] data Report Store ["backend"] data Analytics Store ["backend"] data Analytics Store ["backend"] service KPI Access Control Service ["backend"] service Activity Feed Service ["backend"] service Activity Feed Service ["backend"] service Role Scope Resolver ["backend"] data User Repository ["backend"] data User Repository ["backend"] ui User Detail Page ["frontend"] ui User Detail Page ["frontend"] service Review Queue Service ["backend"] service Activity Flagging Service ["backend"] service Activity Flagging Service ["backend"] data Report Store ["backend"] data Report Store ["backend"] service Report Generation Service ["backend"] service Report Generation Service ["backend"] service Organization Service ["backend"] service Organization Service ["backend"] data Hierarchy Store ["backend"] data Hierarchy Store ["backend"] infrastructure Closure Table Adapter ["backend"] service Hierarchy Service ["backend"] service Hierarchy Service ["backend"] data Association Membership Repository ["backend"] service Association Service ["backend"] service Association Service ["backend"] service Duplicate Reporting Detector ["backend"] ui Member Association Page ["frontend"] ui Member Association Page ["frontend"] service External Portal Service ["backend"] service External Portal Service ["backend"]