make-mp-data 2.1.11 → 3.0.2
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.
- package/README.md +31 -0
- package/dungeons/adspend.js +35 -1
- package/dungeons/anon.js +25 -1
- package/dungeons/array-of-object-lookup.js +201 -0
- package/dungeons/benchmark-heavy.js +241 -0
- package/dungeons/benchmark-light.js +141 -0
- package/dungeons/big.js +10 -9
- package/dungeons/business.js +60 -12
- package/dungeons/complex.js +35 -1
- package/dungeons/copilot.js +383 -0
- package/dungeons/education.js +1005 -0
- package/dungeons/experiments.js +18 -4
- package/dungeons/fintech.js +976 -0
- package/dungeons/foobar.js +32 -0
- package/dungeons/food.js +988 -0
- package/dungeons/funnels.js +38 -1
- package/dungeons/gaming.js +26 -5
- package/dungeons/media.js +861 -270
- package/dungeons/mil.js +31 -3
- package/dungeons/mirror.js +33 -1
- package/dungeons/retention-cadence.js +211 -0
- package/dungeons/rpg.js +1178 -0
- package/dungeons/sanity.js +32 -2
- package/dungeons/sass.js +923 -0
- package/dungeons/scd.js +47 -1
- package/dungeons/simple.js +29 -14
- package/dungeons/social.js +928 -0
- package/dungeons/streaming.js +373 -0
- package/dungeons/strict-event-test.js +30 -0
- package/dungeons/student-teacher.js +19 -5
- package/dungeons/text-generation.js +120 -84
- package/dungeons/too-big-events.js +203 -0
- package/dungeons/{userAgent.js → user-agent.js} +23 -2
- package/entry.js +5 -4
- package/index.js +41 -54
- package/lib/core/config-validator.js +122 -7
- package/lib/core/context.js +7 -14
- package/lib/core/storage.js +57 -25
- package/lib/generators/adspend.js +12 -12
- package/lib/generators/events.js +6 -5
- package/lib/generators/funnels.js +32 -10
- package/lib/generators/product-lookup.js +262 -0
- package/lib/generators/product-names.js +195 -0
- package/lib/generators/profiles.js +3 -3
- package/lib/generators/scd.js +13 -3
- package/lib/generators/text.js +17 -4
- package/lib/orchestrators/mixpanel-sender.js +244 -204
- package/lib/orchestrators/user-loop.js +54 -16
- package/lib/templates/phrases.js +473 -16
- package/lib/templates/schema.d.ts +173 -0
- package/lib/templates/verbose-schema.js +140 -206
- package/lib/utils/chart.js +210 -0
- package/lib/utils/function-registry.js +285 -0
- package/lib/utils/json-evaluator.js +172 -0
- package/lib/utils/logger.js +34 -0
- package/lib/utils/utils.js +41 -4
- package/package.json +12 -21
- package/types.d.ts +15 -5
- package/dungeons/ai-chat-analytics-ed.js +0 -274
- package/dungeons/money2020-ed-also.js +0 -277
- package/dungeons/money2020-ed.js +0 -579
- package/lib/generators/text-bak-old.js +0 -1121
- package/lib/orchestrators/worker-manager.js +0 -203
- package/lib/templates/hooks-instructions.txt +0 -434
- package/lib/templates/phrases-bak.js +0 -925
- package/lib/templates/prompt (old).txt +0 -98
- package/lib/templates/schema-instructions.txt +0 -155
- package/lib/templates/scratch-dungeon-template.js +0 -116
- package/lib/templates/textQuickTest.js +0 -172
- package/lib/utils/ai.js +0 -120
- package/lib/utils/project.js +0 -166
package/README.md
CHANGED
|
@@ -87,6 +87,37 @@ Here's a breakdown of the CLI options you can use with `make-mp-data`:
|
|
|
87
87
|
- `--complex`: create a complex set models including groups, SCD, and lookup tables.
|
|
88
88
|
- `--simple`: create a simple dataset including events, and users
|
|
89
89
|
|
|
90
|
+
## 🎯 Hooks — Engineering Trends in Data
|
|
91
|
+
|
|
92
|
+
Hooks let you engineer deliberate, discoverable patterns into your generated data — things like "premium users convert 2x better" or "there was a service outage during days 40-47." A hook is a single transform function on your dungeon config:
|
|
93
|
+
|
|
94
|
+
```javascript
|
|
95
|
+
const config = {
|
|
96
|
+
// ...events, funnels, etc.
|
|
97
|
+
hook: function(record, type, meta) {
|
|
98
|
+
// Modify events based on type
|
|
99
|
+
if (type === "event" && record.event === "purchase") {
|
|
100
|
+
record.amount = record.amount * 2; // boost purchase amounts
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Use "everything" to correlate across a user's full event stream
|
|
104
|
+
if (type === "everything") {
|
|
105
|
+
const hasPurchase = record.some(e => e.event === "purchase");
|
|
106
|
+
for (const event of record) {
|
|
107
|
+
event.is_buyer = hasPurchase; // tag all events for this user
|
|
108
|
+
}
|
|
109
|
+
return record;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return record;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Hook types: `event`, `user`, `everything`, `funnel-pre`, `funnel-post`, `scd-pre`, `ad-spend`, `group`, `mirror`, `lookup`.
|
|
118
|
+
|
|
119
|
+
See `dungeons/harness/` for comprehensive examples with 8 hooks each across gaming, fintech, education, food delivery, media, social, and SaaS verticals.
|
|
120
|
+
|
|
90
121
|
## 📄 Examples
|
|
91
122
|
|
|
92
123
|
Check out the examples directory for sample data models:
|
package/dungeons/adspend.js
CHANGED
|
@@ -14,7 +14,7 @@ import dayjs from "dayjs";
|
|
|
14
14
|
import utc from "dayjs/plugin/utc.js";
|
|
15
15
|
dayjs.extend(utc);
|
|
16
16
|
import { uid, comma } from 'ak-tools';
|
|
17
|
-
import { pickAWinner, weighNumRange, date, integer } from
|
|
17
|
+
import { pickAWinner, weighNumRange, date, integer } from "../lib/utils/utils.js";
|
|
18
18
|
|
|
19
19
|
/** @type {import('../types').Dungeon} */
|
|
20
20
|
const config = {
|
|
@@ -87,6 +87,40 @@ const config = {
|
|
|
87
87
|
groupProps: {},
|
|
88
88
|
lookupTables: [],
|
|
89
89
|
hook: function (record, type, meta) {
|
|
90
|
+
// user hook: segment users into tiers based on their lucky number
|
|
91
|
+
if (type === "user") {
|
|
92
|
+
if (record.luckyNumber > 300) {
|
|
93
|
+
record.tier = "gold";
|
|
94
|
+
} else if (record.luckyNumber > 150) {
|
|
95
|
+
record.tier = "silver";
|
|
96
|
+
} else {
|
|
97
|
+
record.tier = "bronze";
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// event hook: gold tier users get a "premium" color override 20% of the time
|
|
102
|
+
if (type === "event") {
|
|
103
|
+
if (record.color === "violet" || record.color === "indigo") {
|
|
104
|
+
record.is_rare_color = true;
|
|
105
|
+
record.number = (record.number || 0) * 2;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// everything hook: users with many events get a bonus "milestone" event
|
|
110
|
+
if (type === "everything") {
|
|
111
|
+
if (record.length > 50) {
|
|
112
|
+
const lastEvent = record[record.length - 1];
|
|
113
|
+
record.push({
|
|
114
|
+
event: "milestone reached",
|
|
115
|
+
time: lastEvent.time,
|
|
116
|
+
user_id: lastEvent.user_id,
|
|
117
|
+
milestone: record.length,
|
|
118
|
+
color: "gold",
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return record;
|
|
122
|
+
}
|
|
123
|
+
|
|
90
124
|
return record;
|
|
91
125
|
}
|
|
92
126
|
};
|
package/dungeons/anon.js
CHANGED
|
@@ -14,7 +14,7 @@ import dayjs from "dayjs";
|
|
|
14
14
|
import utc from "dayjs/plugin/utc.js";
|
|
15
15
|
dayjs.extend(utc);
|
|
16
16
|
import { uid, comma } from 'ak-tools';
|
|
17
|
-
import { pickAWinner, weighNumRange, date, integer } from
|
|
17
|
+
import { pickAWinner, weighNumRange, date, integer } from "../lib/utils/utils.js";
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -95,6 +95,30 @@ const config = {
|
|
|
95
95
|
groupProps: {},
|
|
96
96
|
lookupTables: [],
|
|
97
97
|
hook: function (record, type, meta) {
|
|
98
|
+
// user hook: assign engagement tier based on lucky number
|
|
99
|
+
if (type === "user") {
|
|
100
|
+
record.engagement_tier = record.luckyNumber > 250 ? "high" : "low";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// event hook: weight-1 events ("yak") are treated as error/rare signals
|
|
104
|
+
if (type === "event") {
|
|
105
|
+
if (record.event === "yak") {
|
|
106
|
+
record.is_error = true;
|
|
107
|
+
}
|
|
108
|
+
if (record.event === "foo") {
|
|
109
|
+
record.priority = "high";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// everything hook: low-activity anonymous users churn — keep only first 60% of events
|
|
114
|
+
if (type === "everything") {
|
|
115
|
+
if (record.length < 8) {
|
|
116
|
+
const cutoff = Math.ceil(record.length * 0.6);
|
|
117
|
+
return record.slice(0, cutoff);
|
|
118
|
+
}
|
|
119
|
+
return record;
|
|
120
|
+
}
|
|
121
|
+
|
|
98
122
|
return record;
|
|
99
123
|
}
|
|
100
124
|
};
|
|
@@ -0,0 +1,201 @@
|
|
|
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
|
+
import Chance from 'chance';
|
|
10
|
+
let chance = new Chance();
|
|
11
|
+
import dayjs from "dayjs";
|
|
12
|
+
import utc from "dayjs/plugin/utc.js";
|
|
13
|
+
dayjs.extend(utc);
|
|
14
|
+
import { uid, comma } from 'ak-tools';
|
|
15
|
+
import { pickAWinner, weighNumRange, date, integer, weighChoices } from "../lib/utils/utils.js";
|
|
16
|
+
|
|
17
|
+
const videoCategories = ["funny", "educational", "inspirational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"];
|
|
18
|
+
const spiritAnimals = ["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"];
|
|
19
|
+
|
|
20
|
+
/** @type {import('../types.js').Dungeon} */
|
|
21
|
+
const config = {
|
|
22
|
+
// token: "",
|
|
23
|
+
seed: "test array of objects lookup",
|
|
24
|
+
name: "array-of-object-lookup",
|
|
25
|
+
numDays: 60, //how many days worth1 of data
|
|
26
|
+
numEvents: 100_000, //how many events
|
|
27
|
+
numUsers: 1_000, //how many users
|
|
28
|
+
format: 'json', //csv or json
|
|
29
|
+
region: "US",
|
|
30
|
+
hasAnonIds: true, //if true, anonymousIds are created for each user
|
|
31
|
+
hasSessionIds: true, //if true, hasSessionIds are created for each user
|
|
32
|
+
hasAdSpend: false,
|
|
33
|
+
makeChart: false,
|
|
34
|
+
hasLocation: true,
|
|
35
|
+
hasAndroidDevices: false,
|
|
36
|
+
hasIOSDevices: false,
|
|
37
|
+
hasDesktopDevices: true,
|
|
38
|
+
hasBrowser: true,
|
|
39
|
+
hasCampaigns: false,
|
|
40
|
+
isAnonymous: false,
|
|
41
|
+
alsoInferFunnels: true,
|
|
42
|
+
concurrency: 1,
|
|
43
|
+
batchSize: 250_000,
|
|
44
|
+
writeToDisk: false,
|
|
45
|
+
events: [
|
|
46
|
+
{
|
|
47
|
+
event: "checkout",
|
|
48
|
+
weight: 2,
|
|
49
|
+
properties: {
|
|
50
|
+
currency: pickAWinner(["USD", "CAD", "EUR", "BTC", "ETH", "JPY"], 0),
|
|
51
|
+
coupon: weighChoices(["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"]),
|
|
52
|
+
cart: makeProducts()
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
event: "add to cart",
|
|
57
|
+
weight: 4,
|
|
58
|
+
properties: {
|
|
59
|
+
item: makeProducts(1),
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
event: "view item",
|
|
64
|
+
weight: 8,
|
|
65
|
+
properties: {
|
|
66
|
+
item: makeProducts(1)
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
event: "save item",
|
|
71
|
+
weight: 5,
|
|
72
|
+
properties: {
|
|
73
|
+
item: makeProducts(1),
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
funnels: [ ],
|
|
78
|
+
superProps: {
|
|
79
|
+
theme: pickAWinner(["light", "dark", "custom", "light", "dark"]),
|
|
80
|
+
},
|
|
81
|
+
/*
|
|
82
|
+
user properties work the same as event properties
|
|
83
|
+
each key should be an array or function reference
|
|
84
|
+
*/
|
|
85
|
+
userProps: {
|
|
86
|
+
// title: chance.profession.bind(chance),
|
|
87
|
+
// luckyNumber: weighNumRange(1, 500, .3),
|
|
88
|
+
spiritAnimal: spiritAnimals
|
|
89
|
+
},
|
|
90
|
+
scdProps: {},
|
|
91
|
+
mirrorProps: {},
|
|
92
|
+
/*
|
|
93
|
+
for group analytics keys, we need an array of arrays [[],[],[]]
|
|
94
|
+
each pair represents a group_key and the number of profiles for that key
|
|
95
|
+
*/
|
|
96
|
+
groupKeys: [],
|
|
97
|
+
groupProps: {},
|
|
98
|
+
lookupTables: [{
|
|
99
|
+
key: "product_id",
|
|
100
|
+
entries: 1000,
|
|
101
|
+
attributes: {
|
|
102
|
+
amount: weighNumRange(1, 1000, .3),
|
|
103
|
+
quantity: weighNumRange(1, 10, .3),
|
|
104
|
+
featured: flip,
|
|
105
|
+
category: ["electronics", "books", "clothing", "home", "garden", "toys", "sports", "automotive", "beauty", "health", "grocery", "jewelry", "shoes", "tools", "office supplies"],
|
|
106
|
+
descriptor: ["brand new", "open box", "refurbished", "used", "like new", "vintage", "antique", "collectible"]
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
}],
|
|
111
|
+
hook: function (record, type, meta) {
|
|
112
|
+
|
|
113
|
+
const NOW = dayjs();
|
|
114
|
+
|
|
115
|
+
if (type === "event") {
|
|
116
|
+
// Pattern 1: Checkouts with coupons get a discount_applied flag and adjusted total
|
|
117
|
+
if (record.event === "checkout" && record.coupon && record.coupon !== "none") {
|
|
118
|
+
record.discount_applied = true;
|
|
119
|
+
const pctMatch = record.coupon.match(/(\d+)%/);
|
|
120
|
+
if (pctMatch) {
|
|
121
|
+
record.discount_percent = parseInt(pctMatch[1]);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Pattern 2: "save item" events on weekends are tagged as wishlist behavior
|
|
126
|
+
if (record.event === "save item") {
|
|
127
|
+
const dow = dayjs(record.time).day();
|
|
128
|
+
if (dow === 0 || dow === 6) {
|
|
129
|
+
record.save_context = "weekend_browse";
|
|
130
|
+
} else {
|
|
131
|
+
record.save_context = "weekday_intent";
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (type === "everything") {
|
|
137
|
+
// Pattern 3: Users who view 5+ items but never checkout are tagged as window shoppers
|
|
138
|
+
const views = record.filter(e => e.event === "view item").length;
|
|
139
|
+
const checkouts = record.filter(e => e.event === "checkout").length;
|
|
140
|
+
if (views >= 5 && checkouts === 0) {
|
|
141
|
+
for (const e of record) {
|
|
142
|
+
e.user_segment = "window_shopper";
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return record;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
function makeProducts(maxItems = 5) {
|
|
152
|
+
return function () {
|
|
153
|
+
const categories = ["electronics", "books", "clothing", "home", "garden", "toys", "sports", "automotive", "beauty", "health", "grocery", "jewelry", "shoes", "tools", "office supplies"];
|
|
154
|
+
const descriptors = ["brand new", "open box", "refurbished", "used", "like new", "vintage", "antique", "collectible"];
|
|
155
|
+
const suffix = ["item", "product", "good", "merchandise", "thing", "object", "widget", "gadget", "device", "apparatus", "contraption", "instrument", "tool", "implement", "utensil", "appliance", "machine", "equipment", "gear", "kit", "set", "package"];
|
|
156
|
+
const assetPreview = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];
|
|
157
|
+
const data = [];
|
|
158
|
+
const numOfItems = integer(1, maxItems);
|
|
159
|
+
|
|
160
|
+
for (var i = 0; i < numOfItems; i++) {
|
|
161
|
+
const category = chance.pickone(categories);
|
|
162
|
+
const descriptor = chance.pickone(descriptors);
|
|
163
|
+
const suffixWord = chance.pickone(suffix);
|
|
164
|
+
const slug = `${descriptor.replace(/\s+/g, '-').toLowerCase()}-${suffixWord.replace(/\s+/g, '-').toLowerCase()}`;
|
|
165
|
+
const asset = chance.pickone(assetPreview);
|
|
166
|
+
|
|
167
|
+
// const product_id = chance.guid();
|
|
168
|
+
const price = integer(1, 100);
|
|
169
|
+
const quantity = integer(1, 5);
|
|
170
|
+
const product_id = integer(1, 1_000);
|
|
171
|
+
|
|
172
|
+
const item = {
|
|
173
|
+
product_id: product_id,
|
|
174
|
+
product_url: `https://example.com/assets/${product_id}`,
|
|
175
|
+
// sku: integer(11111, 99999),
|
|
176
|
+
// amount: price,
|
|
177
|
+
// quantity: quantity,
|
|
178
|
+
// total_value: price * quantity,
|
|
179
|
+
// featured: chance.pickone([true, false, false]),
|
|
180
|
+
// category: category,
|
|
181
|
+
// descriptor: descriptor,
|
|
182
|
+
// slug: slug,
|
|
183
|
+
|
|
184
|
+
// assetType: asset
|
|
185
|
+
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
data.push(item);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return () => [data];
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
function flip(likelihood = 50) {
|
|
197
|
+
return chance.bool({ likelihood });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
export default config;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Benchmark Dungeon Configuration
|
|
3
|
+
* Generates one million events across 10,000 users
|
|
4
|
+
* ensure we have multiple property types and distributions
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
import Chance from 'chance';
|
|
11
|
+
let chance = new Chance();
|
|
12
|
+
import dayjs from "dayjs";
|
|
13
|
+
import utc from "dayjs/plugin/utc.js";
|
|
14
|
+
dayjs.extend(utc);
|
|
15
|
+
import { uid, comma } from 'ak-tools';
|
|
16
|
+
import { pickAWinner, weighNumRange, date, integer, weighChoices } from "../lib/utils/utils.js";
|
|
17
|
+
import { createTextGenerator } from '../lib/generators/text.js';
|
|
18
|
+
|
|
19
|
+
// list of strings use case
|
|
20
|
+
function buildListOfFeatures() {
|
|
21
|
+
const fullFeatureList = ["beta flags", "alpha flags", "custom themes", "API access", "webhooks", "data export", "data import", "external integrations", "private cloud", "multi factor auth", "audit logs", "custom domain", "personalized landing"];
|
|
22
|
+
const numFeatures = integer(3, 7);
|
|
23
|
+
const selectedFeatures = chance.pickset(fullFeatureList, numFeatures);
|
|
24
|
+
return [selectedFeatures];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// object use case
|
|
28
|
+
function buildLocalConfig() {
|
|
29
|
+
const allPossibleConfigs = {
|
|
30
|
+
"theme": pickAWinner(["light", "dark", "custom"]),
|
|
31
|
+
"notifications": pickAWinner(["all", "mentions", "none"]),
|
|
32
|
+
"itemsPerPage": pickAWinner([10, 25, 50, 100]),
|
|
33
|
+
"language": pickAWinner(["en", "es", "fr", "de", "zh", "jp", "ru"]),
|
|
34
|
+
"timezone": pickAWinner(["UTC", "PST", "EST", "CST", "MST", "GMT", "CET", "IST", "JST", "AEST"]),
|
|
35
|
+
"privacyLevel": pickAWinner(["public", "friends only", "private"]),
|
|
36
|
+
"dataSharing": [true, false],
|
|
37
|
+
"autoSave": [true, false],
|
|
38
|
+
"fontSize": ["small", "medium", "large"],
|
|
39
|
+
"layout": ["grid", "list", "compact"]
|
|
40
|
+
};
|
|
41
|
+
const config = {};
|
|
42
|
+
|
|
43
|
+
for (const [key, values] of Object.entries(allPossibleConfigs)) {
|
|
44
|
+
let value;
|
|
45
|
+
if (typeof values === 'function') {
|
|
46
|
+
value = values();
|
|
47
|
+
} else if (Array.isArray(values)) {
|
|
48
|
+
value = values;
|
|
49
|
+
} else {
|
|
50
|
+
value = values;
|
|
51
|
+
}
|
|
52
|
+
config[key] = chance.pickone(value);
|
|
53
|
+
}
|
|
54
|
+
return config;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// array of object use case
|
|
59
|
+
function buildCart() {
|
|
60
|
+
const allPossibleItems = [
|
|
61
|
+
{ itemId: uid(), name: "widget foo", price: 9.99, category: "Gadgets", isPremium: false, stock: 150 },
|
|
62
|
+
{ itemId: uid(), name: "poker bar", price: 14.99, category: "Gizmos", isPremium: true, stock: 100 },
|
|
63
|
+
{ itemId: uid(), name: "limited baz", price: 4.99, category: "Toys", isPremium: false, stock: 200 },
|
|
64
|
+
{ itemId: uid(), name: "foolish qux", price: 19.99, category: "Tools", isPremium: false, stock: 50 },
|
|
65
|
+
{ itemId: uid(), name: "topical mux", price: 29.99, category: "Components", isPremium: true, stock: 75 },
|
|
66
|
+
{ itemId: uid(), name: "random garply", price: 24.99, category: "Gadgets", isPremium: false, stock: 30 },
|
|
67
|
+
{ itemId: uid(), name: "helpful waldo", price: 39.99, category: "Gizmos", isPremium: true, stock: 20 },
|
|
68
|
+
{ itemId: uid(), name: "hillarious defcon", price: 11.99, category: "Toys", isPremium: false, stock: 120 },
|
|
69
|
+
{ itemId: uid(), name: "final radiator", price: 7.99, category: "Tools", isPremium: false, stock: 80 },
|
|
70
|
+
{ itemId: uid(), name: "leaning wholesome", price: 49.99, category: "Components", isPremium: true, stock: 10 },
|
|
71
|
+
{ itemId: uid(), name: "whose friends", price: 17.99, category: "Gadgets", isPremium: false, stock: 60 },
|
|
72
|
+
];
|
|
73
|
+
const numItems = integer(1, 20);
|
|
74
|
+
const selectedItems = chance.pickset(allPossibleItems, numItems);
|
|
75
|
+
// add quantity to each item
|
|
76
|
+
for (const item of selectedItems) {
|
|
77
|
+
item.quantity = integer(1, 8);
|
|
78
|
+
item.totalPrice = item.price * item.quantity;
|
|
79
|
+
}
|
|
80
|
+
return [...selectedItems];
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
const commentGenerator = createTextGenerator({
|
|
87
|
+
authenticityLevel: 0.8,
|
|
88
|
+
enableDeduplication: true,
|
|
89
|
+
includeMetadata: false,
|
|
90
|
+
style: "comments",
|
|
91
|
+
formality: "casual",
|
|
92
|
+
mixedSentiment: true,
|
|
93
|
+
keywords: {
|
|
94
|
+
"brands": ["Nike", "Adidas", "Puma", "Reebok", "Under Armour", "New Balance", "Asics", "Skechers", "Converse", "Vans"],
|
|
95
|
+
"categories": ["shoes", "sneakers", "running shoes", "basketball shoes", "casual shoes", "formal shoes", "boots", "sandals", "heels", "flats"],
|
|
96
|
+
"credibility": ["verified purchase", "top reviewer", "frequent buyer", "long-time customer", "new customer"],
|
|
97
|
+
"features": ["comfort", "durability", "style", "fit", "value for money", "design", "color options", "material quality", "breathability", "support"],
|
|
98
|
+
"issues": ["size runs small", "poor arch support", "slippery sole", "uncomfortable", "not true to color", "weak laces", "easily scuffed", "bad odor", "heavy weight", "limited stock"],
|
|
99
|
+
},
|
|
100
|
+
typos: false,
|
|
101
|
+
min: 20,
|
|
102
|
+
max: 255,
|
|
103
|
+
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
/** @type {import('../types.js').Dungeon} */
|
|
109
|
+
const config = {
|
|
110
|
+
// token: "",
|
|
111
|
+
name: "300k-Events-Heavy",
|
|
112
|
+
format: 'json', //csv or json
|
|
113
|
+
seed: "one million events",
|
|
114
|
+
numDays: 92, //how many days worth of data
|
|
115
|
+
numEvents: 300_000, //how many events
|
|
116
|
+
numUsers: 10_000, //how many users
|
|
117
|
+
strictEventCount: true,
|
|
118
|
+
|
|
119
|
+
region: "US",
|
|
120
|
+
hasAnonIds: true, //if true, anonymousIds are created for each user
|
|
121
|
+
hasSessionIds: true, //if true, hasSessionIds are created for each user
|
|
122
|
+
hasAdSpend: false,
|
|
123
|
+
makeChart: false,
|
|
124
|
+
hasLocation: true,
|
|
125
|
+
hasAndroidDevices: true,
|
|
126
|
+
hasIOSDevices: true,
|
|
127
|
+
hasDesktopDevices: true,
|
|
128
|
+
hasBrowser: true,
|
|
129
|
+
hasCampaigns: true,
|
|
130
|
+
isAnonymous: false,
|
|
131
|
+
alsoInferFunnels: true,
|
|
132
|
+
// concurrency automatically set to 1 when strictEventCount is enabled
|
|
133
|
+
writeToDisk: false,
|
|
134
|
+
batchSize: 2_500_000,
|
|
135
|
+
|
|
136
|
+
events: [
|
|
137
|
+
{
|
|
138
|
+
event: "Page View",
|
|
139
|
+
weight: 50,
|
|
140
|
+
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
event: "Product View",
|
|
144
|
+
weight: 30,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
event: "Add to Cart",
|
|
148
|
+
weight: 10,
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
event: "Checkout Started",
|
|
152
|
+
weight: 5,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
event: "Purchase",
|
|
156
|
+
weight: 1,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
event: "Product Review",
|
|
160
|
+
weight: 3,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
event: "Search",
|
|
164
|
+
weight: 17,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
event: "Browse",
|
|
168
|
+
weight: 25,
|
|
169
|
+
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
event: "Save for Later",
|
|
173
|
+
weight: 4,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
event: "Remove from Cart",
|
|
177
|
+
weight: 2,
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
event: "Empty Cart",
|
|
181
|
+
weight: 4,
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
funnels: [
|
|
185
|
+
{
|
|
186
|
+
"name": "Purchase Funnel",
|
|
187
|
+
"sequence": [
|
|
188
|
+
"Page View",
|
|
189
|
+
"Product View",
|
|
190
|
+
"Add to Cart",
|
|
191
|
+
"Checkout Started",
|
|
192
|
+
"Purchase"
|
|
193
|
+
],
|
|
194
|
+
requireRepeats: true,
|
|
195
|
+
"conversionRate": 30,
|
|
196
|
+
"order": "fixed",
|
|
197
|
+
"weight": 1,
|
|
198
|
+
"isFirstFunnel": false,
|
|
199
|
+
"timeToConvert": 5,
|
|
200
|
+
"experiment": true,
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
superProps: {
|
|
204
|
+
"theme (string)": pickAWinner(["light", "dark", "custom", "light", "dark"]),
|
|
205
|
+
"latency (number)": weighNumRange(20, 600, 0.7),
|
|
206
|
+
"beta user (boolean)": [true, false, false, false],
|
|
207
|
+
"birthdate (date)": date(30000, true, 'YYYY-MM-DD'),
|
|
208
|
+
"features (list)": buildListOfFeatures,
|
|
209
|
+
"config (object)": buildLocalConfig,
|
|
210
|
+
"cart (array of objects)": buildCart,
|
|
211
|
+
"comment (text)": commentGenerator,
|
|
212
|
+
},
|
|
213
|
+
/*
|
|
214
|
+
user properties work the same as event properties
|
|
215
|
+
each key should be an array or function reference
|
|
216
|
+
*/
|
|
217
|
+
userProps: {
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
},
|
|
221
|
+
scdProps: {},
|
|
222
|
+
mirrorProps: {},
|
|
223
|
+
|
|
224
|
+
/*
|
|
225
|
+
for group analytics keys, we need an array of arrays [[],[],[]]
|
|
226
|
+
each pair represents a group_key and the number of profiles for that key
|
|
227
|
+
*/
|
|
228
|
+
groupKeys: [],
|
|
229
|
+
groupProps: {},
|
|
230
|
+
lookupTables: [],
|
|
231
|
+
hook: function (record, type, meta) {
|
|
232
|
+
// if (type === "everything") {
|
|
233
|
+
// debugger;
|
|
234
|
+
// }
|
|
235
|
+
return record;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
export default config;
|