make-mp-data 3.0.3 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +46 -0
  2. package/dungeons/array-of-object-lookup-schema.json +327 -0
  3. package/dungeons/array-of-object-lookup.js +29 -9
  4. package/dungeons/capstone/capstone-ic3.js +291 -0
  5. package/dungeons/capstone/capstone-ic4.js +598 -0
  6. package/dungeons/capstone/capstone-ic5.js +668 -0
  7. package/dungeons/capstone/generate-product-lookup.js +309 -0
  8. package/dungeons/ecommerce-schema.json +462 -0
  9. package/dungeons/{copilot.js → ecommerce.js} +79 -17
  10. package/dungeons/education-schema.json +2409 -0
  11. package/dungeons/education.js +226 -462
  12. package/dungeons/fintech-schema.json +14034 -0
  13. package/dungeons/fintech.js +134 -413
  14. package/dungeons/foobar-schema.json +403 -0
  15. package/dungeons/foobar.js +27 -4
  16. package/dungeons/food-delivery-schema.json +192 -0
  17. package/dungeons/food-delivery.js +602 -0
  18. package/dungeons/food-schema.json +1152 -0
  19. package/dungeons/food.js +173 -406
  20. package/dungeons/gaming-schema.json +1270 -0
  21. package/dungeons/gaming.js +182 -42
  22. package/dungeons/insurance-application-schema.json +204 -0
  23. package/dungeons/insurance-application.js +605 -0
  24. package/dungeons/media-schema.json +906 -0
  25. package/dungeons/media.js +250 -420
  26. package/dungeons/retention-cadence-schema.json +78 -0
  27. package/dungeons/retention-cadence.js +35 -1
  28. package/dungeons/rpg-schema.json +4526 -0
  29. package/dungeons/rpg.js +171 -429
  30. package/dungeons/sanity-schema.json +255 -0
  31. package/dungeons/sanity.js +21 -10
  32. package/dungeons/sass-schema.json +1291 -0
  33. package/dungeons/sass.js +241 -368
  34. package/dungeons/scd-schema.json +919 -0
  35. package/dungeons/scd.js +41 -13
  36. package/dungeons/simple-schema.json +608 -0
  37. package/dungeons/simple.js +52 -15
  38. package/dungeons/simplest-schema.json +1418 -0
  39. package/dungeons/simplest.js +392 -0
  40. package/dungeons/social-schema.json +1118 -0
  41. package/dungeons/social.js +150 -391
  42. package/dungeons/text-generation-schema.json +3096 -0
  43. package/dungeons/text-generation.js +71 -0
  44. package/index.js +8 -6
  45. package/lib/core/config-validator.js +28 -8
  46. package/lib/core/storage.js +5 -5
  47. package/lib/generators/events.js +4 -4
  48. package/lib/orchestrators/mixpanel-sender.js +16 -13
  49. package/lib/orchestrators/user-loop.js +14 -6
  50. package/lib/templates/soup-presets.js +188 -0
  51. package/lib/utils/utils.js +52 -6
  52. package/package.json +1 -1
  53. package/types.d.ts +20 -3
  54. package/dungeons/adspend.js +0 -130
  55. package/dungeons/anon.js +0 -128
  56. package/dungeons/benchmark-heavy.js +0 -240
  57. package/dungeons/benchmark-light.js +0 -140
  58. package/dungeons/big.js +0 -226
  59. package/dungeons/business.js +0 -391
  60. package/dungeons/complex.js +0 -428
  61. package/dungeons/experiments.js +0 -137
  62. package/dungeons/funnels.js +0 -309
  63. package/dungeons/mil.js +0 -323
  64. package/dungeons/mirror.js +0 -161
  65. package/dungeons/soup-test.js +0 -52
  66. package/dungeons/streaming.js +0 -372
  67. package/dungeons/strict-event-test.js +0 -30
  68. package/dungeons/student-teacher.js +0 -438
  69. package/dungeons/too-big-events.js +0 -203
  70. package/dungeons/user-agent.js +0 -209
@@ -9,76 +9,122 @@ const chance = u.initChance(SEED);
9
9
  const num_users = 5_000;
10
10
  const days = 100;
11
11
 
12
- /** @typedef {import("../../types.js").Dungeon} Config */
12
+ /** @typedef {import("../types.d.ts").Dungeon} Config */
13
13
 
