make-mp-data 3.0.4 → 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 +28 -8
  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} +77 -15
  10. package/dungeons/education-schema.json +2409 -0
  11. package/dungeons/education.js +206 -442
  12. package/dungeons/fintech-schema.json +14034 -0
  13. package/dungeons/fintech.js +110 -389
  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 +150 -383
  20. package/dungeons/gaming-schema.json +1270 -0
  21. package/dungeons/gaming.js +143 -3
  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 +221 -391
  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 +130 -388
  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 +210 -337
  34. package/dungeons/scd-schema.json +919 -0
  35. package/dungeons/scd.js +38 -10
  36. package/dungeons/simple-schema.json +608 -0
  37. package/dungeons/simple.js +48 -11
  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 +124 -365
  42. package/dungeons/text-generation-schema.json +3096 -0
  43. package/dungeons/text-generation.js +71 -0
  44. package/index.js +6 -3
  45. package/lib/core/config-validator.js +18 -0
  46. package/lib/core/storage.js +5 -5
  47. package/lib/generators/events.js +4 -4
  48. package/lib/orchestrators/mixpanel-sender.js +12 -7
  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 -117
  55. package/dungeons/anon.js +0 -128
  56. package/dungeons/benchmark-heavy.js +0 -240
  57. package/dungeons/benchmark-light.js +0 -126
  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 -160
  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
