-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparse_result.py
More file actions
25 lines (22 loc) · 956 Bytes
/
parse_result.py
File metadata and controls
25 lines (22 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import json, sys, statistics
d = json.load(sys.stdin)
s = d['summary']
rings = d['fraud_rings']
accts = d['suspicious_accounts']
print('=== SAMPLE CSV ===')
print(f'Accounts analyzed : {s["total_accounts_analyzed"]}')
print(f'Suspicious flagged: {s["suspicious_accounts_flagged"]}')
print(f'Fraud rings : {s["fraud_rings_detected"]}')
print()
print('--- Rings ---')
for r in rings:
print(f' {r["ring_id"]} | {r["pattern_type"]:30s} | score={r["risk_score"]:5.1f} | members={r["member_accounts"]}')
print()
if accts:
scores = [a["suspicion_score"] for a in accts]
print('--- Score distribution ---')
print(f' count={len(scores)}, min={min(scores):.1f}, max={max(scores):.1f}, mean={statistics.mean(scores):.1f}, median={statistics.median(scores):.1f}')
print()
print('--- Top 15 accounts ---')
for a in accts[:15]:
print(f' {a["account_id"]:15s} score={a["suspicion_score"]:5.1f} {a["detected_patterns"]}')