14
14
  /**
15
- * NEEDLE IN A HAYSTACK - NEOBANK APP DESIGN
16
- *
17
- * NexBank - A Chime/Revolut-style neobank app where users manage accounts, make transactions,
18
- * send transfers, pay bills, set budgets, invest, apply for loans, and earn rewards.
19
- *
20
- * CORE USER LOOP:
21
- * Users open accounts (personal or business) through one of four channels (app, web, referral,
22
- * branch). They begin using the app to check balances, make transactions (purchases, ATM
23
- * withdrawals, direct deposits, refunds), and send transfers (internal, external, P2P, wire).
24
- * The app tracks spending patterns and encourages financial wellness through budgets, savings
25
- * goals, and investment tools.
26
- *
27
- * ACCOUNT TIERS:
28
- * Three-tiered system drives monetization and user segmentation:
29
- * - Basic (free): Standard banking, limited rewards
30
- * - Plus ($4.99/mo): Enhanced rewards, priority support, budgeting tools
31
- * - Premium ($14.99/mo): 3x rewards, 2x investment returns, premium analytics
32
- * Tiers are assigned as superProps, creating a persistent segmentation dimension.
33
- *
34
- * TRANSACTION ECOSYSTEM:
35
- * Transactions are the heartbeat of the app. Seven merchant categories (grocery, restaurant,
36
- * gas, retail, online, subscription, utilities) and four payment methods (debit, credit,
37
- * contactless, online) model realistic spending. Transaction amounts follow a power-law
38
- * distribution centered around $50, with occasional large purchases up to $5,000.
39
- *
40
- * FINANCIAL WELLNESS:
41
- * Budget creation and alerts model the "financial health" feature set. Users create budgets
42
- * across six categories with monthly limits, then receive alerts when approaching or exceeding
43
- * limits. This creates a measurable engagement loop: budget creators save more and invest more
44
- * (Hook #5: Budget Users Save More).
15
+ * ===================================================================
16
+ * DATASET OVERVIEW
17
+ * ===================================================================
45
18
  *
46
- * SAVINGS & INVESTMENT:
47
- * Savings goals (emergency, vacation, car, home, education, retirement) with target amounts
48
- * and monthly contributions model long-term financial planning. Investment events (stocks, ETF,
49
- * crypto, bonds, mutual funds) with buy/sell actions model portfolio activity.
19
+ * NexBank a Chime/Revolut-style neobank app. Users open accounts
20
+ * (personal or business), transact across 7 merchant categories,
21
+ * send transfers, pay bills, set budgets, invest, apply for loans,
22
+ * and earn tier-scaled rewards.
23
+ *
24
+ * Scale: 5,000 users · 600K events · 100 days · 18 event types
25
+ * Groups: 500 households
26
+ * Tiers: Basic (free) / Plus ($4.99/mo) / Premium ($14.99/mo)
27
+ *
28
+ * Core loop: onboarding → daily banking → financial planning →
29
+ * budgets & savings → investments → rewards & monetization
30
+ *
31
+ * Funnels:
32
+ * - Onboarding: account opened → app session → balance checked
33
+ * - Daily banking: app session → balance checked → transaction
34
+ * - Transfers: app session → transfer sent → notification opened
35
+ * - Bill payment: app session → bill paid → notification opened
36
+ * - Financial planning: budget created → budget alert → savings goal
37
+ * - Investment: balance checked → investment made → reward redeemed
38
+ * - Support: support contacted → card locked → dispute filed
39
+ * - Lending: loan applied → loan approved → premium upgraded
40
+ */
41
+
42
+ /**
43
+ * ===================================================================
44
+ * ANALYTICS HOOKS (8 architected patterns)
45
+ * ===================================================================
50
46
  *
51
- * LENDING:
52
- * Loan applications (personal, auto, home, student, business) flow through apply-to-approved
53
- * funnel. Requested vs. approved amounts and interest rates create realistic lending analytics.
47
+ * 1. PERSONAL VS BUSINESS ACCOUNTS (user hook)
48
+ * 20% business (employee_count, revenue, industry), 80% personal
49
+ * (age_range, life_stage). Breakdown: account_segment.
50
+ * → Insights: any event by unique users, breakdown account_segment
51
+ * → Insights: "transaction completed" avg amount, breakdown account_segment
52
+ *
53
+ * 2. PAYDAY PATTERNS (event hook)
54
+ * Direct deposits 3x on 1st/15th (payday: true). Transfers 2x on
55
+ * days 1-3 and 15-17 (post_payday_spending: true).
56
+ * → Insights: "transaction completed" avg amount, filter direct_deposit, breakdown payday
57
+ * → Insights: "transfer sent" avg amount, breakdown post_payday_spending
58
+ *
59
+ * 3. FRAUD DETECTION (everything hook)
60
+ * 3% of users get a fraud burst at timeline midpoint: 3-5 rapid
61
+ * high-value txns → card locked → dispute → support. Tagged
62
+ * fraud_sequence: true.
63
+ * → Insights: "transaction completed" total, filter fraud_sequence = true
64
+ * → Funnels: card locked → dispute filed → support contacted, filter fraud_sequence = true
65
+ *
66
+ * 4. LOW BALANCE CHURN (everything hook)
67
+ * Users with 3+ balance checks < $15K lose 50% of events after
68
+ * day 30. Surviving events tagged low_balance_churn: true.
69
+ * → Retention: any → any, segment low_balance_churn = true vs others
70
+ * → Insights: any event total over time, filter low_balance_churn = true
71
+ *
72
+ * 5. BUDGET USERS SAVE MORE (everything hook)
73
+ * Budget creators get 2x savings contributions, 1.5x investment
74
+ * amounts, extra savings goals. Tagged budget_discipline: true.
75
+ * → Insights: "savings goal set" avg monthly_contribution, breakdown budget_discipline
76
+ * → Insights: "investment made" avg amount, breakdown budget_discipline
77
+ *
78
+ * 6. AUTO-PAY LOYALTY (event hook)
79
+ * Manual payers (auto_pay=false) miss 30% of bills (event renamed
80
+ * to "bill payment missed"). Auto-pay users never miss.
81
+ * → Insights: "bill paid" + "bill payment missed" totals side by side
82
+ * → Insights: "bill paid" total, breakdown manual_payment
83
+ *
84
+ * 7. PREMIUM TIER VALUE (event hook)
85
+ * Premium: 3x rewards, 2x investment sell returns. Plus: 1.5x
86
+ * rewards. Tagged premium_reward / premium_returns.
87
+ * → Insights: "reward redeemed" avg value, breakdown account_tier
88
+ * (expected: premium ~$30, plus ~$15, basic ~$10)
89
+ * → Insights: "investment made" avg amount, filter action=sell, breakdown premium_returns
90
+ *
91
+ * 8. MONTH-END ANXIETY (event hook)
92
+ * Days >= 28: sessions 40% longer, balances 30% lower. Tagged
93
+ * month_end_anxiety / month_end_check.
94
+ * → Insights: "app session" avg session_duration_sec, breakdown month_end_anxiety
95
+ * → Insights: "balance checked" avg account_balance, breakdown month_end_check
54
96
  *
55
- * SUPPORT & ENGAGEMENT:
56
- * Support contacts across four channels (chat, phone, email, in-app) with resolution tracking.
57
- * Notifications (transaction, low_balance, bill_due, reward, security, promo) with action
58
- * tracking model re-engagement effectiveness.
97
+ * ===================================================================
98
+ * ADVANCED ANALYSIS IDEAS
99
+ * ===================================================================
59
100
  *
60
- * BILL PAYMENTS:
61
- * Six bill types (rent, utilities, phone, insurance, subscription, loan_payment) with auto-pay
62
- * toggle. Hook #6 (Auto-Pay Loyalty) creates a pattern where auto-pay users never miss
63
- * payments while manual payers miss 30%, modeling real-world payment reliability.
101
+ * Cross-hook patterns:
102
+ * - Budget + Low Balance: Do budget creators avoid low-balance churn?
103
+ * - Premium + Auto-Pay: Do premium users adopt auto-pay more?
104
+ * - Fraud + Churn: Do fraud victims churn more? Does resolution help?
105
+ * - Payday + Month-End: Do payday spenders run out by month-end?
106
+ * - Business vs Personal Fraud: Are business accounts more targeted?
64
107
  *
65
- * REWARDS:
66
- * Four reward types (cashback, points, discount, partner_offer) with values scaled by
67
- * account tier. Premium users earn 3x rewards (Hook #7), creating clear tier-based value
68
- * differentiation visible in the data.
108
+ * Cohort analysis:
109
+ * - By account_tier: upgrade paths, value realization
110
+ * - By signup_channel: referral retention vs organic
111
+ * - By income_bracket: feature adoption by income
112
+ * - By credit_score_range: loan approvals, tier adoption
69
113
  *
70
- * HOUSEHOLD GROUPS:
71
- * 500 households group users for shared financial analytics. Household-level properties
72
- * (size, combined income, financial health score, primary bank) enable group-level analysis
73
- * of shared financial behaviors.
114
+ * ===================================================================
115
+ * EXPECTED METRICS SUMMARY
116
+ * ===================================================================
74
117
  *
75
- * WHY THESE EVENTS/PROPERTIES?
76
- * - Events model a complete banking loop: onboarding -> daily use -> financial planning -> monetization
77
- * - Properties enable cohort analysis: account type, tier, income bracket, credit score
78
- * - Funnels reveal friction: onboarding completion, transfer flows, investment journeys
79
- * - Financial wellness features (budgets, goals) create engagement depth visible in the data
80
- * - Tier-based rewards and investment returns drive business metric differences
81
- * - The "needle in haystack" hooks simulate real fintech product insights hidden in production data
118
+ * Hook | Metric | Baseline | Effect | Ratio
119
+ * ----------------------|-----------------------|----------|--------|------
120
+ * Personal vs Business | Avg transaction amt | $50 | $200+ | ~4x
121
+ * Payday Patterns | Deposit amount | $50 | $100 | 2x
122
+ * Fraud Detection | Users affected | 0% | 3% | --
123
+ * Low Balance Churn | D30+ event count | 100% | 50% | 0.5x
124
+ * Budget Discipline | Monthly contribution | $200 | $400 | 2x
125
+ * Auto-Pay Loyalty | Bill completion rate | 100% | 70% | 0.7x
126
+ * Premium Tier Value | Reward value | $10 | $30 | 3x
127
+ * Month-End Anxiety | Session duration | 60s | 84s | 1.4x
82
128
  */
