Bufdir Aggregation Repository
Component Detail
Description
Read-only data access layer that queries the aggregated activity records used by the Bufdir reporting pipeline. Shared with the Bufdir Data Aggregation feature; this component exposes count and range queries used by the period selection flow.
bufdir-aggregation-repository
Summaries
The Bufdir Aggregation Repository is a shared data foundation that powers multiple reporting workflows within the system. By providing a single, reliable read layer over the aggregated activity records, it ensures that figures shown during period selection, report preview, and final export are always consistent with each other — eliminating the risk of discrepancies between what coordinators see and what gets submitted to Bufdir. Its reusability across features means development investment here multiplies across the entire reporting pipeline, making it a high-value component relative to its implementation complexity. Accurate activity counts directly support grant compliance and give coordinators confidence in the data they submit.
As a shared, read-only repository component used across multiple features — including Bufdir Data Aggregation and the period selection flow — this component must be delivered before any downstream consumer can be integration-tested. It carries no external service dependencies, which simplifies its own delivery, but its shared status means interface stability is critical: any change to method signatures or return types will require coordinated updates across all consumers. Plan for early delivery and thorough range-query performance testing against realistic data volumes, as slow count queries would directly degrade the period selection user experience. Document the query contract clearly to prevent consumers from bypassing it with ad-hoc queries.
Bufdir Aggregation Repository exposes three read-only interfaces: countActivitiesInRange(orgId, DateTimeRange) for scalar record counts used in period selection previews, getActivitiesInRange(orgId, DateTimeRange) returning full aggregated records for the export pipeline, and getLastSubmittedPeriod(orgId) used by the validator overlap check. All queries must be org-scoped. Because this is a shared component across features, keep the interface stable and avoid adding feature-specific parameters — instead compose feature-specific logic in the consuming services. Ensure range queries use indexed columns on the activities table; countActivitiesInRange in particular is called on every date range change in the UI and must return quickly.
Consider adding result pagination or streaming to getActivitiesInRange for large orgs.
Responsibilities
- Count activity records within a date range for an organization
- Return aggregated activity data for Bufdir export
- Support efficient range queries against the activities table
Interfaces
countActivitiesInRange(String orgId, DateTimeRange range)
getActivitiesInRange(String orgId, DateTimeRange range)
getLastSubmittedPeriod(String orgId)
Relationships
Related Data Entities (2)
Data entities managed by this component