DuplicateDetectionService
Component Detail
Service Layer
medium complexity
backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Backend service that compares incoming and existing activity records across key attributes to compute a similarity score and flag potential duplicates. It exposes results to the admin portal so coordinators can act before records are approved.
duplicate-detection-service
Sources & reasoning
Line 107 explicitly names Duplikatvarsling as an NHF requirement. Line 109 explains the organizational complexity that makes duplicate logging likely. Neither feature appears in the Phase 1 MVP admin scope at lines 327-330, so Phase 2 ordinal applies, mapping to v1.0. Blueprint confirms v1.0 target.
-
docs/source/likeperson.md · line 107- **Duplikatvarsling:** Fange opp når samme aktivitet registreres av flere koordinatorer.
-
docs/source/likeperson.md · line 109- **Bredest organisasjonsstruktur:** 12 landsforeninger, 9 regioner, 1 400 lokallag - aktivitetsfordeling mellom ledd må støttes.
Responsibilities
- Compare activity records on contact, date, time, type, and peer mentor to produce a weighted similarity score
- Persist flagged duplicate pairs with their similarity scores and matched attributes
- Expose an API for the admin portal to query pending duplicate warnings by activity or coordinator
- Trigger re-evaluation when an activity record is updated or a previous warning is resolved
- Filter out previously dismissed pairs to avoid re-surfacing resolved warnings
Interfaces
detectDuplicates(activityId: string): DuplicateMatch[]
getSimilarityScore(a: ActivityRecord, b: ActivityRecord): number
getPendingWarnings(coordinatorId: string): DuplicateWarning[]
dismissWarning(activityId: string, duplicateId: string): void