@@ -1,309 +0,0 @@
1
- /**
2
- * This is the default configuration file for the data generator in SIMPLE mode
3
- * notice how the config object is structured, and see it's type definition in ./types.d.ts
4
- * feel free to modify this file to customize the data you generate
5
- * see helper functions in utils.js for more ways to generate data
6
- */
7
-
8
-
9
-
10
-
11
- import Chance from 'chance';
12
- const chance = new Chance();
13
- import dayjs from "dayjs";
14
- import utc from "dayjs/plugin/utc.js";
15
- dayjs.extend(utc);
16
- import { uid, comma } from 'ak-tools';
17
- import { pickAWinner, weighNumRange, date, integer } from "../lib/utils/utils.js";
18
-
19
- const itemCategories = ["Books", "Movies", "Music", "Games", "Electronics", "Computers", "Smart Home", "Home", "Garden", "Pet", "Beauty", "Health", "Toys", "Kids", "Baby", "Handmade", "Sports", "Outdoors", "Automotive", "Industrial", "Entertainment", "Art", "Food", "Appliances", "Office", "Wedding", "Software"];
20
-
21
- const videoCategories = ["funny", "educational", "inspirational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"];
22
-
23
- /** @type {import('../types').Dungeon} */
24
- const config = {
25
- token: "",
26
- seed: "simple is best",
27
- numDays: 30, //how many days worth of data
28
- numEvents: 50000, //how many events
29
- numUsers: 500, //how many users
30
- format: 'csv', //csv or json
31
- region: "US",
32
- hasAnonIds: false, //if true, anonymousIds are created for each user
33
- hasSessionIds: false, //if true, hasSessionIds are created for each user
34
-
35
- events: [
36
- {
37
- event: "checkout",
38
- weight: 2,
39
- properties: {
40
- amount: weighNumRange(5, 500, .25),
41
- currency: ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
42
- coupon: ["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"],
43
- numItems: weighNumRange(1, 10),
44
-
45
- }
46
- },
47
- {
48
- event: "add to cart",
49
- weight: 4,
50
- properties: {
51
- amount: weighNumRange(5, 500, .25),
52
- rating: weighNumRange(1, 5),
53
- reviews: weighNumRange(0, 35),
54
- isFeaturedItem: [true, false, false],
55
- itemCategory: pickAWinner(itemCategories, integer(0, 27)),
56
- dateItemListed: date(30, true, 'YYYY-MM-DD'),
57
- itemId: integer(1000, 9999),
58
- }
59
- },
60
- {
61
- event: "page view",
62
- weight: 10,
63
- properties: {
64
- page: ["/", "/", "/help", "/account", "/watch", "/listen", "/product", "/people", "/peace"],
65
- utm_source: ["$organic", "$organic", "$organic", "$organic", "google", "google", "google", "facebook", "facebook", "twitter", "linkedin"],
66
- }
67
- },
68
- {
69
- event: "watch video",
70
- weight: 8,
71
- properties: {
72
- videoCategory: pickAWinner(videoCategories, integer(0, 9)),
73
- isFeaturedItem: [true, false, false],
74
- watchTimeSec: weighNumRange(10, 600, .25),
75
- quality: ["2160p", "1440p", "1080p", "720p", "480p", "360p", "240p"],
76
- format: ["mp4", "avi", "mov", "mpg"],
77
- uploader_id: chance.guid.bind(chance)
78
-
79
- }
80
- },
81
- {
82
- event: "view item",
83
- weight: 8,
84
- properties: {
85
- isFeaturedItem: [true, false, false],
86
- itemCategory: pickAWinner(itemCategories, integer(0, 27)),
87
- dateItemListed: date(30, true, 'YYYY-MM-DD'),
88
- itemId: integer(1000, 9999),
89
- }
90
- },
91
- {
92
- event: "save item",
93
- weight: 5,
94
- properties: {
95
- isFeaturedItem: [true, false, false],
96
- itemCategory: pickAWinner(itemCategories, integer(0, 27)),
97
- dateItemListed: date(30, true, 'YYYY-MM-DD'),
98
- itemId: integer(1000, 9999),
99
- }
100
- },
101
- {
102
- event: "sign up",
103
- isFirstEvent: true,
104
- weight: 0,
105
- properties: {
106
- CTA: ["sign up", "register", "join", "create account"]
107
- }
108
- }
109
- ],
110
- funnels: [
111
- // {
112
- // sequence: ["page view", "view item", "page view", "sign up"],
113
- // weight: 1,
114
- // isFirstFunnel: true,
115
- // order: "sequential",
116
- // conversionRate: 50,
117
- // timeToConvert: 2,
118
- // props: {
119
- // variants: ["A", "B", "C", "Control"],
120
- // flows: ["new", "existing", "loyal", "churned"],
121
- // flags: ["on", "off"],
122
- // experiment_ids: ["1234", "5678", "9012", "3456", "7890"],
123
- // multiVariate: [true, false]
124
-
125
- // },
126
-
127
- // },
128
- // {
129
- // sequence: ["app install", "app open", "tutorial", "sign up"],
130
- // weight: 1,
131
- // isFirstFunnel: true,
132
- // order: "sequential",
133
- // conversionRate: 50,
134
- // timeToConvert: 2,
135
- // props: {
136
- // variants: ["A", "B", "C", "Control"],
137
- // flows: ["new", "existing", "loyal", "churned"],
138
- // flags: ["on", "off"],
139
- // experiment_ids: ["1234", "5678", "9012", "3456", "7890"],
140
- // multiVariate: [true, false]
141
-
142
- // }
143
- // },
144
- // {
145
- // sequence: ["view item", "add to cart", "checkout", "rage", "cage", "mage"],
146
- // order: "interrupted"
147
- // },
148
- // {
149
- // sequence: ["page view", "view item", "add to cart", "add to cart", "checkout"],
150
- // weight: 3,
151
- // isFirstFunnel: false,
152
- // order: "sequential",
153
- // conversionRate: 70,
154
- // timeToConvert: 7 * 24,
155
- // props: {
156
- // variants: ["A", "B", "C", "Control"],
157
- // flows: ["new", "existing", "loyal", "churned"],
158
- // flags: ["on", "off"],
159
- // experiment_ids: ["1234", "5678", "9012", "3456", "7890"],
160
- // multiVariate: [true, false]
161
-
162
- // }
163
- // },
164
- // {
165
- // timeToConvert: 2,
166
- // conversionRate: 66,
167
- // sequence: ["foo", "bar", "baz", "qux"],
168
- // }, {
169
- // weight: 4,
170
- // sequence: ["video", "video", "attack", "defend", "click"],
171
- // }
172
- ],
173
- superProps: {
174
- platform: ["web", "mobile", "web", "mobile", "web", "web", "kiosk", "smartTV"],
175
- currentTheme: ["light", "dark", "custom", "light", "dark"],
176
- // emotions: generateEmoji(),
177
-
178
- },
179
- /*
180
- user properties work the same as event properties
181
- each key should be an array or function reference
182
- */
183
- userProps: {
184
- title: chance.profession.bind(chance),
185
- luckyNumber: weighNumRange(42, 420),
186
- spiritAnimal: ["duck", "dog", "otter", "penguin", "cat", "elephant", "lion", "cheetah", "giraffe", "zebra", "rhino", "hippo", "whale", "dolphin", "shark", "octopus", "squid", "jellyfish", "starfish", "seahorse", "crab", "lobster", "shrimp", "clam", "snail", "slug", "butterfly", "moth", "bee", "wasp", "ant", "beetle", "ladybug", "caterpillar", "centipede", "millipede", "scorpion", "spider", "tarantula", "tick", "mite", "mosquito", "fly", "dragonfly", "damselfly", "grasshopper", "cricket", "locust", "mantis", "cockroach", "termite", "praying mantis", "walking stick", "stick bug", "leaf insect", "lacewing", "aphid", "cicada", "thrips", "psyllid", "scale insect", "whitefly", "mealybug", "planthopper", "leafhopper", "treehopper", "flea", "louse", "bedbug", "flea beetle", "weevil", "longhorn beetle", "leaf beetle", "tiger beetle", "ground beetle", "lady beetle", "firefly", "click beetle", "rove beetle", "scarab beetle", "dung beetle", "stag beetle", "rhinoceros beetle", "hercules beetle", "goliath beetle", "jewel beetle", "tortoise beetle"]
187
- },
188
-
189
- scdProps: {
190
- role: {
191
- type: "user",
192
- frequency: "week",
193
- values: ["admin", "collaborator", "user", "view only", "no access"],
194
- timing: 'fuzzy',
195
- max: 10
196
- },
197
- NPS: {
198
- type: "user",
199
- frequency: "day",
200
- values: weighNumRange(1, 10, 2, 150),
201
- timing: 'fuzzy',
202
- max: 10
203
- },
204
- MRR: {
205
- type: "company_id",
206
- frequency: "month",
207
- values: weighNumRange(0, 10000, .15),
208
- timing: 'fixed',
209
- max: 10
210
- },
211
- AccountHealthScore: {
212
- type: "company_id",
213
- frequency: "week",
214
- values: weighNumRange(1, 10, .15),
215
- timing: 'fixed',
216
- max: 40
217
- },
218
- plan: {
219
- type: "company_id",
220
- frequency: "month",
221
- values: ["free", "basic", "premium", "enterprise"],
222
- timing: 'fixed',
223
- max: 10
224
- }
225
- },
226
- mirrorProps: {
227
- isBot: { events: "*", values: [false, false, false, false, true] },
228
- profit: { events: ["checkout"], values: [4, 2, 42] },
229
- watchTimeSec: {
230
- events: ["watch video"],
231
- values: weighNumRange(50, 1200, 6)
232
- }
233
-
234
- },
235
-
236
- /*
237
- for group analytics keys, we need an array of arrays [[],[],[]]
238
- each pair represents a group_key and the number of profiles for that key
239
- */
240
- groupKeys: [
241
- ["company_id", 5000],
242
- ["team_id", 500],
243
- ["department_id", 50]
244
- ],
245
- groupProps: {
246
- company_id: {
247
- name: () => { return chance.company(); },
248
- email: () => { return `CSM: ${chance.pickone(["AK", "Jessica", "Michelle", "Dana", "Brian", "Dave"])}`; },
249
- industry: ["tech", "finance", "healthcare", "education", "government", "non-profit"],
250
- segment: ["enterprise", "SMB", "mid-market"],
251
- "# active users": chance.integer({ min: 2, max: 20 })
252
- },
253
- team_id: {
254
- name: () => { return `Team ${chance.word({ capitalize: true })}`; },
255
- department: ["Engineering", "Sales", "Marketing", "Support", "HR"],
256
- size: integer(3, 50)
257
- },
258
- department_id: {
259
- name: () => { return `${chance.pickone(["Engineering", "Sales", "Marketing", "Support", "HR"])} Department`; },
260
- budget: weighNumRange(10000, 1000000),
261
- headcount: integer(5, 200)
262
- }
263
- },
264
- lookupTables: [],
265
- hook: function (record, type, meta) {
266
- // user hook: classify users as creators vs viewers based on upload count
267
- if (type === "user") {
268
- record.user_type = record.upload_count >= 5 ? "creator" : "viewer";
269
- }
270
-
271
- // event hook: premium users get higher quality video and longer watch times
272
- if (type === "event") {
273
- if (record.event === "watch video") {
274
- const day = dayjs(record.time).day();
275
- // weekend binge: 2x watch time on weekends
276
- if (day === 0 || day === 6) {
277
- record["watch time"] = Math.round((record["watch time"] || 10) * 2);
278
- record.is_weekend = true;
279
- }
280
- }
281
- // failed logins get a security_flag
282
- if (record.event === "account login" && record.success === false) {
283
- record.security_flag = true;
284
- }
285
- }
286
-
287
- // everything hook: binge-watchers (>30 watch events) get a "binge session" bonus event
288
- if (type === "everything") {
289
- const watchEvents = record.filter(e => e.event === "watch video");
290
- if (watchEvents.length > 30) {
291
- const lastWatch = watchEvents[watchEvents.length - 1];
292
- record.push({
293
- event: "binge session",
294
- time: lastWatch.time,
295
- user_id: lastWatch.user_id,
296
- videos_watched: watchEvents.length,
297
- total_watch_time: watchEvents.reduce((sum, e) => sum + (e["watch time"] || 0), 0),
298
- });
299
- }
300
- return record;
301
- }
302
-
303
- return record;
304
- }
305
- };
306
-
307
-
308
-
309
- export default config;
package/dungeons/mil.js DELETED
@@ -1,323 +0,0 @@
1
-
2
- const SEED = "my-seed";
3
- import dayjs from 'dayjs';
4
- import utc from 'dayjs/plugin/utc.js';
5
- dayjs.extend(utc);
6
- import 'dotenv/config';
7
- import * as u from "../lib/utils/utils.js";
8
- import * as v from 'ak-tools';
9
- const chance = u.initChance(SEED);
10
- const num_users = 10_000;
11
- const days = 125;
12
-
13
- /** @typedef {import("../types.js").Dungeon} Config */
14
-
15
- function genIds(numIds = 1000) {
16
- const ids = [];
17
- for (let i = 0; i < numIds; i++) {
18
- ids.push(v.uid());
19
- }
20
- return ids;
21
- }
22
-
23
- const videoIds = genIds();
24
- const channelIds = genIds(100);
25
-
26
- /** @type {Config} */
27
- const config = {
28
- token: "",
29
- seed: `LFG!`, //,
30
- numDays: days,
31
- numEvents: num_users * 62,
32
- numUsers: num_users,
33
- hasAnonIds: false,
34
- hasSessionIds: false,
35
- format: "parquet",
36
- alsoInferFunnels: false,
37
- hasLocation: false,
38
- hasAndroidDevices: true,
39
- hasIOSDevices: true,
40
- hasDesktopDevices: true,
41
- hasBrowser: false,
42
- hasCampaigns: false,
43
- isAnonymous: false,
44
- hasAdSpend: false,
45
-
46
- hasAvatar: false,
47
-
48
- batchSize: 2_500_000,
49
- concurrency: 1,
50
- writeToDisk: false,
51
-
52
- funnels: [],
53
-
54
- events: [
55
- {
56
- event: "watch video",
57
- weight: 55,
58
- properties: {
59
- video_id: u.pickAWinner(videoIds),
60
- "watch percent": u.pickAWinner([
61
- 25,
62
- 50,
63
- 75,
64
- 100,
65
- ]),
66
- "watch time": u.weighNumRange(1, 65, .89, 100),
67
-
68
- "category": [
69
- "comedy",
70
- "educational",
71
- "music",
72
- "sports",
73
- "news",
74
- "gaming",
75
- "travel",
76
- ],
77
- quality: [
78
- "240p",
79
- "360p",
80
- "480p",
81
- "720p",
82
- "1080p",
83
- "4k",
84
- ],
85
- autoplay: [
86
- true,
87
- false,
88
- ],
89
- fullscreen: [
90
- true,
91
- false,
92
- ],
93
- "ads?": [
94
- true, true,
95
- false,
96
- ],
97
- },
98
- },
99
- {
100
- event: "like",
101
- weight: 10,
102
- properties: {
103
- video_id: u.pickAWinner(videoIds),
104
- },
105
- },
106
- {
107
- event: "comment",
108
- weight: 5,
109
- properties: {
110
- video_id: u.pickAWinner(videoIds),
111
- comment_length: [
112
- "short",
113
- "medium",
114
- "long",
115
- ],
116
- },
117
- },
118
- {
119
- event: "share",
120
- weight: 3,
121
- properties: {
122
- video_id: u.pickAWinner(videoIds),
123
- "share network": [
124
- "facebook",
125
- "twitter",
126
- "reddit",
127
- "email",
128
- "whatsapp",
129
- ],
130
- },
131
- },
132
- {
133
- event: "search",
134
- weight: 25,
135
- properties: {
136
- search_term: [
137
- "cats",
138
- "dogs",
139
- "tutorial",
140
- "news",
141
- "music",
142
- ],
143
- "results count": u.pickAWinner([
144
- 0,
145
- 1,
146
- 2,
147
- 3,
148
- 4,
149
- 5,
150
- 6, 7, 8, 9, 10
151
- ], 5),
152
- "search category": [
153
- "all",
154
- "channels",
155
- "playlists",
156
- ],
157
- },
158
- },
159
- {
160
- event: "subscribe",
161
- weight: 7,
162
- properties: {
163
- channel_id: u.pickAWinner(genIds()),
164
- },
165
- },
166
- {
167
- event: "unsubscribe",
168
- weight: 2,
169
- properties: {
170
- channel_id: u.pickAWinner(genIds()),
171
- },
172
- },
173
- {
174
- event: "create playlist",
175
- weight: 4,
176
- properties: {
177
- "play list name": [
178
- "favorites",
179
- "watch later",
180
- "my music",
181
- "funny videos",
182
- "educational",
183
- ],
184
- privacy: [
185
- "public",
186
- "private",
187
- "unlisted",
188
- ],
189
- },
190
- },
191
- {
192
- event: "account signup",
193
- weight: 1,
194
- isFirstEvent: true,
195
- properties: {
196
- "sign up method": [
197
- "email",
198
- "google",
199
- "facebook",
200
- ],
201
- },
202
- },
203
- {
204
- event: "account login",
205
- weight: 9,
206
- properties: {
207
- "log in method": [
208
- "email",
209
- "google",
210
- "facebook",
211
- ],
212
- success: [
213
- true,
214
- false,
215
- ],
216
- error_message: [
217
- "incorrect password",
218
- "user not found",
219
- "account locked",
220
- ],
221
- },
222
- },
223
- {
224
- event: "$experiment_started",
225
- weight: 5,
226
- isSessionStartEvent: true,
227
- properties: {
228
- "$experiment_type": "ak_ad_hoc",
229
- "Experiment name": "show results on empty search",
230
- "Variant name": ["feature enabled", "feature disabled"],
231
- }
232
- }
233
- ],
234
- superProps: {
235
- platform: [
236
- "web",
237
- "ios",
238
- "android",
239
- ],
240
- network_type: [
241
- "wifi",
242
- "cellular",
243
- ],
244
- },
245
- userProps: {
246
- subscription_status: [
247
- "free",
248
- "free",
249
- "premium",
250
- ],
251
- age_range: [
252
- "13-17",
253
- "18-24",
254
- "25-34",
255
- "35-44",
256
- "45-54",
257
- "55+",
258
- ],
259
- preferred_genre: [
260
- "comedy",
261
- "action",
262
- "drama",
263
- "sci-fi",
264
- "horror",
265
- ],
266
- upload_count: [
267
- 0,
268
- 1,
269
- 5,
270
- 10,
271
- 20,
272
- ],
273
- following_count: [
274
- 0,
275
- 10,
276
- 50,
277
- 100,
278
- 500,
279
- ],
280
- dark_mode_enabled: [
281
- true,
282
- false,
283
- ],
284
- },
285
-
286
- scdProps: {},
287
- mirrorProps: {},
288
- groupKeys: [],
289
- groupProps: {},
290
- lookupTables: [],
291
- hook: function (record, type, meta) {
292
- // event hook: tag events by frequency tier and enrich booleans
293
- if (type === "event") {
294
- const highFreq = ["foo", "bar", "baz"];
295
- const lowFreq = ["crumn", "yak"];
296
- if (highFreq.includes(record.event)) {
297
- record.frequency_tier = "high";
298
- } else if (lowFreq.includes(record.event)) {
299
- record.frequency_tier = "low";
300
- } else {
301
- record.frequency_tier = "medium";
302
- }
303
- // boolean super prop drives a derived field
304
- if (record.boolean === true) {
305
- record.flag_status = "active";
306
- }
307
- }
308
-
309
- // everything hook: users with very few events are marked as churned
310
- if (type === "everything") {
311
- if (record.length <= 3) {
312
- for (const e of record) {
313
- e.is_churned_user = true;
314
- }
315
- }
316
- return record;
317
- }
318
-
319
- return record;
320
- }
321
- };
322
-
323
- export default config;