# Offline detection decision model; no systems or services are contacted.
events = [
    {"id": "B1", "account": "svc_backup", "operation": "backup", "hour": 2},
    {"id": "B2", "account": "unknown_admin", "operation": "grant_role", "hour": 2},
    {"id": "B3", "account": "svc_backup", "operation": "grant_role", "hour": 2},
    {"id": "B4", "account": "svc_backup", "operation": "backup", "hour": 17},
]

def decide(e):
    if e["account"] == "svc_backup" and e["operation"] == "backup" and e["hour"] == 2:
        return "expected"
    return "investigate"

result = [(e["id"], decide(e)) for e in events]
assert result == [("B1", "expected"), ("B2", "investigate"),
                  ("B3", "investigate"), ("B4", "investigate")]
for event_id, label in result:
    print(event_id, label)
