-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseed_demo_data.py
More file actions
63 lines (52 loc) · 1.85 KB
/
seed_demo_data.py
File metadata and controls
63 lines (52 loc) · 1.85 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
"""
Demo Data Seeding Script
Creates realistic dummy data for demo mode
"""
from app.services.database_service import DatabaseService
from datetime import datetime, timedelta
import random
import json
def seed_demo_data():
"""Seed the database with realistic demo data."""
db = DatabaseService()
# Demo user email
demo_email = 'demo@example.com'
print("🌱 Seeding demo data...")
# Generate dates over the past 7 days
base_date = datetime.now()
# Load data from demo.json
try:
with open('demo.json', 'r') as f:
emails = json.load(f)
except FileNotFoundError:
print("❌ Error: demo.json not found. Please run generate_demo_json.py first.")
return
print(f"🌱 Seeding {len(emails)} emails from demo.json...")
# Insert all emails
count = 0
responded = 0
ignored = 0
failed = 0
for email in emails:
timestamp = base_date - timedelta(days=email['days_ago'], hours=email['hours'])
email_timestamp = timestamp - timedelta(minutes=random.randint(1, 60))
db.log_email(
sender=email['sender'],
subject=email['subject'],
status=email['status'],
details=email['details'],
category=email['category'],
agent_email=demo_email,
email_timestamp=email_timestamp.isoformat()
)
count += 1
if email['status'] == 'RESPONDED': responded += 1
elif email['status'] == 'IGNORED': ignored += 1
elif email['status'] == 'ERROR': failed += 1
print(f"✅ Successfully seeded {count} demo email entries")
print(f" - {responded} RESPONDED")
print(f" - {ignored} IGNORED")
print(f" - {failed} FAILED")
print(f" All tagged with agent_email: {demo_email}")
if __name__ == '__main__':
seed_demo_data()