Activity Type Metadata Resolver
Component Detail
Description
Service that reads the JSON metadata column of an activity type and exposes strongly typed accessors for downstream features. Prevents other features from directly parsing raw JSON and ensures that new metadata fields can be introduced without cascading changes.
activity-type-metadata-resolver
Summaries
The Activity Type Metadata Resolver protects the business from costly, widespread system changes whenever activity configuration evolves. By centralizing how the system interprets activity rules — such as which activities qualify for travel expense reimbursement, which require a formal report form, and which trigger payment workflows — this component ensures that policy changes can be applied in a single place rather than cascading across the entire platform. This directly reduces maintenance costs, lowers the risk of inconsistent business logic causing incorrect reimbursements or missed compliance requirements, and shortens the time-to-market for future configuration changes driven by regulatory or organizational policy updates.
This is a low-complexity shared service with no external dependencies, making it one of the lowest-risk components to deliver. Because it is shared across multiple features, it should be prioritized early in the development schedule — teams building expense workflows, report form logic, and Bufdir export pipelines all depend on its typed accessors being stable and available. The main scheduling risk is interface contract drift: if consuming features are built before this component's API is finalized, integration rework is likely. A brief design-review session before implementation begins will eliminate that risk.
No special infrastructure or deployment considerations apply; testing should focus on edge cases in the raw JSON input, including malformed or missing metadata fields.
The Activity Type Metadata Resolver is a pure parsing and accessor service that operates in a shared execution context, meaning it runs on both backend and mobile. Its single responsibility is to accept a raw JSON string from the activity_types.metadata column and return a strongly typed ActivityTypeMetadata struct, exposing boolean flags (isTravelExpenseEligible, requiresReportForm, triggersReimbursementWorkflow) and a string identifier (getBufdirCategory) for downstream consumers. It carries zero dependencies, making it trivially testable with unit tests covering valid, partial, and malformed JSON inputs. The key architectural benefit is that all JSON parsing is colocated here — no other component should ever call JSON.parse on activity type metadata directly.
When new metadata fields are added, only this resolver and its callers need updating, not every feature that touches activity types.
Responsibilities
- Parse and validate the JSON metadata column into a typed ActivityTypeMetadata struct
- Expose boolean accessors for isTravelExpenseEligible, requiresReportForm, triggersReimbursementWorkflow
- Expose the Bufdir reporting category identifier for export pipelines
Interfaces
resolveMetadata(rawJson)
isTravelExpenseEligible(activityType)
requiresReportForm(activityType)
triggersReimbursementWorkflow(activityType)
getBufdirCategory(activityType)
Related Data Entities (2)
Data entities managed by this component