Infrastructure low complexity shared
0
Dependencies
0
Dependents
2
Entities
0
Integrations

Description

Static configuration that maps the application's internal activity types to Bufdir's official reporting category identifiers. Acts as the authoritative translation layer ensuring that aggregated data uses Bufdir-compliant category names and codes regardless of how activities are named within each organization.

Feature: Bufdir Data Aggregation

activity-category-mapping-config

Summaries

The Activity Category Mapping Configuration ensures that every Bufdir grant report submitted by NHF, Blindeforbundet, HLF, and Barnekreftforeningen uses the exact category names and codes required by the government funding body, regardless of how each organization has internally named its activities over the years. Mismatched category codes in official grant reports can lead to rejected submissions, funding delays, or audit findings — all of which carry direct financial consequences. By centralizing this translation logic in a single validated configuration, the platform guarantees reporting compliance without requiring each organization to manually reconcile their internal terminology against Bufdir's official taxonomy before every submission cycle.

This is a low-complexity component but carries high regulatory importance — errors here produce incorrect Bufdir submissions rather than application crashes, making them harder to detect in standard QA. Development effort is minimal (static configuration with lookup functions), but it requires close collaboration with representatives from each of the four organizations to confirm that all internal activity type IDs are correctly mapped. Completeness validation at build time (validateMappingCompleteness) should be part of the CI pipeline so missing mappings are caught before deployment. Plan for at least one review cycle with organizational stakeholders before this configuration is considered production-ready.

Per-organization override support adds a small amount of complexity but is essential for NHF and others with legacy naming conventions.

Activity Category Mapping Config is a shared, stateless configuration module with no runtime dependencies. The primary data structure is a two-level map: orgId → internalActivityTypeId → BufdirCategoryCode. getBufdirCategory(internalActivityType, orgId) performs a two-pass lookup — first checking for an org-specific override, then falling back to the global default mapping. getAllMappings(orgId) returns the merged map for a given org.

validateMappingCompleteness(activityTypes) accepts the full list of activity type IDs from the database and returns an array of unmapped types, enabling CI-time completeness checks. getInternalTypesForBufdirCategory(categoryCode) provides reverse lookup used during import validation. The configuration should be stored as a const map in Dart and never loaded from a remote source, ensuring zero-latency lookups and eliminating a runtime failure mode. Add a unit test that loads all four organizations' activity types and asserts zero unmapped entries.

Responsibilities

  • Define mapping from internal activity type IDs to Bufdir category codes
  • Support per-organization overrides where activity naming differs
  • Provide reverse lookup for validation purposes
  • Ensure configuration is validated at build time

Interfaces

getBufdirCategory(internalActivityType, orgId)
getAllMappings(orgId)
validateMappingCompleteness(activityTypes)
getInternalTypesForBufdirCategory(categoryCode)

Related Data Entities (2)

Data entities managed by this component

API Contract

View full contract →
REST /api/v1/activity-category-mappings 6 endpoints
GET /api/v1/activity-category-mappings
GET /api/v1/activity-category-mappings/:id
POST /api/v1/activity-category-mappings
PUT /api/v1/activity-category-mappings/:id
DELETE /api/v1/activity-category-mappings/:id
GET /api/v1/activity-category-mappings/validate-completeness