Deduplication Queue Service
Component Detail
Description
Service layer for coordinator-facing deduplication queue. Queries activities where duplicate_reviewed is false and at least one matching record (same peer mentor, type, date) exists. Provides queue management operations including coordinator-level resolution and bulk dismissal.
deduplication-queue-service
Summaries
The Deduplication Queue Service gives program coordinators a structured, manageable view of all unresolved duplicate activity flags within their chapter. Without this capability, coordinators would have no systematic way to identify and resolve data conflicts introduced by peer mentors logging similar activities on the same date — leading to inflated activity counts, distorted mentor performance records, and unreliable program reporting. This service powers a coordinator-specific workflow that reduces the risk of funding misreporting and administrative errors. The badge-style unresolved count also acts as a lightweight alert mechanism, ensuring duplicate records do not accumulate silently over time and maintaining the data integrity expected by program stakeholders and funders.
The Deduplication Queue Service is a medium-complexity service component targeted at coordinator-facing interfaces across web and mobile. It depends on the Duplicate Queue Repository, which must be delivered and tested first. Key deliverables include queue listing with pagination, real-time unresolved count for badge display, single-record resolution, and bulk dismissal. Bulk dismissal in particular requires careful UX design and backend coordination to avoid accidental mass-resolution.
Testing should cover coordinator scoping (ensuring cross-chapter data is not exposed), pagination correctness, and count accuracy after resolution actions. The badge count feature requires careful state synchronisation to avoid stale counts after coordinator actions, which may introduce additional front-end complexity.
The Deduplication Queue Service is the service layer abstraction over the Duplicate Queue Repository for coordinator-facing workflows. It exposes five interfaces: getUnresolvedQueue() for paginated listing scoped to a coordinator, getUnresolvedCount() for badge display, resolveByCoordinator() for forced resolution with a resolution payload, dismissFlag() for single-record dismissal, and bulkDismiss() for batch operations. All queries are chapter-scoped via coordinatorId, with the repository handling the actual Supabase filter logic. The service is responsible for business rule enforcement (e.g., validating resolution payloads) before delegating writes to the repository.
It must coordinate count invalidation after any mutation to keep badge state accurate. No direct Supabase calls should be made here — all data access flows through duplicate-queue-repository. Implement with reactive streams or futures depending on the platform's async model.
Responsibilities
- Fetch unresolved duplicate-flagged activities scoped to coordinator's chapter
- Calculate and expose unresolved duplicate count for badge display
- Support coordinator-level forced resolution or dismissal of flagged records
- Update duplicate_reviewed flag on behalf of coordinator
Interfaces
getUnresolvedQueue(coordinatorId)
getUnresolvedCount(coordinatorId)
resolveByCoordinator(activityId, resolution)
dismissFlag(activityId)
bulkDismiss(activityIds)