# Duplicate Detection - UI Guide
## Conflicts Page Visual Layout
### Exact Duplicate Example
```
┌────────────────────────────────────────────────────────────────┐
│ 🔵 Tradebook Conflict │
│ Account: Zerodha • Type: Exact Duplicate (Reimport) │
│ Detected: Jan 13, 2026, 10:30 AM │
├────────────────────────────────────────────────────────────────┤
│ │
│ ⚠️ Exact Duplicate Entry │
│ This trade already exists in the database with identical │
│ data. You may have reimported the same file. │
│ │
├──────────────────────────┬─────────────────────────────────────┤
│ Existing Data │ New Data (CSV) │
├──────────────────────────┼─────────────────────────────────────┤
│ Symbol: RELIANCE │ Symbol: RELIANCE │
│ Quantity: 10 │ Quantity: 10 │
│ Price: ₹2450.50 │ Price: ₹2450.50 │
│ Trade ID: 123456789 │ Trade ID: 123456789 │
│ Date: 1/10/2026 │ Date: 1/10/2026 │
└──────────────────────────┴─────────────────────────────────────┘
│ │
│ 💡 Recommendation: Since this is an exact duplicate, you can │
│ safely click "Keep Existing" or "Ignore" to skip entry. │
│ │
├────────────────────────────────────────────────────────────────┤
│ [Keep Existing] [Use New (CSV)] [Ignore] [Delete] │
└────────────────────────────────────────────────────────────────┘
```
### Different Data Conflict Example
```
┌────────────────────────────────────────────────────────────────┐
│ ⚠️ Tradebook Conflict │
│ Account: Zerodha • Type: Duplicate Trade ID (Different │
│ Data) │
│ Detected: Jan 13, 2026, 10:30 AM │
├────────────────────────────────────────────────────────────────┤
│ │
├──────────────────────────┬─────────────────────────────────────┤
│ Existing Data │ New Data (CSV) │
├──────────────────────────┼─────────────────────────────────────┤
│ Symbol: RELIANCE │ Symbol: RELIANCE │
│ Quantity: 10 │ Quantity: 15 ⚠️ DIFFERENT │
│ Price: ₹2450.50 │ Price: ₹2455.75 ⚠️ DIFFERENT │
│ Trade ID: 123456789 │ Trade ID: 123456789 │
│ Date: 1/10/2026 │ Date: 1/10/2026 │
└──────────────────────────┴─────────────────────────────────────┘
│ │
├────────────────────────────────────────────────────────────────┤
│ [Keep Existing] [Use New (CSV)] [Ignore] [Delete] │
└────────────────────────────────────────────────────────────────┘
```
### Ledger Exact Duplicate Example
```
┌────────────────────────────────────────────────────────────────┐
│ 🔵 Ledger Conflict │
│ Account: HDFC Bank • Type: Exact Duplicate (Reimport) │
│ Detected: Jan 13, 2026, 10:30 AM │
├────────────────────────────────────────────────────────────────┤
│ │
│ ⚠️ Exact Duplicate Entry │
│ This ledger entry already exists in the database with │
│ identical data. You may have reimported the same file. │
│ │
├──────────────────────────┬─────────────────────────────────────┤
│ Existing Data │ New Data (CSV) │
├──────────────────────────┼─────────────────────────────────────┤
│ Date: 1/10/2026 │ Date: 1/10/2026 │
│ Particular: Salary Credit│ Particular: Salary Credit │
│ Debit: ₹0 │ Debit: ₹0 │
│ Credit: ₹50000 │ Credit: ₹50000 │
│ Balance: ₹125000 │ Balance: ₹125000 │
└──────────────────────────┴─────────────────────────────────────┘
│ │
│ 💡 Recommendation: Since this is an exact duplicate, you can │
│ safely click "Keep Existing" or "Ignore" to skip entry. │
│ │
├────────────────────────────────────────────────────────────────┤
│ [Keep Existing] [Use New (CSV)] [Ignore] [Delete] │
└────────────────────────────────────────────────────────────────┘
```
## Color Coding
### Icon Colors
- 🔵 **Blue Icon** = Exact duplicate (no data mismatch)
- ⚠️ **Yellow Icon** = Data conflict (different values detected)
### Background Colors
- **Yellow Background** = Existing data in database
- **Blue Background** = New data from CSV import
- **Blue Alert Banner** = Exact duplicate notice
- **Gray Box** = Helpful recommendation
## User Actions
### Keep Existing
- Discards the CSV data
- Keeps database record unchanged
- Marks conflict as "resolved_keep_existing"
### Use New (CSV)
- Updates database with CSV data
- Replaces existing record
- Marks conflict as "resolved_use_new"
### Ignore
- Skips this entry without changes
- Marks conflict as "ignored"
- Useful for exact duplicates
### Delete
- Removes the conflict record entirely
- Does not affect database data
- Cleans up conflict history
## Import Results Message
After import with duplicates:
```
✅ Import Successful
Imported 45 out of 50 trades
⚠️ 5 conflict(s) detected. View and resolve conflicts →
Details:
• 45 records imported successfully
• 5 duplicates detected (3 exact duplicates, 2 data mismatches)
• 0 errors
```
## Best Practices
### For Exact Duplicates
1. Review the conflict to confirm it's truly identical
2. Click "Keep Existing" (safest option)
3. Or click "Ignore" if you want to skip without action
4. Never click "Use New" for exact duplicates (no benefit)
### For Data Mismatches
1. Carefully compare both versions
2. Check which date/time is more recent
3. Verify with source (broker statement)
4. Choose the correct version:
- "Keep Existing" if database is correct
- "Use New" if CSV has corrected data
### Bulk Resolution
When you have many exact duplicates:
1. Sort conflicts by type (future feature)
2. Review one to confirm pattern
3. Resolve all exact duplicates with "Keep Existing"
4. Then handle data mismatches individually
## Technical Details
### Conflict Types in Database
- `exact_duplicate` - All fields match
- `duplicate_trade_id` - Same trade ID, different data
- `duplicate_entry_different_amount` - Same date/particular, different amounts
### Resolution Status
- `pending` - Awaiting user action
- `resolved_keep_existing` - User kept database version
- `resolved_use_new` - User chose CSV version
- `ignored` - User skipped this conflict
- `resolved_manual` - Custom resolution (future)