Sub topic 9
Grouping alerts into cases and suppressing duplicates
This chapter assumes you know what a scenario and an alert record are, as covered in earlier chapters. It also assumes you can read basic Python. Here you will see how a monitoring system turns a stream of alerts into a smaller set of cases that analysts can review.
Why alerts need grouping
A customer can trigger several scenarios in the same week. A structuring scenario, a rapid-movement scenario and a high-risk-country wire scenario may all fire for one person. If each alert goes to a different analyst, three people investigate the same customer. Each one pulls the same account history and may reach a different conclusion.
Consolidation fixes this. The system collects related alerts into one case, a unit of work that one analyst reviews as a whole. Duplicate suppression handles a second problem: the same scenario firing again and again for the same activity.
Grouping by a key
The simplest approach groups alerts by customer. The key can also be an account, a household, or a linked party. The choice matters. A customer key finds activity spread over several accounts. An account key keeps cases small but can split a pattern in two.
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 loops once over the alerts and appends each one to a list stored under its customer ID. It then returns one case per customer, with a count and the alerts inside.
Suppressing duplicates
Duplicates usually come from overlapping windows. Suppose a structuring rule runs every night over a seven-day window. A customer deposits cash on Monday, Tuesday and Wednesday. The rule fires on Wednesday night. On Thursday the window still contains those three deposits, so it fires again.
The rule from the earlier chapter limits this with break, which gives one alert per customer per run. That does not stop the same pattern from alerting on the next run. Systems usually add one of these controls:
- Open-case check. If an open case for the same customer and scenario exists, add the new evidence to it instead of creating a new alert.
- Cool-down period. After an alert, the scenario stays quiet for that customer for a set number of days unless new transactions appear.
- Transaction-level memory. The system records which transactions have already contributed to an alert. A new alert needs at least one new transaction.
The third control is the most precise, because it tests the actual evidence and not a calendar.
def new_evidence(alert_txn_ids, already_alerted_ids):
"""Return the transaction IDs not yet used in an earlier alert."""
return set(alert_txn_ids) - set(already_alerted_ids)
already = {"T1", "T2", "T3"}
print(new_evidence(["T1", "T2", "T3"], already)) # set()
print(new_evidence(["T2", "T3", "T4"], already)) # {'T4'}An empty result means the alert repeats old evidence and can be suppressed. A non-empty result means something new happened, so the alert is kept or merged into the open case.
The flow
Common errors
- Suppressing silently. Suppressed alerts must be logged with a reason. Auditors and model validators need to see what the system chose not to show.
- Grouping too widely. A case with fifty alerts from unrelated scenarios is hard to read. Some systems group only alerts from related typologies.
- Cool-downs that hide escalation. If activity grows during a cool-down, suppression delays review. Let a large increase in amount or count break through.
- Counting alerts as workload. Ten alerts in one case are one review, not ten. Measure workload in cases.
Exercise
A nightly structuring rule uses a seven-day window. It alerted on Wednesday for transactions T1, T2 and T3. On Thursday it produces an alert for T1, T2 and T3 again. What should the system do, and which control makes that decision?
Show answer
It should suppress the Thursday alert and log the reason. Transaction-level memory shows that all three transactions were already used in the Wednesday alert, so there is no new evidence. An open-case check would also apply: if the Wednesday case is still open, any later alert with new evidence would be added to it.