Appearance
Safer gambling
Watching a player's deposits for signs of harm: deposit and sign-up events, the net loss and verified age your platform keeps on the player, and a safer-gambling case when a rule warns. Pack: examples/policies/safer-gambling/.
A pattern for expressing a gaming & betting policy, not compliance guidance: the thresholds, lists and fields are placeholders chosen to make the example run; a real policy comes from the business's own rules. It calls no app, so it runs in an empty workspace as it is.
The decision it automates
Whether to take no action (approve), open a safer-gambling case, or block (reject), when your platform starts the run after a deposit.
Data expected
- The player as a subject (kind
user) withage,netLoss30danddeviceId, written by your platform. deposit.madeevents with anamount, andaccount.createdevents with the promoteddeviceIdkey, posted throughPOST /events.
Steps and rules
| Step | Type | Why |
|---|---|---|
rules | evaluate_rules | The safer-gambling rule set under max_severity; nothing is collected. |
route | branch | rules.outcome == manual_review opens a case. |
review | create_case | safer_gambling, 4-hour SLA. |
decide | emit_decision | From the rules, or the reviewer's decision. |
The rule set safer-gambling (useCase: monitoring) uses max_severity: a failed block rule rejects, a failed warn rule sends the run to review, and the weights add up to the score.
| Rule | Type | Severity, weight | Fails when |
|---|---|---|---|
play_age_verified | comparison | block, 100 | age is under 18 |
play_deposit_velocity | velocity | warn, 30 | deposits sum to more than 1 000 in 24 hours |
play_loss_threshold | score threshold | warn, 30 | netLoss30d is above 3 000 |
play_linked_accounts | velocity | warn, 20 | more than two account.created events on the device in 30 days |
What a reviewer sees
A safer_gambling case with the rule results and the player's deposits on the timeline. What follows (a call, a deposit limit) is recorded as the decision's reasons; case.decided tells your platform.
How to adapt it
Set the ages and thresholds your market requires, add a call_app step to your messaging service that sends the player a safer-gambling message, and backtest new thresholds over past deposits before publishing.
Run it
bash
pnpm policy:import examples/policies/safer-gambling --publishThe fixture deposits 600 and 850 within two hours for a player with a net loss of 900: the deposit velocity rule fails, a safer_gambling case opens, the check closes it with no action (approve) and the run completes with a manual approve.