83
129
 
84
130
  /** @type {Config} */
@@ -176,7 +222,7 @@ const config = {
176
222
  isFirstEvent: true,
177
223
  properties: {
178
224
  "account_type": u.pickAWinner(["personal", "business", "personal"]),
179
- "signup_channel": u.pickAWinner(["app", "web", "referral", "branch"]),
225
+ "signup_channel": ["app", "web", "referral", "branch"],
180
226
  }
181
227
  },
182
228
  {
@@ -192,33 +238,33 @@ const config = {
192
238
  weight: 15,
193
239
  properties: {
194
240
  "account_balance": u.weighNumRange(0, 50000, 0.8, 2500),
195
- "account_type": u.pickAWinner(["checking", "savings", "investment"]),
241
+ "account_type": ["checking", "savings", "investment"],
196
242
  }
197
243
  },
198
244
  {
199
245
  event: "transaction completed",
200
246
  weight: 18,
201
247
  properties: {
202
- "transaction_type": u.pickAWinner(["purchase", "atm", "direct_deposit", "refund"]),
248
+ "transaction_type": ["purchase", "atm", "direct_deposit", "refund"],
203
249
  "amount": u.weighNumRange(1, 5000, 0.3, 50),
204
- "merchant_category": u.pickAWinner(["grocery", "restaurant", "gas", "retail", "online", "subscription", "utilities"]),
205
- "payment_method": u.pickAWinner(["debit", "credit", "contactless", "online"]),
250
+ "merchant_category": ["grocery", "restaurant", "gas", "retail", "online", "subscription", "utilities"],
251
+ "payment_method": ["debit", "credit", "contactless", "online"],
206
252
  }
207
253
  },
208
254
  {
209
255
  event: "transfer sent",
210
256
  weight: 8,
211
257
  properties: {
212
- "transfer_type": u.pickAWinner(["internal", "external", "p2p", "wire"]),
258
+ "transfer_type": ["internal", "external", "p2p", "wire"],
213
259
  "amount": u.weighNumRange(10, 10000, 0.3, 200),
214
- "recipient_type": u.pickAWinner(["friend", "family", "business", "self"]),
260
+ "recipient_type": ["friend", "family", "business", "self"],
215
261
  }
216
262
  },
217
263
  {
218
264
  event: "bill paid",
219
265
  weight: 6,
220
266
  properties: {
221
- "bill_type": u.pickAWinner(["rent", "utilities", "phone", "insurance", "subscription", "loan_payment"]),
267
+ "bill_type": ["rent", "utilities", "phone", "insurance", "subscription", "loan_payment"],
222
268
  "amount": u.weighNumRange(20, 3000, 0.5, 150),
223
269
  "auto_pay": u.pickAWinner([true, false], 0.4),
224
270
  }
@@ -227,7 +273,7 @@ const config = {
227
273
  event: "budget created",
228
274
  weight: 3,
229
275
  properties: {
230
- "category": u.pickAWinner(["food", "transport", "entertainment", "shopping", "bills", "savings"]),
276
+ "category": ["food", "transport", "entertainment", "shopping", "bills", "savings"],
231
277
  "monthly_limit": u.weighNumRange(50, 2000, 0.5, 300),
232
278
  }
233
279
  },
@@ -235,7 +281,7 @@ const config = {
235
281
  event: "budget alert",
236
282
  weight: 4,
237
283
  properties: {
238
- "alert_type": u.pickAWinner(["approaching_limit", "exceeded", "on_track"]),
284
+ "alert_type": ["approaching_limit", "exceeded", "on_track"],
239
285
  "percent_used": u.weighNumRange(50, 150, 1, 90),
240
286
  }
241
287
  },
@@ -243,7 +289,7 @@ const config = {
243
289
  event: "savings goal set",
244
290
  weight: 3,
245
291
  properties: {
246
- "goal_type": u.pickAWinner(["emergency", "vacation", "car", "home", "education", "retirement"]),
292
+ "goal_type": ["emergency", "vacation", "car", "home", "education", "retirement"],
247
293
  "target_amount": u.weighNumRange(500, 50000, 0.3, 5000),
248
294
  "monthly_contribution": u.weighNumRange(25, 2000, 0.5, 200),
249
295
  }
@@ -252,7 +298,7 @@ const config = {
252
298
  event: "investment made",
253
299
  weight: 4,
254
300
  properties: {
255
- "investment_type": u.pickAWinner(["stocks", "etf", "crypto", "bonds", "mutual_fund"]),
301
+ "investment_type": ["stocks", "etf", "crypto", "bonds", "mutual_fund"],
256
302
  "amount": u.weighNumRange(10, 10000, 0.3, 250),
257
303
  "action": u.pickAWinner(["buy", "sell", "buy"]),
258
304
  }
@@ -261,7 +307,7 @@ const config = {
261
307
  event: "card locked",
262
308
  weight: 1,
263
309
  properties: {
264
- "reason": u.pickAWinner(["lost", "stolen", "suspicious_activity", "travel"]),
310
+ "reason": ["lost", "stolen", "suspicious_activity", "travel"],
265
311
  }
266
312
  },
267
313
  {
@@ -269,14 +315,14 @@ const config = {
269
315
  weight: 1,
270
316
  properties: {
271
317
  "dispute_amount": u.weighNumRange(10, 2000, 0.5, 100),
272
- "reason": u.pickAWinner(["unauthorized", "duplicate", "not_received", "damaged", "wrong_amount"]),
318
+ "reason": ["unauthorized", "duplicate", "not_received", "damaged", "wrong_amount"],
273
319
  }
274
320
  },
275
321
  {
276
322
  event: "loan applied",
277
323
  weight: 2,
278
324
  properties: {
279
- "loan_type": u.pickAWinner(["personal", "auto", "home", "student", "business"]),
325
+ "loan_type": ["personal", "auto", "home", "student", "business"],
280
326
  "requested_amount": u.weighNumRange(1000, 100000, 0.3, 10000),
281
327
  }
282
328
  },
@@ -284,7 +330,7 @@ const config = {
284
330
  event: "loan approved",
285
331
  weight: 1,
286
332
  properties: {
287
- "loan_type": u.pickAWinner(["personal", "auto", "home", "student", "business"]),
333
+ "loan_type": ["personal", "auto", "home", "student", "business"],
288
334
  "approved_amount": u.weighNumRange(1000, 100000, 0.3, 10000),
289
335
  "interest_rate": u.weighNumRange(3, 25, 1, 8),
290
336
  }
@@ -293,7 +339,7 @@ const config = {
293
339
  event: "premium upgraded",
294
340
  weight: 2,
295
341
  properties: {
296
- "old_tier": u.pickAWinner(["basic", "plus", "premium"]),
342
+ "old_tier": ["basic", "plus", "premium"],
297
343
  "new_tier": u.pickAWinner(["plus", "premium", "premium"]),
298
344
  "monthly_fee": u.pickAWinner([4.99, 9.99, 14.99]),
299
345
  }
@@ -302,8 +348,8 @@ const config = {
302
348
  event: "support contacted",
303
349
  weight: 3,
304
350
  properties: {
305
- "channel": u.pickAWinner(["chat", "phone", "email", "in_app"]),
306
- "issue_type": u.pickAWinner(["transaction", "account", "card", "transfer", "technical"]),
351
+ "channel": ["chat", "phone", "email", "in_app"],
352
+ "issue_type": ["transaction", "account", "card", "transfer", "technical"],
307
353
  "resolved": u.pickAWinner([true, false], 0.8),
308
354
  }
309
355
  },
@@ -311,7 +357,7 @@ const config = {
311
357
  event: "notification opened",
312
358
  weight: 10,
313
359
  properties: {
314
- "notification_type": u.pickAWinner(["transaction", "low_balance", "bill_due", "reward", "security", "promo"]),
360
+ "notification_type": ["transaction", "low_balance", "bill_due", "reward", "security", "promo"],
315
361
  "action_taken": u.pickAWinner([true, false], 0.6),
316
362
  }
317
363
  },
@@ -319,7 +365,7 @@ const config = {
319
365
  event: "reward redeemed",
320
366
  weight: 4,
321
367
  properties: {
322
- "reward_type": u.pickAWinner(["cashback", "points", "discount", "partner_offer"]),
368
+ "reward_type": ["cashback", "points", "discount", "partner_offer"],
323
369
  "value": u.weighNumRange(1, 100, 0.5, 10),
324
370
  }
325
371
  }
@@ -327,12 +373,12 @@ const config = {
327
373
 
328
374
  superProps: {
329
375
  account_tier: u.pickAWinner(["basic", "basic", "basic", "plus", "plus", "premium"]),
330
- platform: u.pickAWinner(["ios", "android", "web"]),
376
+ platform: ["ios", "android", "web"],
331
377
  },
332
378
 
333
379
  userProps: {
334
- "credit_score_range": u.pickAWinner(["300-579", "580-669", "670-739", "740-799", "800-850"]),
335
- "income_bracket": u.pickAWinner(["under_30k", "30k_50k", "50k_75k", "75k_100k", "100k_150k", "over_150k"]),
380
+ "credit_score_range": ["300-579", "580-669", "670-739", "740-799", "800-850"],
381
+ "income_bracket": ["under_30k", "30k_50k", "50k_75k", "75k_100k", "100k_150k", "over_150k"],
336
382
  "account_age_months": u.weighNumRange(1, 60, 0.5, 12),
337
383
  "total_balance": u.weighNumRange(0, 100000, 0.3, 5000),
338
384
  "has_direct_deposit": u.pickAWinner([true, false], 0.6),
@@ -361,7 +407,7 @@ const config = {
361
407
  * 1. PERSONAL VS BUSINESS: Business accounts get employee_count, revenue; personal get age_range, life_stage
362
408
  * 2. PAYDAY PATTERNS: Transactions spike on 1st/15th with bigger deposits and post-payday spending
363
409
  * 3. FRAUD DETECTION: 3% of users experience a fraud burst (rapid high-value txns -> card lock -> dispute -> support)
364
- * 4. LOW BALANCE CHURN: Users with chronic low balances (<$500) lose 50% of activity after day 30
410
+ * 4. LOW BALANCE CHURN: Users with chronic low balances (<$15K) lose 50% of activity after day 30
365
411
  * 5. BUDGET DISCIPLINE: Budget creators save 2x more and invest 1.5x more
366
412
  * 6. AUTO-PAY LOYALTY: Auto-pay users never miss bills; manual payers miss 30%
367
413
  * 7. PREMIUM TIER VALUE: Premium users get 3x rewards; Plus users get 1.5x; Premium investors get 2x returns
@@ -572,13 +618,13 @@ const config = {
572
618
 
573
619
  // -----------------------------------------------------------
574
620
  // Hook #4: LOW BALANCE CHURN
575
- // Users who have 3+ balance checks showing < $500 are
621
+ // Users who have 3+ balance checks showing < $15,000 are
576
622
  // "struggling". After day 30, 50% of their events are removed
577
623
  // and remaining events are tagged low_balance_churn: true.
578
624
  // -----------------------------------------------------------
579
625
  let lowBalanceChecks = 0;
580
626
  userEvents.forEach((event) => {
581
- if (event.event === "balance checked" && (event.account_balance || 0) < 3000) {
627
+ if (event.event === "balance checked" && (event.account_balance || 0) < 15000) {
582
628
  lowBalanceChecks++;
583
629
  }
584
630
  });
@@ -648,328 +694,3 @@ const config = {
648
694
  };
649
695
 
650
696
  export default config;
651
-
652
- /**
653
- * ===================================================================
654
- * NEEDLE IN A HAYSTACK - NEXBANK NEOBANK ANALYTICS
655
- * ===================================================================
656
- *
657
- * A Chime/Revolut-style neobank dungeon with 8 deliberately architected
658
- * analytics insights hidden in the data. This dungeon is designed to
659
- * showcase advanced fintech product analytics patterns and demonstrate
660
- * how to find "needles" (meaningful insights) in "haystacks" (large
661
- * banking datasets).
662
- *
663
- * ===================================================================
664
- * DATASET OVERVIEW
665
- * ===================================================================
666
- *
667
- * - 5,000 users over 100 days
668
- * - 360,000 events across 18 event types
669
- * - 3 funnels (onboarding, transfer flow, investment journey)
670
- * - Group analytics (500 households)
671
- * - Lookup table (500 merchant/transaction entries)
672
- * - Account tiers (Basic, Plus, Premium)
673
- *
674
- * ===================================================================
675
- * THE 8 ARCHITECTED HOOKS
676
- * ===================================================================
677
- *
678
- * Each hook creates a specific, discoverable analytics insight that
679
- * simulates real-world fintech product behavior patterns.
680
- *
681
- * -------------------------------------------------------------------
682
- * 1. PERSONAL VS BUSINESS ACCOUNTS (user)
683
- * -------------------------------------------------------------------
684
- *
685
- * PATTERN: 20% of users are business accounts with employee_count
686
- * (5-500), annual_revenue ($100K-$10M), and industry. The other 80%
687
- * are personal accounts with age_range and life_stage.
688
- *
689
- * HOW TO FIND IT:
690
- * - Segment users by: account_segment = "business" vs "personal"
691
- * - Compare: Transaction volumes, average amounts, transfer patterns
692
- * - Analyze: Industry distribution among business accounts
693
- *
694
- * EXPECTED INSIGHT: Business accounts have fundamentally different
695
- * usage patterns - higher transaction amounts, more wire transfers,
696
- * and different bill payment profiles.
697
- *
698
- * REAL-WORLD ANALOGUE: Identifying and serving different customer
699
- * segments (B2C vs B2B) with tailored features and pricing.
700
- *
701
- * -------------------------------------------------------------------
702
- * 2. PAYDAY PATTERNS (event)
703
- * -------------------------------------------------------------------
704
- *
705
- * PATTERN: On the 1st and 15th of each month, direct deposit
706
- * transactions are 2x bigger and tagged with payday: true. On days
707
- * 1-3 and 15-17, transfer amounts have a 40% chance of being 1.5x
708
- * larger, tagged with post_payday_spending: true.
709
- *
710
- * HOW TO FIND IT:
711
- * - Chart: transaction completed count and amount by day of month
712
- * - Filter: transaction_type = "direct_deposit"
713
- * - Compare: Average transfer amount on days 1-3/15-17 vs other days
714
- * - Look for: payday: true and post_payday_spending: true tags
715
- *
716
- * EXPECTED INSIGHT: Clear biweekly spikes in deposit amounts and
717
- * subsequent spending activity. The 2-3 days after payday show
718
- * elevated transfer activity as users move money around.
719
- *
720
- * REAL-WORLD ANALOGUE: Payroll cycle effects on banking activity.
721
- * Banks use this to time marketing, credit offers, and overdraft
722
- * protection promotions.
723
- *
724
- * -------------------------------------------------------------------
725
- * 3. FRAUD DETECTION PATTERN (everything)
726
- * -------------------------------------------------------------------
727
- *
728
- * PATTERN: 3% of users experience a fraud event sequence at their
729
- * timeline midpoint: 3-5 rapid high-value transactions ($500-$3,000)
730
- * within 1 hour, followed by card locked (suspicious_activity),
731
- * dispute filed (unauthorized), and support contacted (phone/card).
732
- * All injected events tagged with fraud_sequence: true.
733
- *
734
- * HOW TO FIND IT:
735
- * - Filter events: fraud_sequence = true
736
- * - Analyze: Time between fraud transactions (< 10 min gaps)
737
- * - Funnel: transaction completed -> card locked -> dispute filed -> support contacted
738
- * - Segment: Users with any fraud_sequence event
739
- *
740
- * EXPECTED INSIGHT: ~150 users (3% of 5,000) show a distinctive burst
741
- * pattern of rapid high-value purchases followed by account lockdown.
742
- * Clear temporal clustering of fraud events.
743
- *
744
- * REAL-WORLD ANALOGUE: Fraud detection in banking. Unusual velocity
745
- * and amount patterns trigger automated alerts and account freezes.
746
- *
747
- * -------------------------------------------------------------------
748
- * 4. LOW BALANCE CHURN (everything)
749
- * -------------------------------------------------------------------
750
- *
751
- * PATTERN: Users with 3+ balance checks showing < $500 are
752
- * "struggling" users. After day 30, 50% of their events are removed
753
- * (simulating reduced app usage) and surviving events are tagged
754
- * with low_balance_churn: true.
755
- *
756
- * HOW TO FIND IT:
757
- * - Segment: Users where count of (balance checked, account_balance < 500) >= 3
758
- * - Compare: Event counts before day 30 vs after day 30
759
- * - Filter: low_balance_churn = true
760
- * - Retention analysis: Compare D30+ retention for low vs healthy balance users
761
- *
762
- * EXPECTED INSIGHT: Struggling users show a dramatic drop in activity
763
- * after the first month. Their engagement halves while healthy-balance
764
- * users maintain consistent usage.
765
- *
766
- * REAL-WORLD ANALOGUE: Financial stress-driven churn. Users who
767
- * can't maintain balances disengage from their banking app, which
768
- * predicts account closure.
769
- *
770
- * -------------------------------------------------------------------
771
- * 5. BUDGET USERS SAVE MORE (everything)
772
- * -------------------------------------------------------------------
773
- *
774
- * PATTERN: Users who create any budget have 2x monthly savings
775
- * contributions, 1.5x investment amounts, and extra savings goal
776
- * events spliced into their timeline. All affected events tagged
777
- * with budget_discipline: true.
778
- *
779
- * HOW TO FIND IT:
780
- * - Segment: Users who did "budget created" vs those who didn't
781
- * - Compare: Average monthly_contribution on savings goal events
782
- * - Compare: Average investment amount
783
- * - Count: savings goal set events per user (budget users have more)
784
- * - Filter: budget_discipline = true
785
- *
786
- * EXPECTED INSIGHT: Budget creators save 2x more and invest 1.5x more
787
- * than non-budget users. They also set more savings goals, showing
788
- * compound financial wellness behavior.
789
- *
790
- * REAL-WORLD ANALOGUE: Financial planning tools drive better outcomes.
791
- * Users who engage with budgeting features are more financially active
792
- * and retain longer - a key product-market fit signal.
793
- *
794
- * -------------------------------------------------------------------
795
- * 6. AUTO-PAY LOYALTY (event)
796
- * -------------------------------------------------------------------
797
- *
798
- * PATTERN: Bill paid events with auto_pay = false have a 30% chance
799
- * of being dropped entirely (simulating missed payments). Auto-pay
800
- * users never miss. Surviving manual payments are tagged with
801
- * manual_payment: true.
802
- *
803
- * HOW TO FIND IT:
804
- * - Segment: bill paid events by auto_pay = true vs false
805
- * - Compare: Total bill paid count per user in each segment
806
- * - Calculate: Effective bill completion rate by segment
807
- * - Filter: manual_payment = true for surviving manual payments
808
- *
809
- * EXPECTED INSIGHT: Auto-pay users have 100% bill completion while
810
- * manual payers show only ~70% completion. This creates a clear
811
- * reliability gap that would drive auto-pay adoption campaigns.
812
- *
813
- * REAL-WORLD ANALOGUE: Auto-pay enrollment is one of the strongest
814
- * retention predictors in fintech. Users who set up auto-pay are
815
- * less likely to miss payments and less likely to churn.
816
- *
817
- * -------------------------------------------------------------------
818
- * 7. PREMIUM TIER VALUE (event)
819
- * -------------------------------------------------------------------
820
- *
821
- * PATTERN: Premium tier users get 3x reward values and 2x investment
822
- * sell returns. Plus tier users get 1.5x rewards. Tagged with
823
- * premium_reward: true and premium_returns: true respectively.
824
- *
825
- * HOW TO FIND IT:
826
- * - Segment: Events by account_tier (basic, plus, premium)
827
- * - Compare: Average reward value on reward redeemed events
828
- * - Compare: Average amount on investment made (action = sell)
829
- * - Filter: premium_reward = true, premium_returns = true
830
- * - Analyze: Total reward value per user by tier
831
- *
832
- * EXPECTED INSIGHT: Clear tier-based value curve. Premium users
833
- * earn 3x the rewards and 2x the investment returns of Basic users,
834
- * with Plus users in between. This validates tier pricing.
835
- *
836
- * REAL-WORLD ANALOGUE: Premium banking tiers that provide tangible
837
- * financial benefits. The reward multiplier justifies the monthly
838
- * fee and drives upgrade conversions.
839
- *
840
- * -------------------------------------------------------------------
841
- * 8. MONTH-END ANXIETY (event)
842
- * -------------------------------------------------------------------
843
- *
844
- * PATTERN: On the last 3 days of each month (day >= 28), app sessions
845
- * are 40% longer and balance checks show 30% lower balances. Tagged
846
- * with month_end_anxiety: true and month_end_check: true.
847
- *
848
- * HOW TO FIND IT:
849
- * - Chart: Average session_duration_sec by day of month
850
- * - Chart: Average account_balance on balance checked by day of month
851
- * - Filter: month_end_anxiety = true, month_end_check = true
852
- * - Compare: Day 1-27 vs day 28-31 engagement metrics
853
- *
854
- * EXPECTED INSIGHT: Users spend 40% more time in the app at month-end,
855
- * checking lower balances. This reflects pre-bill-pay anxiety and
856
- * end-of-month financial stress.
857
- *
858
- * REAL-WORLD ANALOGUE: Month-end financial anxiety drives app
859
- * engagement spikes. Banks can leverage this pattern for timely
860
- * overdraft protection offers, savings nudges, and bill reminders.
861
- *
862
- * ===================================================================
863
- * ADVANCED ANALYSIS IDEAS
864
- * ===================================================================
865
- *
866
- * CROSS-HOOK PATTERNS:
867
- *
868
- * 1. Budget + Low Balance: Do budget creators (Hook #5) avoid the
869
- * low-balance churn pattern (Hook #4)? Budget discipline should
870
- * correlate with healthier balances.
871
- *
872
- * 2. Premium + Auto-Pay: Do premium tier users (Hook #7) have higher
873
- * auto-pay adoption than basic users? Does tier upgrading predict
874
- * auto-pay enrollment?
875
- *
876
- * 3. Fraud + Churn: Do fraud victims (Hook #3) churn more than
877
- * non-victims? Does support resolution quality affect post-fraud
878
- * retention?
879
- *
880
- * 4. Payday + Month-End: Compare payday spending spikes (Hook #2)
881
- * with month-end anxiety (Hook #8). Do payday spenders run out
882
- * of money by month-end?
883
- *
884
- * 5. Business vs Personal Fraud: Are business accounts (Hook #1)
885
- * more or less likely to be fraud targets (Hook #3)?
886
- *
887
- * COHORT ANALYSIS:
888
- *
889
- * - Cohort by account_tier: Track upgrade paths and value realization
890
- * across Basic -> Plus -> Premium
891
- * - Cohort by signup_channel: Do referral users have better retention
892
- * and higher balances?
893
- * - Cohort by income_bracket: How does income correlate with feature
894
- * adoption (budgets, investments, savings goals)?
895
- * - Cohort by credit_score_range: Do higher credit scores predict
896
- * loan approvals and premium tier adoption?
897
- *
898
- * FUNNEL ANALYSIS:
899
- *
900
- * - Onboarding Funnel: account opened -> app session -> balance checked
901
- * by account type and signup channel
902
- * - Transfer Flow: app session -> transfer sent -> notification opened
903
- * by tier and platform
904
- * - Investment Journey: balance checked -> investment made -> reward redeemed
905
- * by income bracket and budget creation status
906
- *
907
- * ===================================================================
908
- * EXPECTED METRICS SUMMARY
909
- * ===================================================================
910
- *
911
- * Hook | Metric | Baseline | Hook Effect | Ratio
912
- * ----------------------|-----------------------|----------|-------------|------
913
- * Personal vs Business | Avg transaction amt | $50 | $200+ | ~4x
914
- * Payday Patterns | Deposit amount | $50 | $100 | 2x
915
- * Fraud Detection | Users affected | 0% | 3% | --
916
- * Low Balance Churn | D30+ event count | 100% | 50% | 0.5x
917
- * Budget Discipline | Monthly contribution | $200 | $400 | 2x
918
- * Auto-Pay Loyalty | Bill completion rate | 100% | 70% | 0.7x
919
- * Premium Tier Value | Reward value | $10 | $30 | 3x
920
- * Month-End Anxiety | Session duration | 60s | 84s | 1.4x
921
- *
922
- * ===================================================================
923
- * HOW TO RUN THIS DUNGEON
924
- * ===================================================================
925
- *
926
- * From the dm4 root directory:
927
- *
928
- * npm start
929
- *
930
- * Or programmatically:
931
- *
932
- * import generate from './index.js';
933
- * import config from './dungeons/harness-fintech.js';
934
- * const results = await generate(config);
935
- *
936
- * OUTPUT FILES (with writeToDisk: false):
937
- *
938
- * - needle-haystack-fintech__events.json.gz - All event data
939
- * - needle-haystack-fintech__user_profiles.json.gz - User profiles
940
- * - needle-haystack-fintech__group_profiles.json.gz - Household profiles
941
- * - needle-haystack-fintech__transaction_id_lookup.json.gz - Merchant catalog
942
- *
943
- * ===================================================================
944
- * TESTING YOUR ANALYTICS PLATFORM
945
- * ===================================================================
946
- *
947
- * This dungeon is perfect for testing:
948
- *
949
- * 1. Segmentation: Can you separate business vs personal accounts?
950
- * 2. Time Patterns: Can you detect the biweekly payday cycle?
951
- * 3. Anomaly Detection: Can you find the fraud burst patterns?
952
- * 4. Churn Prediction: Can you predict churn from low balance signals?
953
- * 5. Feature Impact: Can you measure budget tools' effect on savings?
954
- * 6. Behavioral Analysis: Can you quantify auto-pay vs manual reliability?
955
- * 7. Tier Analysis: Can you calculate reward ROI by account tier?
956
- * 8. Temporal Patterns: Can you identify month-end anxiety in the data?
957
- *
958
- * ===================================================================
959
- * WHY "NEEDLE IN A HAYSTACK"?
960
- * ===================================================================
961
- *
962
- * Each hook is a "needle" - a meaningful, actionable insight hidden in a
963
- * "haystack" of 360K events. The challenge is:
964
- *
965
- * 1. FINDING the needles (discovery)
966
- * 2. VALIDATING they're real patterns (statistical significance)
967
- * 3. UNDERSTANDING why they matter (business impact)
968
- * 4. ACTING on them (product decisions)
969
- *
970
- * This mirrors real-world fintech analytics: your transaction data contains
971
- * valuable insights about user behavior, but you need the right tools and
972
- * skills to find them.
973
- *
974
- * ===================================================================
975
- */