-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerate_mock_data.py
More file actions
142 lines (121 loc) · 6.01 KB
/
generate_mock_data.py
File metadata and controls
142 lines (121 loc) · 6.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import json
import random
import sys
from datetime import datetime, timedelta
import os
import uuid
from supabase import create_client
# Credentials must come from the environment (never commit secrets).
_url = os.getenv("NEXT_PUBLIC_SUPABASE_URL")
_key = os.getenv("NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY")
if not _url or not _key:
sys.exit(
"Set NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY "
"before running this script."
)
supabase = create_client(_url, _key)
locations = [
'minneapolis', 'galway', 'dublin', 'shanghai', 'tokyo', 'singapore',
'tempe', 'santa rosa', 'boulder', 'memphis', 'hangzhou', 'seoul'
]
first_names = [
'james', 'sarah', 'michael', 'emma', 'david', 'olivia', 'john', 'sophia',
'robert', 'isabella', 'william', 'mia', 'richard', 'charlotte', 'joseph',
'wei', 'yuki', 'mei', 'takeshi', 'priya', 'raj', 'anika', 'sung',
'soren', 'elena', 'liam', 'fatima', 'carlos', 'zara', 'mateo', 'nina'
]
learning_styles = [
'visual',
'auditory',
'kinesthetic',
'reading_writing'
]
shaped_by_options = [
'mentor',
'challenge',
'failure',
'success',
'team',
'other'
]
peak_performance_options = [
'individual',
'team',
'leadership',
'innovation',
'crisis'
]
motivation_options = [
'impact',
'growth',
'recognition',
'autonomy',
'purpose'
]
unique_qualities = [
"My background in both healthcare and engineering allows me to bridge communication gaps between clinical and technical teams.",
"Having lived in multiple countries, I naturally connect with diverse perspectives and find common ground when teams face cultural barriers.",
"I'm known for my ability to remain calm and clear-headed during high-pressure situations, which has been particularly valuable during critical product launches.",
"My multicultural upbringing has given me a unique lens for problem-solving that combines analytical precision with empathetic understanding of user needs.",
"Despite my long tenure, I maintain a beginner's mindset that allows me to constantly question assumptions and find innovative approaches to longstanding challenges.",
"My experience as a competitive athlete taught me how to rapidly adapt to changing circumstances and thrive under pressure, skills I bring to every project.",
"I have a rare combination of technical expertise and communication skills that allows me to translate complex regulatory requirements into actionable engineering guidelines.",
"Having been a patient who used a medical device before joining the organization, I bring genuine empathy and firsthand experience to patient-centered design discussions.",
"I excel at seeing connections between seemingly unrelated fields, which has led to several cross-functional innovations that merged technologies from different business units.",
"My dual background in materials science and medicine gives me unique insights when troubleshooting biocompatibility issues in product development.",
"I've developed a talent for spotting hidden talent in teams and creating opportunities for people to shine in ways they didn't know they could.",
"I bring a unique combination of clinical nursing experience and software development skills that helps me create more intuitive user interfaces for our medical devices.",
"My experience working across three different industries before healthcare gives me fresh perspectives on challenges that others might see as insurmountable due to industry traditions.",
"I have an unusual ability to take complex scientific concepts and translate them into accessible language for diverse audiences, from regulators to sales teams.",
"My synesthetic perception allows me to visualize data relationships in unique ways, often finding correlations in research data that standard analysis might miss."
]
def generate_fake_attendees():
attendees = []
for i in range(300):
attendee = {
"id": str(uuid.uuid4()),
"first_name": random.choice(first_names),
"last_name": f"{random.choice(locations)}{random.randint(100, 999)}",
"email": f"test{i}@example.com",
"is_anonymous": random.random() < 0.1,
"created_at": datetime.now().isoformat() + "Z",
"updated_at": datetime.now().isoformat() + "Z"
}
attendees.append(attendee)
return attendees
def generate_mock_data(attendee_ids):
base_date = datetime(2025, 7, 8, 9, 0)
survey_data = []
for i, attendee_id in enumerate(attendee_ids):
entry = {
"id": str(uuid.uuid4()),
"attendee_id": attendee_id,
"tenure_years": random.randint(0, 24),
"learning_style": random.choice(learning_styles),
"shaped_by": random.choice(shaped_by_options),
"peak_performance": random.choice(peak_performance_options),
"motivation": random.choice(motivation_options),
"unique_quality": random.choice(unique_qualities),
"status": "approved",
"test_data": True,
"created_at": (base_date + timedelta(minutes=3 * i)).isoformat() + "Z",
"updated_at": datetime.now().isoformat() + "Z"
}
survey_data.append(entry)
return {"survey_data": survey_data}
# Generate and insert fake attendees
attendees = generate_fake_attendees()
attendee_ids = []
for attendee in attendees:
response = supabase.table('attendees').insert(attendee).execute()
attendee_ids.append(attendee['id'])
print("Fake attendees have been inserted into Supabase!")
# Generate and insert survey responses
mock_data = generate_mock_data(attendee_ids)
for entry in mock_data["survey_data"]:
supabase.table('survey_responses').insert(entry).execute()
print("Mock survey responses have been injected into Supabase!")
# Optionally, save to JSON file for backup
with open("src/data/mockSurveyResponses3.json", "w") as f:
json.dump(mock_data, f, indent=2)
print("Mock data has also been written to src/data/mockSurveyResponses3.json")