fakedata-python 2.0.0__tar.gz → 2.0.2__tar.gz
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.
- fakedata_python-2.0.2/PKG-INFO +434 -0
- fakedata_python-2.0.2/README.md +422 -0
- fakedata_python-2.0.2/fakedata/cli.py +133 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/modules/data.py +48 -11
- fakedata_python-2.0.2/fakedata_python.egg-info/PKG-INFO +434 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata_python.egg-info/SOURCES.txt +2 -0
- fakedata_python-2.0.2/fakedata_python.egg-info/entry_points.txt +2 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/pyproject.toml +5 -2
- fakedata_python-2.0.0/PKG-INFO +0 -179
- fakedata_python-2.0.0/README.md +0 -167
- fakedata_python-2.0.0/fakedata_python.egg-info/PKG-INFO +0 -179
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/__init__.py +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/core.py +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/cardtype.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/companies.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/countries.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/devices.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/domain.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/email.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/first.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/healthcare.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/hobbies.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/industries.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/job_categories.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/job_titles.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/last.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/locales.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/middle.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/occupation.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/salary_ranges.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/shortformstate.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/state.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/states.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/street.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/helpers/universities.json +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/modules/__init__.py +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata/test_python.py +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata_python.egg-info/dependency_links.txt +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/fakedata_python.egg-info/top_level.txt +0 -0
- {fakedata_python-2.0.0 → fakedata_python-2.0.2}/setup.cfg +0 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fakedata-python
|
|
3
|
+
Version: 2.0.2
|
|
4
|
+
Summary: The fakedata package generates realistic synthetic user profiles for machine learning, deep learning, data analysis, and data science workflows.
|
|
5
|
+
Author-email: abhay557 <contact@abhaymourya.in>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/abhay557/fakedata
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.7
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# fakedata
|
|
14
|
+
|
|
15
|
+
[](https://www.npmjs.com/package/@abhay557/fakedata)
|
|
16
|
+
[](https://pypi.org/project/fakedata-python/)
|
|
17
|
+
[](https://opensource.org/licenses/MIT)
|
|
18
|
+
[](https://colab.research.google.com/drive/16N9x1YCOVVvIF8rl7IQxKRkK4en_g3Gi?usp=sharing)
|
|
19
|
+
[](https://pepy.tech/projects/fakedata-python)
|
|
20
|
+
|
|
21
|
+
A high-performance, **zero-dependency** synthetic data generation engine, available for both **Node.js** and **Python**. Designed specifically for machine learning, data science, and analytics workflows, providing 100% data parity across platforms.
|
|
22
|
+
|
|
23
|
+
## Overview
|
|
24
|
+
|
|
25
|
+
`fakedata` has been completely rebuilt from the ground up to serve as an **ML-ready synthetic data engine**. It generates deeply interconnected user profiles with **112 flat columns across 13 domains** (Health, Financial, Employment, Digital Footprint, etc.), making it the perfect tool for training models, benchmarking pipelines, or simulating realistic databases.
|
|
26
|
+
|
|
27
|
+
### Machine Learning Power Features:
|
|
28
|
+
- **Behavioral Personas**: Orchestrate correlations through 6 distinct personas (e.g., Executive, Student, Tech Pro) to ensure realistic socio-economic patterns.
|
|
29
|
+
- **Seed Reproducibility**: Generate byte-for-byte identical datasets across runs (and languages!) using `seed`.
|
|
30
|
+
- **Schema Overrides**: Force specific distributions (e.g., age ranges, income brackets, genders) using `schema`.
|
|
31
|
+
- **Locale-Aware Generation**: Support for 8 culture-specific name sets and phone formats (`en`, `in`, `jp`, `kr`, `de`, `br`, `ar`, `fr`).
|
|
32
|
+
- **Missing Data Simulation**: Automatically inject realistic nulls using `missing_rate` to test your data imputation pipelines.
|
|
33
|
+
- **Anomaly Injection**: Inject fraud/outlier profiles (e.g., impossible geography, credit fraud, income spikes) using `anomaly_rate`.
|
|
34
|
+
- **Time-Series Data**: Generate chronological activity logs (logins, page views, purchases) per user for behavioral modeling.
|
|
35
|
+
- **Pipeline Ready**: Export directly to CSV, JSON, or Flat objects (perfect for `pandas.DataFrame`).
|
|
36
|
+
- **CLI Tool**: Generate and export datasets directly from your terminal — no scripting required.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Python Implementation
|
|
41
|
+
|
|
42
|
+
### Installation
|
|
43
|
+
```bash
|
|
44
|
+
pip install fakedata-python
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Quick Start
|
|
48
|
+
```python
|
|
49
|
+
import fakedata.data as data
|
|
50
|
+
import pandas as pd
|
|
51
|
+
|
|
52
|
+
# Generate 10,000 highly correlated users deterministically
|
|
53
|
+
users = data.users(10000, {"seed": 42})
|
|
54
|
+
|
|
55
|
+
# Or export directly to a Pandas DataFrame
|
|
56
|
+
df = pd.DataFrame(data.users_flat(10000, {"seed": 42}))
|
|
57
|
+
print(df.head())
|
|
58
|
+
|
|
59
|
+
# Create time-series activity data
|
|
60
|
+
ts = data.user_time_series({"days": 30, "events_per_day": 8})
|
|
61
|
+
print(f"Generated {len(ts['activity'])} events for {ts['user']['fullName']}")
|
|
62
|
+
```
|
|
63
|
+
## Node.js / TypeScript Implementation
|
|
64
|
+
|
|
65
|
+
### Installation
|
|
66
|
+
```bash
|
|
67
|
+
npm install @abhay557/fakedata
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Quick Start
|
|
71
|
+
```javascript
|
|
72
|
+
const { data } = require('@abhay557/fakedata');
|
|
73
|
+
|
|
74
|
+
// Generate deterministic users with a 5% missing data rate (null injection)
|
|
75
|
+
const users = data.users(1000, { seed: 42, missing_rate: 0.05 });
|
|
76
|
+
|
|
77
|
+
// Export directly to CSV format
|
|
78
|
+
const csvString = data.usersToCSV(1000, { seed: 42 });
|
|
79
|
+
|
|
80
|
+
// Time-series activity data
|
|
81
|
+
const ts = data.userTimeSeries({ days: 30, eventsPerDay: 8 });
|
|
82
|
+
console.log(`Generated ${ts.activity.length} events for ${ts.user.fullName}`);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## CLI — Command Line Interface
|
|
88
|
+
|
|
89
|
+
After installing, use `fakedata` directly from your terminal. No scripts needed!
|
|
90
|
+
|
|
91
|
+
### Node.js (global install)
|
|
92
|
+
```bash
|
|
93
|
+
npm install -g @abhay557/fakedata
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Python (global install)
|
|
97
|
+
```bash
|
|
98
|
+
pip install fakedata-python
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### CLI Commands
|
|
102
|
+
|
|
103
|
+
| Command | Description |
|
|
104
|
+
|:---|:---|
|
|
105
|
+
| `fakedata generate` | Generate synthetic user data |
|
|
106
|
+
| `fakedata preview` | Print a single user profile to the console |
|
|
107
|
+
| `fakedata help` | Show all available options |
|
|
108
|
+
|
|
109
|
+
### CLI Options
|
|
110
|
+
|
|
111
|
+
| Flag | Default | Description |
|
|
112
|
+
|:---|:---|:---|
|
|
113
|
+
| `-n`, `--count` | `10` | Number of users to generate |
|
|
114
|
+
| `-f`, `--format` | `json` | Output format: `json` \| `csv` \| `flat` |
|
|
115
|
+
| `-o`, `--output` | stdout | Output file path |
|
|
116
|
+
| `-s`, `--seed` | none | Random seed for reproducibility |
|
|
117
|
+
| `-l`, `--locale` | `en` | Locale: `en` \| `in` \| `jp` \| `kr` \| `de` \| `br` \| `ar` \| `fr` |
|
|
118
|
+
| `-a`, `--anomaly-rate` | `0` | Fraction of anomalous users (0–1) |
|
|
119
|
+
| `-m`, `--missing-rate` | `0` | Fraction of null fields (0–1) |
|
|
120
|
+
| `-t`, `--timeseries` | — | Include time-series activity logs |
|
|
121
|
+
| `--days` | `30` | Days of activity for time-series |
|
|
122
|
+
| `--pretty` | — | Pretty-print JSON output |
|
|
123
|
+
|
|
124
|
+
### Examples
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Generate 1000 users and save as CSV
|
|
128
|
+
fakedata generate -n 1000 -f csv -o dataset.csv
|
|
129
|
+
|
|
130
|
+
# Generate 500 deterministic Indian users
|
|
131
|
+
fakedata generate -n 500 -l in --seed 42 -o india.json
|
|
132
|
+
|
|
133
|
+
# Fraud detection dataset with 5% anomalies
|
|
134
|
+
fakedata generate -n 10000 -a 0.05 -f csv -o fraud_data.csv
|
|
135
|
+
|
|
136
|
+
# Preview a single user in the console
|
|
137
|
+
fakedata preview
|
|
138
|
+
|
|
139
|
+
# Time-series activity logs for 100 users
|
|
140
|
+
fakedata generate -n 100 --timeseries --days 60 -o activity.json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
### sample output - one user
|
|
145
|
+
```fakedata.data.user()```
|
|
146
|
+
```fakedata.data.user(n) // set n = 100```
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
"id": "4612",
|
|
150
|
+
"fullName": "Damaris Carlo Ebervale",
|
|
151
|
+
"firstName": "Damaris",
|
|
152
|
+
"lastName": "Ebervale",
|
|
153
|
+
"middleName": "Carlo",
|
|
154
|
+
"age": 31,
|
|
155
|
+
"gender": "non-binary",
|
|
156
|
+
"email": "damaris.ebervale@liberomail.com",
|
|
157
|
+
"phone": "+1 7469125114",
|
|
158
|
+
"username": "damaris_4612",
|
|
159
|
+
"password": "UQ!VZr0cLUD9",
|
|
160
|
+
"birthDate": "1995-07-19",
|
|
161
|
+
"bloodGroup": "+B",
|
|
162
|
+
"height": 185,
|
|
163
|
+
"weight": 60,
|
|
164
|
+
"domain": "damarisebervale.vg",
|
|
165
|
+
"ip": "48.50.80.113",
|
|
166
|
+
"macaddress": "33:2F:39:EE:3B:1E",
|
|
167
|
+
"address": {
|
|
168
|
+
"street": "3623 Chateau Lane",
|
|
169
|
+
"city": "Kilgore",
|
|
170
|
+
"state": "Texas",
|
|
171
|
+
"country": "Sierra Leone",
|
|
172
|
+
"countryCode": "SL",
|
|
173
|
+
"zipCode": 36434,
|
|
174
|
+
"coordinates": {
|
|
175
|
+
"latitude": "-68.324385",
|
|
176
|
+
"longitude": "55.859967"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"demographics": {
|
|
180
|
+
"ethnicity": "Hispanic",
|
|
181
|
+
"nationality": "South Korean",
|
|
182
|
+
"language": {
|
|
183
|
+
"primary": "Arabic",
|
|
184
|
+
"secondary": "Turkish"
|
|
185
|
+
},
|
|
186
|
+
"relationshipStatus": "dating"
|
|
187
|
+
},
|
|
188
|
+
"education": {
|
|
189
|
+
"level": "Bachelor's",
|
|
190
|
+
"field": "Computer Science",
|
|
191
|
+
"institution": "Agricultural University of Lublin",
|
|
192
|
+
"institutionCountry": "Poland",
|
|
193
|
+
"gpa": 2.79,
|
|
194
|
+
"graduationYear": 2017,
|
|
195
|
+
"studentDebt": 64117
|
|
196
|
+
},
|
|
197
|
+
"employment": {
|
|
198
|
+
"status": "self-employed",
|
|
199
|
+
"company": "China CITIC Bank",
|
|
200
|
+
"companySize": "enterprise",
|
|
201
|
+
"industry": "Banking",
|
|
202
|
+
"jobTitle": "\"ORACLE DBA\"",
|
|
203
|
+
"jobCategory": "Network Engineering",
|
|
204
|
+
"yearsExperience": 10,
|
|
205
|
+
"workMode": "onsite",
|
|
206
|
+
"workHoursPerWeek": 36,
|
|
207
|
+
"jobSatisfaction": 6
|
|
208
|
+
},
|
|
209
|
+
"financial": {
|
|
210
|
+
"annualIncome": 21600,
|
|
211
|
+
"creditScore": 464,
|
|
212
|
+
"savings": 1680,
|
|
213
|
+
"monthlyExpenses": 1309,
|
|
214
|
+
"debtToIncome": 3.12,
|
|
215
|
+
"taxBracket": "12%",
|
|
216
|
+
"investmentStyle": "moderate",
|
|
217
|
+
"homeOwnership": "own"
|
|
218
|
+
},
|
|
219
|
+
"health": {
|
|
220
|
+
"bmi": 17.5,
|
|
221
|
+
"bmiCategory": "underweight",
|
|
222
|
+
"bloodPressure": {
|
|
223
|
+
"systolic": 100,
|
|
224
|
+
"diastolic": 82
|
|
225
|
+
},
|
|
226
|
+
"exerciseFrequency": "3-4 times/week",
|
|
227
|
+
"smoking": "never",
|
|
228
|
+
"alcohol": "never",
|
|
229
|
+
"sleepHoursPerNight": 8.3,
|
|
230
|
+
"sleepQuality": "poor",
|
|
231
|
+
"diet": "mediterranean",
|
|
232
|
+
"medicalCondition": "None",
|
|
233
|
+
"insuranceProvider": "UnitedHealthcare",
|
|
234
|
+
"medications": [
|
|
235
|
+
"Lisinopril"
|
|
236
|
+
],
|
|
237
|
+
"lastCheckupMonthsAgo": 11,
|
|
238
|
+
"hasDisability": false,
|
|
239
|
+
"mentalHealth": "poor",
|
|
240
|
+
"vaccination": "partially vaccinated"
|
|
241
|
+
},
|
|
242
|
+
"social": {
|
|
243
|
+
"socialMedia": {
|
|
244
|
+
"platforms": [
|
|
245
|
+
"Pinterest",
|
|
246
|
+
"Twitter/X",
|
|
247
|
+
"Reddit",
|
|
248
|
+
"Instagram"
|
|
249
|
+
],
|
|
250
|
+
"screenTimeHoursPerDay": 3.8,
|
|
251
|
+
"preferredContent": "video"
|
|
252
|
+
},
|
|
253
|
+
"shopping": {
|
|
254
|
+
"frequency": "weekly",
|
|
255
|
+
"preferredCategories": [
|
|
256
|
+
"toys & games",
|
|
257
|
+
"books"
|
|
258
|
+
],
|
|
259
|
+
"monthlyOnlineSpending": 175
|
|
260
|
+
},
|
|
261
|
+
"newsSource": "social media",
|
|
262
|
+
"travelFrequency": "weekly",
|
|
263
|
+
"volunteers": false,
|
|
264
|
+
"pet": "multiple"
|
|
265
|
+
},
|
|
266
|
+
"digitalFootprint": {
|
|
267
|
+
"accountCreatedAt": "2021-04-01T09:59:41.867116+00:00",
|
|
268
|
+
"lastLoginAt": "2026-04-24T09:59:41.867116+00:00",
|
|
269
|
+
"lastPasswordChangeAt": "2025-11-06T09:59:41.867116+00:00",
|
|
270
|
+
"userAgent": "Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 Chrome/121.0.0.0 Mobile Safari/537.36",
|
|
271
|
+
"browser": "Chrome",
|
|
272
|
+
"os": "Windows 11",
|
|
273
|
+
"referrer": "facebook.com",
|
|
274
|
+
"avgSessionMinutes": 17.6,
|
|
275
|
+
"sessionsPerWeek": 10,
|
|
276
|
+
"totalSessions": 2666,
|
|
277
|
+
"twoFactorEnabled": false,
|
|
278
|
+
"preferredLanguage": "de",
|
|
279
|
+
"accountStatus": "inactive",
|
|
280
|
+
"verifiedEmail": false,
|
|
281
|
+
"verifiedPhone": true
|
|
282
|
+
},
|
|
283
|
+
"bank": {
|
|
284
|
+
"nameOnCard": "Damaris Carlo Ebervale",
|
|
285
|
+
"cardNumber": "2289970210128357",
|
|
286
|
+
"cardType": "Mastercard",
|
|
287
|
+
"cardExpiry": "5/29",
|
|
288
|
+
"cardCvv": "355"
|
|
289
|
+
},
|
|
290
|
+
"hobbies": [
|
|
291
|
+
"Knitting",
|
|
292
|
+
"Gardening",
|
|
293
|
+
"LARPing"
|
|
294
|
+
],
|
|
295
|
+
"technology_profile": {
|
|
296
|
+
"devices": {
|
|
297
|
+
"additional_devices": [
|
|
298
|
+
"BlackBerry Bold 9790",
|
|
299
|
+
"Nokia N9"
|
|
300
|
+
],
|
|
301
|
+
"smartphone": "Sony Ericsson Xperia X10"
|
|
302
|
+
},
|
|
303
|
+
"phone_preferences": {
|
|
304
|
+
"critical_features": [
|
|
305
|
+
"security features",
|
|
306
|
+
"reliability",
|
|
307
|
+
"5G connectivity"
|
|
308
|
+
],
|
|
309
|
+
"primary_uses": [
|
|
310
|
+
"photography",
|
|
311
|
+
"education",
|
|
312
|
+
"organization"
|
|
313
|
+
]
|
|
314
|
+
},
|
|
315
|
+
"interest": [
|
|
316
|
+
"Knitting",
|
|
317
|
+
"Gardening",
|
|
318
|
+
"LARPing"
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Advanced Features Reference
|
|
327
|
+
|
|
328
|
+
Both Python and JS/TS expose the same underlying engine options.
|
|
329
|
+
|
|
330
|
+
### 1. Configuration Options
|
|
331
|
+
Pass an `options` dictionary/object to `data.user(options)` or `data.users(n, options)`:
|
|
332
|
+
|
|
333
|
+
```javascript
|
|
334
|
+
const options = {
|
|
335
|
+
seed: 42, // Number: Ensures deterministic, byte-for-byte identical output
|
|
336
|
+
missing_rate: 0.05, // Float (0-1): 5% chance of any leaf field being null
|
|
337
|
+
locale: 'jp', // String: 'en', 'in', 'jp', 'kr', 'de', 'br', 'ar', 'fr'
|
|
338
|
+
anomaly_rate: 0.05, // Float (0-1): 5% of users will have injected fraud anomalies
|
|
339
|
+
days: 30, // Number: Days of time-series activity to generate
|
|
340
|
+
eventsPerDay: 8, // Number: Average events per day for time-series logs
|
|
341
|
+
|
|
342
|
+
// Schema Constraints (force specific data distributions)
|
|
343
|
+
schema: {
|
|
344
|
+
age: { min: 25, max: 40 }, // Can also use { exact: 30 }
|
|
345
|
+
gender: "female", // "male", "female", or "non-binary"
|
|
346
|
+
employment: { status: "employed" },
|
|
347
|
+
education: { level: "Master's" },
|
|
348
|
+
financial: { annualIncome: { min: 60000, max: 120000 } },
|
|
349
|
+
health: { medicalCondition: "Diabetes" },
|
|
350
|
+
address: { country: "Japan" },
|
|
351
|
+
height: { min: 160, max: 180 },
|
|
352
|
+
weight: { min: 50, max: 80 }
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### 2. Supported API Methods
|
|
358
|
+
|
|
359
|
+
| Method (JS) | Method (Python) | Description |
|
|
360
|
+
| :--- | :--- | :--- |
|
|
361
|
+
| `data.user(opts?)` | `data.user(opts=None)` | Generate a single complex user profile. |
|
|
362
|
+
| `data.users(n, opts?)` | `data.users(n, opts=None)` | Generate an array/list of `n` users. |
|
|
363
|
+
| `data.userTimeSeries(opts)` | `data.user_time_series(opts)`| Returns `{ user, activity }` containing chronological event logs. |
|
|
364
|
+
| `data.usersFlat(n, opts?)` | `data.users_flat(n, opts=None)`| Returns flat dicts/objects, perfect for `pandas.DataFrame` ingestion. |
|
|
365
|
+
| `data.usersToCSV(n, opts?)` | `data.users_to_csv(n, opts=None)`| Returns a fully formatted CSV string (112 columns). |
|
|
366
|
+
| `data.usersToJSON(n, opts?)`| `data.users_to_json(n, opts=None)`| Returns a pretty-printed JSON string. |
|
|
367
|
+
|
|
368
|
+
### 3. Behavioral Personas (Statistical Modeling)
|
|
369
|
+
To ensure the data is useful for **Clustering** and **Regression** analysis, `fakedata` uses a **Persona-driven engine**. Every user is assigned one of 6 personas that orchestrate their life outcomes:
|
|
370
|
+
|
|
371
|
+
- **Executive**: High income, high education (Master's/PhD), premium Apple devices, luxury lifestyle.
|
|
372
|
+
- **Tech Professional**: High income, high-end hardware, heavy social media use, remote work bias.
|
|
373
|
+
- **Student**: Low income, high student debt, budget/mid-range tech, high social media footprint.
|
|
374
|
+
- **Manual Laborer / Service Worker**: Budget-conscious, steady income, consistent employment patterns.
|
|
375
|
+
- **Freelancer**: Flexible work modes, variable income ranges, mid-range tech profile.
|
|
376
|
+
|
|
377
|
+
These personas ensure that an analyst looking at your synthetic data will find **statistically significant clusters** rather than just a uniform cloud of random values.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Data Structure Highlights (112 Columns)
|
|
382
|
+
|
|
383
|
+
### 3. Locale-Aware Name Generation
|
|
384
|
+
Supports 8 locales with culturally accurate first names, last names, and country/phone codes:
|
|
385
|
+
- `'in'`: Aarav Sharma, Priya Patel (+91, India)
|
|
386
|
+
- `'jp'`: Haruto Tanaka, Sakura Sato (+81, Japan)
|
|
387
|
+
- `'kr'`: Minjun Kim, Seo-yeon Park (+82, South Korea)
|
|
388
|
+
- `'de'`: Lukas Müller, Mia Schmidt (+49, Germany)
|
|
389
|
+
- `'br'`: Miguel Silva, Alice Santos (+55, Brazil)
|
|
390
|
+
- `'ar'`: Mohammed Al-Ahmed, Fatima Khalil (+966, Saudi Arabia)
|
|
391
|
+
- `'fr'`: Gabriel Martin, Emma Dubois (+33, France)
|
|
392
|
+
- `'en'`: James Smith, Mary Johnson (+1, United States)
|
|
393
|
+
|
|
394
|
+
### 4. Time-Series Activity Data
|
|
395
|
+
Generate chronological behavioral logs for users. Event types include `login`, `page_view`, `purchase`, `search`, `click`, `logout`, `api_call`, `upload`, `download`, and `comment`.
|
|
396
|
+
|
|
397
|
+
```javascript
|
|
398
|
+
const ts = data.userTimeSeries({ seed: 42, days: 30, eventsPerDay: 8 });
|
|
399
|
+
// ts.user → Full user profile
|
|
400
|
+
// ts.activity → [{ timestamp, type, page, duration, device, ip, success, amount?, query? }]
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### 5. Anomaly Injection Engine (Fraud Detection)
|
|
404
|
+
When `anomaly_rate` is > 0, `fakedata` injects ML-detectable fraud patterns into the dataset. Affected users receive a special `_anomaly` flag object indicating the fraud type.
|
|
405
|
+
|
|
406
|
+
| Anomaly Type | Effect |
|
|
407
|
+
|:---|:---|
|
|
408
|
+
| `income_spike` | Income multiplied 5-15x |
|
|
409
|
+
| `credit_fraud` | Credit score = 100-200 or 850-999, DTI = 10-60 |
|
|
410
|
+
| `session_anomaly` | Sessions/week = 200-700, avg session = 500-1500 min |
|
|
411
|
+
| `age_outlier` | Age = 1, 2, 3, 115, 120, or 130 |
|
|
412
|
+
| `geo_impossible` | Coordinates = (0,0), IP = 0.0.0.0 |
|
|
413
|
+
| `velocity_attack` | Total sessions = 50k-150k, last login = now |
|
|
414
|
+
| `data_mismatch` | Age=12 + employed + 30yr experience + $500k income |
|
|
415
|
+
| `health_outlier` | BMI = 8-9 or 75-80, BP = extreme values |
|
|
416
|
+
|
|
417
|
+
### 6. The User Profile Schema (109 Correlated Fields)
|
|
418
|
+
Each generated user contains highly realistic, correlated data. For example, age determines education graduation year, which impacts employment salary, which impacts credit score, which impacts housing status and health/BMI metrics.
|
|
419
|
+
|
|
420
|
+
```text
|
|
421
|
+
identity(9) → personal(6) → network(3) → address(7) → demographics(5)
|
|
422
|
+
→ education(7) → employment(10) → financial(8) → health(16)
|
|
423
|
+
→ social(9) → digitalFootprint(15) → bank(5) → lifestyle(9)
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## License
|
|
429
|
+
|
|
430
|
+
Distributed under the **MIT License**. See `LICENSE` for more information.
|
|
431
|
+
|
|
432
|
+
**Maintainer**: [abhay557](https://github.com/abhay557)
|
|
433
|
+
|
|
434
|
+
- Project Commit History - `https://github.com/abhay557/random-api.xyz`
|