configuration PK: id 7 required 1 unique

Description

Geographic and administrative region grouping local associations within an organization. In the NHF context, an organization has up to 9 regions, each containing multiple local associations (lokallag). Regions exist per organization and serve as an intermediate hierarchy layer between the national organization and individual local associations.

10
Attributes
3
Indexes
4
Validation Rules
16
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key. Unique identifier for the region.
PKrequiredunique
organization_id uuid Foreign key to the organization this region belongs to. Regions are scoped per organization โ€” NHF regions are not shared with HLF.
required
name string Human-readable name for the region (e.g., 'Region ร˜st', 'Region Nord'). May be overridden by organization-level terminology.
required
code string Short alphanumeric identifier code for the region used in reporting and Bufdir exports (e.g., 'REG-EAST', 'R01'). Unique within an organization.
-
country_code string ISO 3166-1 alpha-2 country code for the region (default 'NO' for Norway). Supports Sami language regions spanning multiple countries.
required
description text Optional free-text description of the region's geographic or administrative scope.
-
is_active boolean Soft-delete flag. Inactive regions remain in the database for historical reporting but cannot receive new local association assignments.
required
sort_order integer Display ordering for region lists within an organization. Lower values appear first.
-
created_at datetime Timestamp when the region was created.
required
updated_at datetime Timestamp of the last update to this region record.
required

Database Indexes

idx_regions_organization_id
btree

Columns: organization_id

idx_regions_org_code
btree unique

Columns: organization_id, code

idx_regions_active
btree

Columns: organization_id, is_active

Validation Rules

name_not_empty error

Validation failed

code_alphanumeric error

Validation failed

organization_must_exist error

Validation failed

country_code_format error

Validation failed

Business Rules

region_scoped_to_organization
always

A region belongs to exactly one organization. Regions cannot be shared across organizations. NHF's 9 regions are entirely separate from HLF's regions.

code_unique_within_organization
on_create

If a region code is provided, it must be unique within the organization. Two regions in the same org cannot share the same code. Codes are used in Bufdir export filenames and report references.

deactivation_requires_no_active_associations
on_update

A region cannot be deactivated (is_active = false) if it still has active local associations assigned to it. Coordinators must reassign or deactivate those associations first.

bufdir_reports_use_region_scope
always

Bufdir report generation aggregates activity data by region. Each reporting period snapshot must reference the region structure as it existed at reporting time, not the current structure.

soft_delete_only
on_delete

Regions are never physically deleted. Historical activities and Bufdir reports reference region data and must remain queryable. Setting is_active = false is the only supported removal path.

Storage Configuration

Storage Type
lookup_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage