Sub topic 9
Grouping Alerts into Cases and Suppressing Duplicates
Prerequisites
This chapter assumes you have read the earlier chapters on scenarios, parameters, and alert generation. You should know that a scenario evaluates transactions over a lookback window and writes an alert record when its threshold is met. You should also be able to read short Python functions that use dictionaries, lists, and datetime.
Why raw alerts are not the unit of work
A monitoring system runs many scenarios on a schedule, and each run can produce alerts for the same people. Three things go wrong if every alert goes straight to an analyst.
- Several scenarios fire for one customer. A customer who splits cash deposits may also trigger a rapid-movement scenario when the money is wired out. Two analysts could investigate the same behavior without knowing about each other.
- The same scenario fires again on the next run. Lookback windows overlap. A customer who triggered a seven-day structuring rule on Wednesday will probably still meet it on Thursday, because six of the seven days are the same.
- Context is split. An analyst who sees one alert at a time cannot easily judge whether a customer's overall pattern is unusual.
Consolidation fixes these problems after alert generation and before triage. It does two jobs:
- Duplicate suppression stops a new alert from being created or routed when it adds nothing to an alert that is already open.
- Case grouping collects related alerts into one case, so one analyst reviews them together.
Choosing a grouping key
A grouping key is the field, or set of fields, that decides which alerts belong together. The choice changes how much work analysts do and how much risk is hidden.
| Grouping key | What it groups | Strength | Weakness |
|---|---|---|---|
| Customer | All alerts for one customer | Simple, gives a full view of the customer | Joint accounts and related parties are split |
| Account | Alerts on one account | Matches how transactions are stored | One customer with many accounts gets many cases |
| Customer and scenario | Repeats of the same scenario | Good for suppressing duplicates | Does not combine different scenarios |
| Relationship or household | Customers linked by ownership or address | Catches coordinated activity | Needs reliable linking data and is easy to over-merge |
| Counterparty | Alerts that involve the same other party | Useful for networks and mules | Counterparty data is often incomplete |
Most systems use customer as the default case key. They use customer and scenario as the duplicate key. Relationship-level grouping is added where the data is reliable enough.
Grouping alerts by customer
The simplest consolidation collects alerts for the same customer into a single case.
from collections import defaultdict
def group_into_cases(alerts):
"""Group alerts by customer so one analyst reviews them together."""
grouped = defaultdict(list)
for alert in alerts:
grouped[alert["customer_id"]].append(alert)
return [
{"customer_id": customer_id, "alert_count": len(items), "alerts": items}
for customer_id, items in grouped.items()
]The function takes the alert records that scenarios produced, such as the ones from the structuring rule in the previous chapters. It makes one case for each customer_id. If customer C1 has a structuring alert and a rapid-movement alert, the output is one case with alert_count equal to 2, not two separate review items.
This version has gaps that a production system must close. It groups only the alerts in the current batch. It does not look for a case that is already open. It keeps no history of when each alert joined the case. The next sections cover these points.
Suppressing duplicates
A duplicate alert is a new alert for the same customer and scenario whose evidence is already covered by an alert that is still open. Because lookback windows slide forward, a persistent pattern generates a new alert every run. Without suppression, a seven-day window on a daily schedule could produce up to seven alerts for one burst of deposits.
A common rule compares the new alert's window with the windows of open alerts that have the same key. It suppresses the new alert if its window starts before the open alert's window ends, plus a suppression gap. The gap is a parameter, so it is tuned like any other threshold.
from datetime import datetime, timedelta
def suppress_duplicates(new_alerts, open_alerts, suppression_days):
"""Split new alerts into (kept, suppressed).
A new alert is a duplicate when an open alert exists for the same
customer and scenario and the new window starts no later than the
open alert's window end plus the suppression gap.
"""
gap = timedelta(days=suppression_days)
kept, suppressed = [], []
for alert in new_alerts:
is_duplicate = any(
existing["customer_id"] == alert["customer_id"]
and existing["scenario"] == alert["scenario"]
and alert["window_start"] <= existing["window_end"] + gap
for existing in open_alerts
)
(suppressed if is_duplicate else kept).append(alert)
return kept, suppressed
open_alerts = [
{"customer_id": "C1", "scenario": "structuring_cash",
"window_start": datetime(2026, 3, 2, 10, 0),
"window_end": datetime(2026, 3, 5, 9, 15)},
]
new_alerts = [
{"customer_id": "C1", "scenario": "structuring_cash",
"window_start": datetime(2026, 3, 2, 10, 0),
"window_end": datetime(2026, 3, 6, 12, 0)},
{"customer_id": "C1", "scenario": "structuring_cash",
"window_start": datetime(2026, 3, 20, 9, 0),
"window_end": datetime(2026, 3, 23, 14, 0)},
{"customer_id": "C3", "scenario": "structuring_cash",
"window_start": datetime(2026, 3, 4, 9, 0),
"window_end": datetime(2026, 3, 6, 16, 0)},
]
kept, suppressed = suppress_duplicates(new_alerts, open_alerts, suppression_days=7)
print(len(kept), len(suppressed)) # 2 1
for a in kept:
print(a["customer_id"], a["window_start"].date())
# C1 2026-03-20
# C3 2026-03-04The first C1 alert is suppressed. It is the same burst of deposits seen one day later, and its window starts before the open alert's window end. The second C1 alert starts on March 20, more than seven days after March 5, so it is treated as new behavior and kept. C3 has no open alert, so it is kept.
What suppression should preserve
Suppression must not discard information. In the example, the suppressed alert has a longer window than the open alert, which means one more qualifying deposit may have arrived on March 6. If the system only drops the alert, the analyst reviewing the open alert never sees that deposit. Good implementations do one of the following:
- Attach the suppressed alert to the open alert as a linked record, and update the open alert's count, total amount, and window end.
- Keep a suppression log with the reason, the open alert it was matched to, and the run date, so that auditors can reproduce the decision.
The second point matters for governance. A regulator or internal auditor may ask why no alert was reviewed for a given customer on a given day. "It was suppressed because alert 4471 was open and covered the same window" is an acceptable answer only if the system recorded it.
Adding alerts to existing cases
Real consolidation runs against cases that are already open, not only against the current batch. The logic for each new alert is:
- Find the open case for the grouping key, such as the customer.
- If one exists, attach the alert to it and record the time and the scenario.
- If none exists, create a new case.
- If the case is closed, apply the reopen rule. Some institutions open a new case. Others reopen the old one if it closed within a set number of days.
The diagram shows where suppression and grouping sit in the flow.
Failure modes and trade-offs
Consolidation reduces workload, but a poorly tuned setup creates new risks.
- Over-suppression hides new activity. If the suppression gap is too long, a customer with an open alert can run a fresh pattern without a new alert being raised. Linking suppressed alerts to the open one, as described above, limits this risk.
- Under-suppression floods analysts. A gap that is too short, or a duplicate key that includes too many fields, lets near-identical alerts through.
- Over-merging buries signal. A case with 40 alerts across many scenarios is hard to read. Some systems cap case size or group by scenario family, so that cash-related and wire-related alerts form separate cases for the same customer.
- Under-merging splits context. If cases are keyed by account, a customer with five accounts may be reviewed five times by five analysts.
- Stale cases absorb new alerts. A case left open for months keeps collecting alerts and gets old. Many programs set a maximum case age after which a new case must start.
- Alert counts stop meaning anything. After consolidation, 100 alerts may become 30 cases. Alert volume and case volume are different measures, so reporting should state which one it uses. This matters when you evaluate tuning, covered in a later chapter.
Consolidation and the rest of the pipeline
Consolidation happens after alert generation and before scoring and triage. This order has consequences.
- Scoring usually applies to the case, not to the single alert. A case with a structuring alert and a rapid-movement alert on the same customer often scores higher than either alert alone.
- Triage gets one work item and the full list of linked alerts. The analyst's disposition applies to the case, and the system records it against each alert for reporting.
- Tuning needs the alert-level view. If you measure only cases, you cannot tell which scenario produced noise. Keep the links between cases, alerts, and suppressed alerts so that you can measure each scenario.
Exercise
A seven-day structuring scenario runs daily. Customer C7 has an open structuring alert covering March 1 to March 4. On March 5 the scenario fires again for C7 with a window from March 1 to March 5. The suppression gap is 7 days. What should happen to the March 5 alert, and what must the system do so the analyst does not miss the March 5 transaction?
Show answer
The new alert is a duplicate. Its window start (March 1) is not later than the open alert's window end (March 4) plus 7 days, so it is suppressed instead of becoming a separate review item. To keep the March 5 evidence, the system should link the suppressed alert to the open alert and update the open alert's window end, transaction count, and total amount. It should also write a suppression log entry that names the open alert and the reason.
Exercise
A bank groups alerts into cases by account, not by customer. Name one problem this causes and one situation where it is the better choice.
Show answer
A customer with several accounts gets several cases, so different analysts may review parts of the same pattern and miss the whole picture. Account-level grouping is better when accounts of one customer serve unrelated purposes and are reviewed by different teams, such as a personal account and a separate business account where each has its own risk profile and expected activity. It also helps where the system only stores reliable data at the account level.