hvp-shared 6.96.0 → 6.98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,15 +2,15 @@
2
2
  * QVET Client Duplicate Detection Contracts
3
3
  *
4
4
  * Types for the duplicate client detection and audit system.
5
- * Detects potential duplicate client records using scoring-based matching
6
- * on phone, email, and name similarity.
5
+ * Returns groups of clients (2 or more) detected as potential duplicates
6
+ * using scoring-based matching on phone, email, name, and pet data.
7
7
  *
8
- * @example GET /api/qvet/clients/duplicates?branch=MAT&confidence=HIGH
8
+ * @example GET /api/qvet/clients/duplicates?branch=URBAN&confidence=HIGH
9
9
  */
10
10
  export type DuplicateClientConfidence = 'HIGH' | 'MEDIUM' | 'LOW';
11
11
  /**
12
- * Information about a single client within a duplicate pair.
13
- * Includes enrichment data (pets, visits, sales) to help decide which to keep.
12
+ * A single client within a duplicate group.
13
+ * Includes enrichment data to help decide which record to keep.
14
14
  */
15
15
  export interface DuplicateClientInfo {
16
16
  qvetClientId: number;
@@ -24,33 +24,26 @@ export interface DuplicateClientInfo {
24
24
  petCount: number;
25
25
  visitCount: number;
26
26
  salesTotalAmount: number;
27
+ petNames: string[];
27
28
  }
28
29
  /**
29
- * A pair of clients detected as potential duplicates.
30
+ * A group of 2+ clients detected as potential duplicates.
30
31
  *
31
- * Scoring:
32
- * - Same phone (last 7 digits): 60 pts
33
- * - Same email: 60 pts
34
- * - Exact name match: +30 pts
35
- * - Name contained: +25 pts
36
- * - Name similarity >= 50%: +1 to +25 pts
37
- * - Same branch: +5 pts
38
- * - Name-only match (no phone/email): 40 pts
39
- *
40
- * Confidence: HIGH >= 80, MEDIUM 60-79, LOW < 60
32
+ * The score reflects the strongest link between any two clients in the group.
33
+ * Reasons are deduplicated across all links.
41
34
  */
42
- export interface DuplicateClientPair {
35
+ export interface DuplicateClientGroup {
36
+ groupId: number;
43
37
  score: number;
44
38
  confidence: DuplicateClientConfidence;
45
39
  reasons: string[];
46
- clientA: DuplicateClientInfo;
47
- clientB: DuplicateClientInfo;
40
+ clients: DuplicateClientInfo[];
48
41
  }
49
42
  /**
50
43
  * Summary statistics for duplicate detection results.
51
44
  */
52
45
  export interface DuplicateClientsSummary {
53
- totalPairs: number;
46
+ totalGroups: number;
54
47
  highConfidence: number;
55
48
  mediumConfidence: number;
56
49
  lowConfidence: number;
@@ -63,7 +56,7 @@ export interface DuplicateClientsSummary {
63
56
  */
64
57
  export interface DuplicateClientsResponse {
65
58
  summary: DuplicateClientsSummary;
66
- pairs: DuplicateClientPair[];
59
+ groups: DuplicateClientGroup[];
67
60
  }
68
61
  /**
69
62
  * Query parameters for filtering duplicate detection results.
@@ -72,4 +65,5 @@ export interface DuplicateClientsQueryParams {
72
65
  branch?: string;
73
66
  minScore?: number;
74
67
  confidence?: DuplicateClientConfidence;
68
+ includeInactive?: boolean;
75
69
  }
@@ -3,9 +3,9 @@
3
3
  * QVET Client Duplicate Detection Contracts
4
4
  *
5
5
  * Types for the duplicate client detection and audit system.
6
- * Detects potential duplicate client records using scoring-based matching
7
- * on phone, email, and name similarity.
6
+ * Returns groups of clients (2 or more) detected as potential duplicates
7
+ * using scoring-based matching on phone, email, name, and pet data.
8
8
  *
9
- * @example GET /api/qvet/clients/duplicates?branch=MAT&confidence=HIGH
9
+ * @example GET /api/qvet/clients/duplicates?branch=URBAN&confidence=HIGH
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "6.96.0",
3
+ "version": "6.98.0",
4
4
  "description": "Shared types and utilities for HVP backend and frontend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",