Sub topic 3
The data a monitoring system needs
This chapter assumes you know what money laundering is, can recognize common transaction types (cash deposits, wires, card payments), and can read basic Python. It covers the inputs a monitoring system must have before any rule can produce an alert.
Three kinds of input
A scenario can only test what the data lets it see. A structuring rule needs deposit amounts, deposit times, and a way to tell whose deposits they are. If any of these is missing or wrong, the rule either cannot run or runs on bad facts.
Monitoring systems draw on three groups of data:
| Input | What it holds | What it is used for |
|---|---|---|
| Transactions | Amount, currency, type, timestamp, channel, counterparty, country | The events that rules count, sum and compare |
| Customer profiles | Customer ID, segment, occupation or business type, country, account opening date, expected activity | Choosing thresholds and judging whether activity fits the customer |
| Risk ratings | A customer risk level, such as low, medium or high, from onboarding and periodic review | Tightening thresholds and raising alert priority |
How the data flows
Source systems (core banking, card processors, wire platforms) send records to the monitoring system. The records are loaded into a common format, checked, and joined with customer data. Rules run on the joined result.
What a rule needs from each record
Look back at the structuring example from the Topic Spine. Its code reads these fields from each transaction:
type, to keep onlycash_depositrecords.amount, to test againstfloorandceiling.customer_id, to group each customer's history.timestamp, to sort records and slide the lookback window.
The parameters (lookback_days, min_count, floor, ceiling) come from the segment the customer belongs to. That is why the profile must carry a segment. In the example run the segment is retail.
A simple input check
A rule does not warn you when a field is missing. A record without customer_id fails the grouping step or, worse, is silently grouped under a blank key. Check records before rules run. The function below separates usable records from rejected ones.
from datetime import datetime
REQUIRED = ("customer_id", "type", "amount", "timestamp")
def validate(transactions):
"""Split records into usable ones and rejects with a reason."""
good, rejected = [], []
for t in transactions:
missing = [f for f in REQUIRED if t.get(f) in (None, "")]
if missing:
rejected.append((t, "missing: " + ", ".join(missing)))
elif not isinstance(t["amount"], (int, float)) or t["amount"] <= 0:
rejected.append((t, "bad amount"))
elif not isinstance(t["timestamp"], datetime):
rejected.append((t, "bad timestamp"))
else:
good.append(t)
return good, rejected
records = [
{"customer_id": "C1", "type": "cash_deposit", "amount": 9500, "timestamp": datetime(2026, 3, 2, 10, 0)},
{"customer_id": "", "type": "cash_deposit", "amount": 9300, "timestamp": datetime(2026, 3, 2, 12, 0)},
{"customer_id": "C3", "type": "cash_deposit", "amount": -50, "timestamp": datetime(2026, 3, 3, 9, 0)},
]
good, rejected = validate(records)
print(len(good), len(rejected)) # 1 2
for record, reason in rejected:
print(reason)
# missing: customer_id
# bad amountCommon data errors
These problems cause most missed or false alerts:
- Incomplete feeds. If one channel fails to load for a day, the deposits in that feed are never counted. A customer who split deposits across channels may stay under
min_count. - Inconsistent codes. One source writes
CASH_DEPand another writescash_deposit. The filter ontypemisses one of them. Map every source to one standard set of types. - Time zones and cut-off times. A deposit at 23:50 may be stamped on the next day by a different system. This shifts which window the deposit falls in.
- Stale profiles. If the segment or risk rating is out of date, the rule applies the wrong thresholds.
- Duplicate customers. If one person has two customer IDs, their activity is split and each ID stays below the threshold.
Exercise
A customer makes three cash deposits of 9,400 within four days, but the rule does not alert. Name two data problems that could explain this, using the fields the rule reads.
Show answer
Possible answers: (1) One deposit has type coded differently, such as CASH_DEP, so the filter on type drops it and the count stays at two. (2) The deposits sit under two customer IDs because of duplicate customer records, so customer_id grouping splits them. Others that also fit: a missing feed for one channel, or a timestamp shifted by a time zone so a deposit falls outside the lookback window.