Compare current Bufdir report with previous period
The bufdir-period-diff-view component renders a comparison between the current period's aggregated values and the equivalent values from the previous reporting period stored in the bufdir-preview-repository. Each Bufdir field row shows the current value, the previous value, and the percentage change. Significant deviations (e.g., more than 25% change in participant count) are highlighted to draw the coordinator's attention. This comparison is optional and can be toggled on or off within the preview screen to avoid overwhelming coordinators who don't need it.
User Story
Acceptance Criteria
- Given I am on the preview screen and a previous period's report exists, When I tap 'Compare with previous period', Then the bufdir-period-diff-view activates and each field row expands to show the previous period's value alongside the current one
- Given the diff view is active, When a field value has changed by more than 25% from the previous period, Then the change is highlighted with a visual indicator (amber for notable, red for large drops)
- Given the diff view is active, When a field value is new (did not exist in previous period), Then it is labeled 'New this period' rather than showing a percentage change
- Given no previous period report exists in the system, When I tap 'Compare with previous period', Then the button is disabled and a tooltip explains that no prior period data is available
- Given the diff view is active, When I toggle it off, Then the preview returns to single-period view without losing scroll position
- Given I am viewing the diff, When the previous period data is loading, Then a skeleton loader is shown in the previous-value column rather than blocking the entire screen
Business Value
Period-over-period comparison is a standard quality assurance step in grant reporting. Without it, coordinators must manually cross-reference previous submissions to detect anomalies. Automating this comparison reduces report review time by an estimated 30-40% and increases the likelihood of catching systematic data entry errors before submission, protecting the organization's reporting credibility with Bufdir.