First-Month Metrics for Ultra and Rule-Based FinCrime Scoring
Easy · Analytics & Experimentation · Data Scientist · Technical Screen
Prompt
You are a Data Scientist working on a digital banking app whose warehouse stores all timestamps in UTC. You must rely exclusively on the tables and columns listed below; whenever a business quantity is not captured directly by a dedicated column, define and justify a clean proxy constructed from this schema.
Available Schema
usersuser_id BIGINT PRIMARY KEYcreate_date TIMESTAMPcountry VARCHAR(optional — may or may not be populated)
transactionstransaction_id BIGINT PRIMARY KEYuser_id BIGINT(foreign key tousers(user_id))transaction_time TIMESTAMPproduct VARCHAR(contains product codes such as'crypto', and may contain'ultra'when plan fees are booked as a product)amount_gbp NUMERIC(18,2)status VARCHAR('completed'or'declined')ip_country VARCHAR(optional — may or may not be populated)
activityuser_id BIGINT(foreign key tousers(user_id))event_time TIMESTAMPproduct VARCHAR(may include'ultra')event_type VARCHAR('view'or'click')
Part A: 30-Day Readout for the Ultra Membership Launch
The app introduces a paid Ultra membership tier and asks you to evaluate its first 30 days post-release:
- Structure your definition of rollout success into a single primary metric, supporting diagnostic metrics, and protective guardrail metrics.
- Discuss major threats to analytical validity (including calendar seasonality, launch marketing blasts, and user self-selection) and concrete ways to mitigate each one.
- Provide SQL (or clear pseudo-SQL) computing these metrics strictly from the three tables above.
Part B: Rule-Based Financial-Crime Flagging
You team up with Financial Crime investigators to surface suspicious payment behavior from the same tables:
- Translate "suspicious behavior" into modular, testable rule-based criteria using only the schema above (accounting gracefully for optional columns).
- Write SQL (or clear pseudo-SQL) that produces one of the following output grains — state explicitly which grain you chose and why:
- one row per flagged
user_idcontaining a compositerisk_scoreand human-readable triggered rule reasons, or - one row per flagged
transaction_idcontaining triggered rule flags/reasons.
- one row per flagged
- Explain the false-positive vs false-negative trade-off and how you would evaluate, audit, and iterate on rule thresholds in production.
Scope & Expectations
- Schema discipline & explicit fallbacks: Map unmeasured concepts (active eligibility, paid subscription start, fallback if
'ultra'is absent fromtransactions, optional country fields) to explicit column-level proxies and sanity checks. - Structured metric hierarchy & bias mitigation: Pair one pre-committed primary conversion metric on a frozen pre-launch audience with funnel/checkout diagnostics, cannibalization guardrails (such as stratified difference-in-differences), and right-censoring awareness.
- Defensive, investigator-ready fraud SQL: Justify account-level vs transaction-level output, write rolling-window velocity checks and
NULL-safe explanation strings, and weight rules so benign single signals do not flood review capacity. - Economic threshold tuning & clean feedback loops: Frame cutoffs around marginal review economics, separate precision labels from independent recall labels, and iterate via below-threshold sampling and shadow-mode rollouts.
Step-by-step walkthrough
Audit the schema and define explicit proxies
Because we may use only
users,transactions, andactivity, our first job is to map every business concept to a defensible proxy (an observable stand-in computed from existing columns) and state our fallback if an optional column or'ultra'product tag is absent:Business concept Direct column? Proxy built from available schema --------------------- -------------- ---------------------------------------------------------------------- Paid Ultra subscriber No User with >= 1 row in transactions where product = 'ultra', status = 'completed', and amount_gbp > 0 (first row = start time). Fallback (no tx tag) - If 'ultra' never appears in transactions, use first activity 'click' on product = 'ultra' and explicitly label it subscribe intent. Saw / clicked offer No activity row with product = 'ultra' and event_type = 'view' / 'click'. Eligible user base No Users with >= 1 completed transaction or activity event in the 30 days strictly before launch (frozen before launch day). Ultra fee revenue If tagged SUM(amount_gbp) of completed positive-amount 'ultra' transactions. User country Optional users.country if present; else modal (most frequent) transactions.ip_country before launch, or 'unknown'. Churn / cancellation Not in month 1 Missing second 'ultra' charge ~35 days after first (observable month 2).Before trusting these proxies, run two quick sanity checks on day 1: 1. Check
SELECT amount_gbp, status, COUNT(*) FROM transactions WHERE product = 'ultra' GROUP BY 1, 2;— subscription fees should cluster tightly around fixed plan prices rather than arbitrary purchase amounts, and negative refund rows (if any) are excluded byamount_gbp > 0. 2. Check whether launch includes a 30-day free trial; if first charges are delayed past day 30, pair the click-intent proxy with day-31 trial-to-paid conversion.Define primary, diagnostic, and guardrail metrics for Scenario A
A disciplined 1-month launch readout separates metrics into three clear roles:
- Primary metric (the single go/no-go yardstick): 30-day paid conversion rate of the frozen eligible base.
30-day paid conversion = (eligible users with >= 1 completed positive 'ultra' charge in [launch, launch + 30d)) / (total users in the pre-launch 30-day eligible base)Why this beats alternatives: unlike raw subscriber counts, a rate compares fairly across markets; unlike gross revenue, it does not mix adoption with regional pricing; unlike `'click'` rate, it proves willingness to pay; and freezing the denominator *before* launch prevents launch marketing from moving the denominator. Set the success threshold before launch day.-
Diagnostic metrics (explain why the primary metric hit or missed its goal):
- Acquisition funnel:
eligible -> viewed ('view') -> clicked ('click') -> paidstep conversion rates. - Adoption velocity: Daily new payers (distinguishing a day-1 email spike from steady weekly demand) and median days from first
'view'to first completed charge. - Segment breakdown: Paid conversion by country, account age (
launch_ts - create_date), pre-launch spend tier, and prior product affinity (for example, heavy'crypto'users). - Checkout health: Charge success rate =
completed / (completed + declined)on positive'ultra'fee attempts. - Early usage: Share of week-1/2 subscribers logging
'ultra'activity in days[7, 14)after paying.
- Acquisition funnel:
-
Guardrail metrics (safety checks that must not degrade):
- Non-Ultra spend per user: Completed non-
'ultra'transaction volume of subscribers vs matched non-subscribers (checking for cannibalization). - Core app engagement & payment reliability: Overall active rate of the eligible base (checking for promo fatigue) and platform-wide transaction decline rate.
- FinCrime abuse rate: Share of new Ultra payers flagged by Scenario B rules (catching stolen cards or perk abuse).
- Non-Ultra spend per user: Completed non-
Worked example on
400,000eligible users:48,000view Ultra (12.0%reach),9,600click (20.0%view-to-click), and4,800complete payment (50.0%click-to-pay), giving a primary 30-day paid conversion of4,800 / 400,000 = 1.20%. Across all users (including brand-new sign-ups),5,000completed charges out of5,250attempts gives a95.2%checkout success rate.Mitigate threats to validity in the 1-month window
Even clean SQL can lead to wrong product decisions if we ignore five validity traps:
- Seasonality: Holidays, paydays, or summer travel shift spending for everyone at once. Mitigation: Benchmark against the same calendar month last year, and evaluate spending guardrails relative to unexposed peers rather than raw pre-vs-post jumps.
- Marketing blasts & novelty spikes: Launch-day push notifications pull forward eager users; if half of month-1 sign-ups happen in the first 72 hours, extrapolating month 1 linearly overstates run-rate growth. Mitigation: Split conversion and Week-2 engagement by signup-week cohort (users grouped by the week they subscribed), and hold out a random 5–10% control group from promotional pushes to isolate marketing lift.
- Selection bias (self-selection): Power users naturally adopt premium plans; seeing subscribers spend
4×more than non-subscribers after launch mostly reflects who bought Ultra, not what Ultra caused. Mitigation: Group eligible users into pre-launch spend deciles (10 equal-sized buckets from lowest to highest prior spend) and compute difference-in-differences (the pre-to-post change for subscribers minus the pre-to-post change for non-subscribers in the exact same decile). - Right-censoring in a 30-day window: Monthly renewals happen at day ~30, and someone who subscribed on day 25 has not even finished their second week by day 30. Mitigation: Include a subscriber in Week-2 engagement only if full days
[7, 14)have elapsed beforewindow_end, and track month-2 renewal as soon as Cohort 1 clears day 35. - Proxy noise: Refunds, duplicate retries, or staff test accounts distort counts. Mitigation: Filter
amount_gbp > 0, deduplicate payers withDISTINCT user_id, and validate price clusters first.
Write SQL for Scenario A primary, diagnostic, and guardrail metrics
All SQL below uses PostgreSQL with UTC timestamps. First, compute the primary metric and step-by-step funnel on the frozen eligible base:
WITH params AS ( SELECT TIMESTAMP '2026-03-02 00:00' AS launch_ts, TIMESTAMP '2026-04-01 00:00' AS window_end ), eligible AS ( -- Frozen pre-launch audience: active in the 30 days strictly before launch_ts. SELECT t.user_id FROM transactions t CROSS JOIN params p WHERE t.status = 'completed' AND t.transaction_time >= p.launch_ts - INTERVAL '30 days' AND t.transaction_time < p.launch_ts UNION SELECT a.user_id FROM activity a CROSS JOIN params p WHERE a.event_time >= p.launch_ts - INTERVAL '30 days' AND a.event_time < p.launch_ts ), ultra_signals AS ( -- Convert every Ultra interaction or completed fee into 0/1 flags. SELECT a.user_id, CASE WHEN a.event_type = 'view' THEN 1 ELSE 0 END AS viewed, CASE WHEN a.event_type = 'click' THEN 1 ELSE 0 END AS clicked, 0 AS paid FROM activity a CROSS JOIN params p WHERE a.product = 'ultra' AND a.event_time >= p.launch_ts AND a.event_time < p.window_end UNION ALL SELECT t.user_id, 0 AS viewed, 0 AS clicked, 1 AS paid FROM transactions t CROSS JOIN params p WHERE t.product = 'ultra' AND t.status = 'completed' AND t.amount_gbp > 0 AND t.transaction_time >= p.launch_ts AND t.transaction_time < p.window_end ), per_user AS ( SELECT e.user_id, COALESCE(MAX(s.viewed), 0) AS viewed, COALESCE(MAX(s.clicked), 0) AS clicked, COALESCE(MAX(s.paid), 0) AS paid FROM eligible e LEFT JOIN ultra_signals s ON s.user_id = e.user_id GROUP BY e.user_id ) SELECT COUNT(*) AS eligible_users, SUM(viewed) AS viewers, SUM(clicked) AS clickers, SUM(paid) AS payers, ROUND(100.0 * SUM(paid) / NULLIF(COUNT(*), 0), 2) AS paid_conversion_pct, ROUND(100.0 * SUM(viewed * clicked) / NULLIF(SUM(viewed), 0), 1) AS view_to_click_pct, ROUND(100.0 * SUM(clicked * paid) / NULLIF(SUM(clicked), 0), 1) AS click_to_pay_pct FROM per_user;Second, measure Ultra checkout health and gross fee revenue across all positive-fee attempts:
SELECT COUNT(*) FILTER (WHERE status = 'completed') AS completed_charges, COUNT(*) FILTER (WHERE status = 'declined') AS declined_charges, ROUND(100.0 * COUNT(*) FILTER (WHERE status = 'completed') / NULLIF(COUNT(*), 0), 1) AS charge_success_pct, COALESCE(SUM(amount_gbp) FILTER (WHERE status = 'completed'), 0) AS ultra_revenue_gbp FROM transactions WHERE product = 'ultra' AND amount_gbp > 0 AND transaction_time >= TIMESTAMP '2026-03-02 00:00' AND transaction_time < TIMESTAMP '2026-04-01 00:00';Third, check the non-Ultra spend guardrail using within-decile difference-in-differences weighted by subscriber count:
WITH params AS ( SELECT TIMESTAMP '2026-03-02 00:00' AS launch_ts ), eligible AS ( SELECT t.user_id FROM transactions t CROSS JOIN params p WHERE t.status = 'completed' AND t.transaction_time >= p.launch_ts - INTERVAL '30 days' AND t.transaction_time < p.launch_ts UNION SELECT a.user_id FROM activity a CROSS JOIN params p WHERE a.event_time >= p.launch_ts - INTERVAL '30 days' AND a.event_time < p.launch_ts ), payers AS ( SELECT DISTINCT t.user_id FROM transactions t CROSS JOIN params p WHERE t.product = 'ultra' AND t.status = 'completed' AND t.amount_gbp > 0 AND t.transaction_time >= p.launch_ts AND t.transaction_time < p.launch_ts + INTERVAL '30 days' ), non_ultra_spend AS ( SELECT t.user_id, SUM(CASE WHEN t.transaction_time < p.launch_ts THEN t.amount_gbp ELSE 0 END) AS pre_gbp, SUM(CASE WHEN t.transaction_time >= p.launch_ts THEN t.amount_gbp ELSE 0 END) AS post_gbp FROM transactions t CROSS JOIN params p WHERE t.status = 'completed' AND t.product <> 'ultra' AND t.transaction_time >= p.launch_ts - INTERVAL '30 days' AND t.transaction_time < p.launch_ts + INTERVAL '30 days' GROUP BY t.user_id ), bucketed AS ( SELECT e.user_id, COALESCE(s.pre_gbp, 0) AS pre_gbp, COALESCE(s.post_gbp, 0) AS post_gbp, CASE WHEN py.user_id IS NOT NULL THEN 1 ELSE 0 END AS is_subscriber, NTILE(10) OVER (ORDER BY COALESCE(s.pre_gbp, 0)) AS pre_decile FROM eligible e LEFT JOIN non_ultra_spend s ON s.user_id = e.user_id LEFT JOIN payers py ON py.user_id = e.user_id ), by_decile AS ( SELECT pre_decile, SUM(is_subscriber) AS n_subscribers, AVG(CASE WHEN is_subscriber = 1 THEN post_gbp - pre_gbp END) AS sub_delta, AVG(CASE WHEN is_subscriber = 0 THEN post_gbp - pre_gbp END) AS ctrl_delta FROM bucketed GROUP BY pre_decile ) SELECT ROUND(SUM(n_subscribers * (sub_delta - ctrl_delta)) / NULLIF(SUM(n_subscribers), 0), 2) AS did_non_ultra_spend_gbp FROM by_decile WHERE n_subscribers > 0 AND ctrl_delta IS NOT NULL;In one decile, if subscribers grow from
£1,100to£1,200(+£100) while non-subscribers in the same decile grow from£1,080to£1,120(+£40), the difference-in-differences estimate is+£60(no cannibalization); a sharp negative value flags cannibalization.Scenario B: choose user-level output and design testable FinCrime rules
Explicit output choice: one row per suspicious
user_idwithrisk_scoreandreasons. Why user-level beats transaction-level here: investigators freeze, verify, or offboard accounts; multi-transaction typologies (card testing, rapid bursts, crypto cash-out) only become visible across a sequence of rows; and collapsing to one row per user prevents a 30-attempt script from creating 30 separate tickets. Each reason string still cites the triggering amounts and counts so the investigator has full context.Translate "suspicious" into six modular rules calibrated from historical high percentiles (for example, 99.9th percentiles of clean accounts):
Rule ID Behaviour & testable threshold Points ------------------------- ----------------------------------------------------------------- ------ R1_LARGE_VS_HISTORY Tx >= 1,000 GBP AND >= 3x user's 90-day max completed tx 30 (when >= 3 prior txs); if < 3 prior txs, any tx >= 5,000 GBP. R2_VELOCITY_10M >= 10 transactions (completed or declined) in any sliding 10m. 25 R3_DECLINE_BURST_1H >= 5 declined transactions in any sliding 1h (card/balance probe). 35 R4_NEW_ACCT_HIGH_VALUE Account < 7 days old with >= 3,000 GBP completed today. 25 R5_CRYPTO_FAST_OUT Account < 30 days old, >= 1,000 GBP completed today, and 20 >= 80% of today's completed volume is on product = 'crypto'. R6_IP_COUNTRY_ANOMALY (Optional columns present) >= 2 distinct ip_country values today, 15 OR completed tx >= 500 GBP where ip_country <> users.country.With a review threshold of
risk_score >= 35: -R3_DECLINE_BURST_1H(35) triggers review on its own because 5 declines in an hour strongly indicates probing. - Any two medium rules (R1 + R2 = 55,R4 + R5 = 45) trigger review. -R6_IP_COUNTRY_ANOMALY(15) never queues a user by itself, protecting legitimate travellers and VPN users unless another risky behaviour happens on the same day.Write the SQL to output suspicious users
The daily scoring query evaluates
[run_start, run_end). Notice two critical SQL details: 1.windowedreads 1 hour beforerun_startand usesRANGE BETWEEN INTERVAL ... PRECEDINGsliding windows so bursts straddling00:00or clock-minute boundaries are counted accurately. 2.COALESCEwraps optionalcountryandip_countrystrings inR6so aNULLcountry never turnsdetailintoNULL(which would otherwise causeSTRING_AGGto silently drop the reason while keeping its+15points!).WITH params AS ( SELECT TIMESTAMP '2026-03-10 00:00' AS run_start, TIMESTAMP '2026-03-11 00:00' AS run_end ), today AS ( SELECT t.* FROM transactions t CROSS JOIN params p WHERE t.transaction_time >= p.run_start AND t.transaction_time < p.run_end ), prior_90d AS ( SELECT t.user_id, COUNT(*) AS n_prior, MAX(t.amount_gbp) AS max_prior FROM transactions t CROSS JOIN params p WHERE t.status = 'completed' AND t.transaction_time >= p.run_start - INTERVAL '90 days' AND t.transaction_time < p.run_start GROUP BY t.user_id ), windowed AS ( -- Pull 1h lookback so 00:05 events see their full trailing 10m and 1h windows. SELECT t.user_id, t.transaction_time, COUNT(*) OVER ( PARTITION BY t.user_id ORDER BY t.transaction_time RANGE BETWEEN INTERVAL '10 minutes' PRECEDING AND CURRENT ROW ) AS n_10min, SUM(CASE WHEN t.status = 'declined' THEN 1 ELSE 0 END) OVER ( PARTITION BY t.user_id ORDER BY t.transaction_time RANGE BETWEEN INTERVAL '1 hour' PRECEDING AND CURRENT ROW ) AS declined_1h FROM transactions t CROSS JOIN params p WHERE t.transaction_time >= p.run_start - INTERVAL '1 hour' AND t.transaction_time < p.run_end ), hits AS ( SELECT x.user_id, 'R1_LARGE_VS_HISTORY' AS rule_id, 30 AS points, 'max tx ' || MAX(x.amount_gbp) || ' GBP vs 90d max ' || COALESCE(MAX(pr.max_prior)::text, 'none') AS detail FROM today x LEFT JOIN prior_90d pr ON pr.user_id = x.user_id WHERE (COALESCE(pr.n_prior, 0) >= 3 AND x.amount_gbp >= 1000 AND x.amount_gbp >= 3 * pr.max_prior) OR (COALESCE(pr.n_prior, 0) < 3 AND x.amount_gbp >= 5000) GROUP BY x.user_id UNION ALL SELECT w.user_id, 'R2_VELOCITY_10M', 25, MAX(w.n_10min) || ' transactions within 10m' FROM windowed w CROSS JOIN params p WHERE w.transaction_time >= p.run_start GROUP BY w.user_id HAVING MAX(w.n_10min) >= 10 UNION ALL SELECT w.user_id, 'R3_DECLINE_BURST_1H', 35, MAX(w.declined_1h) || ' declines within 1h' FROM windowed w CROSS JOIN params p WHERE w.transaction_time >= p.run_start GROUP BY w.user_id HAVING MAX(w.declined_1h) >= 5 UNION ALL SELECT x.user_id, 'R4_NEW_ACCT_HIGH_VALUE', 25, SUM(x.amount_gbp) || ' GBP completed on account created ' || CAST(MAX(u.create_date) AS DATE) FROM today x JOIN users u ON u.user_id = x.user_id CROSS JOIN params p WHERE x.status = 'completed' AND u.create_date > p.run_start - INTERVAL '7 days' GROUP BY x.user_id HAVING SUM(x.amount_gbp) >= 3000 UNION ALL SELECT x.user_id, 'R5_CRYPTO_FAST_OUT', 20, SUM(CASE WHEN x.product = 'crypto' THEN x.amount_gbp ELSE 0 END) || ' of ' || SUM(x.amount_gbp) || ' GBP in crypto (<30d account)' FROM today x JOIN users u ON u.user_id = x.user_id CROSS JOIN params p WHERE x.status = 'completed' AND u.create_date > p.run_start - INTERVAL '30 days' GROUP BY x.user_id HAVING SUM(x.amount_gbp) >= 1000 AND SUM(CASE WHEN x.product = 'crypto' THEN x.amount_gbp ELSE 0 END) >= 0.8 * SUM(x.amount_gbp) UNION ALL -- Omit this block if optional columns transactions.ip_country or users.country are absent. SELECT x.user_id, 'R6_IP_COUNTRY_ANOMALY', 15, 'IPs ' || COALESCE(STRING_AGG(DISTINCT x.ip_country, ','), 'none') || ' vs registered ' || COALESCE(MAX(u.country), 'unknown') FROM today x JOIN users u ON u.user_id = x.user_id GROUP BY x.user_id HAVING COUNT(DISTINCT x.ip_country) >= 2 OR SUM(CASE WHEN x.status = 'completed' AND x.amount_gbp >= 500 AND x.ip_country <> u.country THEN 1 ELSE 0 END) >= 1 ) SELECT user_id, LEAST(100, SUM(points)) AS risk_score, STRING_AGG(rule_id || ': ' || detail, '; ' ORDER BY points DESC, rule_id) AS reasons FROM hits GROUP BY user_id HAVING SUM(points) >= 35 ORDER BY risk_score DESC, user_id;Sample output row:
user_id = 812 | risk_score = 60 | reasons = 'R3_DECLINE_BURST_1H: 7 declines within 1h; R2_VELOCITY_10M: 12 transactions within 10m'.Balance false positives vs false negatives, evaluate, and iterate
Every threshold trades off false negatives (missed fraud: direct financial loss, chargeback fees, and regulatory risk) against false positives (innocent users queued: analyst cost plus customer churn when legitimate payments are delayed).
Set the cutoff economically using marginal precision (the fraud rate in the lowest score bucket you still review, not the average precision of the whole queue): - Suppose passive manual review costs
£5per alert (with no immediate account freeze) and catching a bad actor prevents£800in expected loss. Reviewing is cost-positive wheneverP(fraud | score band) * £800 > £5, i.e.,P(fraud) > 0.625%(higher if reviews trigger temporary blocks that hurt customer retention, or capped earlier if daily analyst capacity fills up first).Evaluate and iterate in a tight loop:
Rule backtest table (illustrative) Alerts/day Precision Unique frauds caught (no other rule fired) ----------------------------------- ---------- --------- ------------------------------------------ R3_DECLINE_BURST_1H 40 45% 12 (keep high weight) R1_LARGE_VS_HISTORY 120 12% 9 (solid contributor) R2_VELOCITY_10M 80 10% 2 (useful combiner) R6_IP_COUNTRY_ANOMALY 300 2% 0 (keep below cutoff)- Separate label sources: Measure precision (
confirmed_bad / reviewed) from investigator outcomes, and measure recall (flagged_early / all_independent_bad) on fraud surfaced outside these rules (chargebacks, victim reports, law-enforcement notices). - Audit blind spots: Regularly sample unqueued accounts just below the threshold (
score20–34) so missed fraud and adversaries gaming thresholds (for example sending9transactions in 10 minutes to duckR2) become visible. - Ship changes in shadow mode: Backtest new rules on historical labels, log them silently in shadow mode (recording hits without alerting analysts) for 2–3 weeks to verify daily volume, version every rule ID, and re-tune weights monthly.
- Separate label sources: Measure precision (
Intuition & how it works
Working with a restricted schema is like diagnosing both store sales and shoplifting using only door-click counters (activity) and cash-register receipts (transactions). Because no subscription table exists, you first build explicit proxies (measurable stand-ins from available columns): a completed positive 'ultra' receipt means a customer actually paid for the membership, whereas 'view' and 'click' events only show window-shopping. On the FinCrime side, instead of treating every unusual receipt as a crime, you score each account across complementary signals — oversize jumps vs personal history, 10-minute bursts, 1-hour decline sprees, brand-new high-value crypto cash-outs, and country mismatches — so investigators review a ranked list of high-risk users with clear evidence strings.
Jumping straight to SQL without metric hygiene or careful window logic fails fast. Counting 'click' events as subscriptions or letting launch-week marketing change the user denominator inflates or distorts conversion, while comparing Ultra buyers directly against non-buyers confuses selection bias (power users naturally buying premium plans) with product lift. Similarly, transaction-level fraud alerts turn one 30-attempt bot burst into 30 duplicate tickets, fixed clock-minute buckets miss bursts across :59–:01, and unguarded NULL country columns can silently erase rule explanations during SQL string concatenation.
Walk through a concrete mini-trace of both scenarios:
- Scenario A: Out of 400,000 pre-launch eligible users, 48,000 view Ultra, 9,600 click (20%), and 4,800 complete a positive 'ultra' charge (50%), yielding a primary conversion rate of 4,800 / 400,000 = 1.20%. In one pre-launch spend bucket, subscribers grow non-Ultra spend by +£100 (£1,100 -> £1,200) while matched non-subscribers grow by +£40 (£1,080 -> £1,120), giving +£60 net change (no cannibalization).
- Scenario B: User 812 triggers 7 declines in 40 minutes (R3_DECLINE_BURST_1H = 35 pts) and 12 total attempts in 8 minutes (R2_VELOCITY_10M = 25 pts) -> risk_score = 60 >= 35 (queued for review), whereas a holidaymaker with a £600 foreign card payment (R6_IP_COUNTRY_ANOMALY = 15 pts alone) stays safely below 35.
Key points
- State every proxy and schema fallback upfront: Use
product = 'ultra' AND status = 'completed' AND amount_gbp > 0for paid adoption (falling back to'click'labeled strictly as intent if'ultra'is absent fromtransactions), and validate fee price clusters and free-trial rules on day 1. - Separate primary, diagnostic, and guardrail metrics: Anchor success on 30-day paid conversion of the frozen pre-launch eligible base, explain movements with funnel (
view -> click -> pay), segment, and checkout-decline diagnostics, and protect the business with guardrail metrics (health checks that must not worsen, such as non-Ultra spend and abuse rates). - Defend validity against five classic biases: Mitigate seasonality, launch-blast spikes, selection bias, right-censoring (incomplete observation windows for late-month sign-ups), and refund noise using signup-week cohorts (weekly subscriber groups), within-decile (10% spend bucket) difference-in-differences (subscriber pre-post delta minus matched control pre-post delta), and promotional holdouts.
- Choose user-level FinCrime output (
user_id,risk_score,reasons): Investigations happen at the account level, multi-row velocity patterns span many transactions, and grouping per user/day keeps bursts from flooding the queue. - Write defensive, boundary-safe SQL: Use
RANGE BETWEEN INTERVAL ... PRECEDINGsliding windows (rolling lookback from each event's timestamp) with a 1-hour pre-midnight buffer, filteramount_gbp > 0on subscription fee checks, and wrap optionalcountry/ip_countrycolumns inCOALESCEsoSTRING_AGGnever dropsNULLreason strings. - Tune thresholds on marginal economics and independent labels: Compare marginal precision (confirmed fraud rate in the lowest reviewed score band) against
review_cost / prevented_loss(£5 / £800 = 0.625%), measure recall on independently reported fraud (chargebacks, victim reports), audit below-threshold users, and test rule edits in shadow mode (silent logging before live alerting).
Common mistakes
- Conflating clicks with paid subscriptions or leaving the fallback unstated: If
'ultra'is missing fromtransactions,'click'measures intent rather than revenue and must be labeled accordingly. - Naming multiple "primary" metrics or picking the target after seeing month-1 numbers: Without one pre-committed primary metric, any launch can be rationalized as a win.
- Comparing post-launch spend of subscribers vs all non-subscribers: Heavy users self-select into Ultra, so raw post-launch comparisons vastly overstate Ultra's causal lift (or hide cannibalization).
- Bucketizing velocity with
DATE_TRUNC('minute', ...)or omitting midnight lookback: Fixed clock buckets split bursts that cross a minute mark, and filteringtransaction_time >= run_startbefore the window function blinds00:05transactions to23:58activity. - Letting
NULLoptional columns poison SQL string concatenation: In PostgreSQL,'registered ' || NULLevaluates toNULL, causingSTRING_AGGto silently omit the rule's explanation whileSUM(points)still adds its points. - Checking average queue precision instead of marginal precision, or measuring recall on rule-caught cases: High precision at
score >= 80can hide a money-losing0.1%precision band atscore 35–39, and computing recall without independent chargeback/report labels makes recall circular.
Follow-up questions
- How does your measurement plan adapt if the 'ultra' product value is never logged in the transactions table? Fall back to the earliest
'click'onproduct = 'ultra'inactivityas an explicit subscribe-intent proxy, and check whether clickers simultaneously exhibit a new recurring fixed-amountcompletedcharge under a genericproductlabel (such as'subscription'or'fee') that non-clickers lack. If such a recurring charge exists, you recover paid conversion fromtransactions; otherwise, report click-through conversion as an upper bound on adoption and partner with Finance to log'ultra'distinctly intransactions. - How would you structure a randomized experiment to estimate Ultra's causal impact without preventing organic customers from subscribing? Use a randomized encouragement design (randomizing promotional exposure — such as in-app banners and emails — while keeping Ultra available in settings for everyone): hold out a random control arm from Ultra promotions and compare both paid conversion and non-Ultra spend between arms. Dividing the between-arm difference in non-Ultra spend by the between-arm difference in subscription rate estimates the causal effect among users persuaded by the promotion. To detect a conversion lift from
1.2%to1.4%at a two-sided5%significance level and80%statistical power (the probability of detecting a real effect of that size), each arm needs roughly(1.96 + 0.84)^2 * (0.012 * 0.988 + 0.014 * 0.986) / 0.002^2 ≈ 50,300eligible users. - How can you stop sophisticated bad actors from probing and staying one step below static velocity cutoffs? Attackers who learn that
10transactions in10minutes triggerR2will throttle bots to9per10minutes. Counter this by pairing short-window rules with wider-window rules (for example,25in1hour and60in24hours), combining multiple softer ratios into the composite score so no single threshold is an all-clear pass, randomly auditing a small slice ofscore 20–34accounts every week, and transitioning to a continuous gradient-boosted tree risk score once sufficient reviewed and chargeback labels accumulate.
Follow-up questions
- How does your measurement plan adapt if the 'ultra' product value is never logged in the transactions table?
- How would you structure a randomized experiment to estimate Ultra's causal impact without preventing organic customers from subscribing?
- How can you stop sophisticated bad actors from probing and staying one step below static velocity cutoffs?
Similar questions
- Evaluate the Ultra Tier Rollout and Build SQL Fraud Rules
- Thread-Safe Dining Reservation Service Without Overlapping Bookings
- Automated Location-Based Travel Insurance Enrollment
- Global Banking Ledger and Account Sync Across Regions
- Database Isolation, Production Latency Triage, and DDD vs CQRS
- Bounded-Capacity Uniform Random Node Router
More Revolut interview questions
- Evaluate the Ultra Tier Rollout and Build SQL Fraud Rules Hard
- Database Isolation, Production Latency Triage, and DDD vs CQRS Medium
- Thread-Safe Dining Reservation Service Without Overlapping Bookings Medium Pro
- Automated Location-Based Travel Insurance Enrollment Medium Pro
- Global Banking Ledger and Account Sync Across Regions Medium Pro
- Bounded-Capacity Uniform Random Node Router Medium Pro
- Deadlock-Free Concurrent Account Ledger Transfers Medium Pro