File size: 2,243 Bytes
401b16c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3

"""
Add sample data to the chatbot database for testing the dashboard.
This script adds realistic business transactions to populate the dashboard.
"""

import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))

from chatbot import Chatbot
from models import ChatbotRequest

def add_sample_data():
    """Add sample transactions to the database."""
    print("πŸ”„ Adding sample data to the database...")
    
    chatbot = Chatbot()
    
    # Sample purchases
    purchases = [
        "Add a purchase of 10 USB drives from TechMart at €5 each",
        "Add a purchase of 5 laptops from Electronics Plus at €800 each", 
        "Add a purchase of 20 keyboards from Office Supplies Co at €25 each",
        "Add a purchase of 8 monitors from TechMart at €200 each",
        "Add a purchase of 15 webcams from Electronics Plus at €45 each"
    ]
    
    # Sample sales
    sales = [
        "Sold 8 USB drives to ABC Corp at €12 each",
        "Sold 3 laptops to XYZ Ltd at €1200 each",
        "Sold 12 keyboards to StartupTech at €40 each", 
        "Sold 5 monitors to Creative Agency at €350 each",
        "Sold 10 webcams to Remote Work Solutions at €75 each",
        "Sold 6 USB drives to Local Business at €15 each",
        "Sold 2 laptops to Consulting Firm at €1100 each"
    ]
    
    print("πŸ“¦ Adding purchase transactions...")
    for purchase in purchases:
        try:
            request = ChatbotRequest(message=purchase)
            response = chatbot.process_message(request)
            print(f"  βœ… {purchase}")
        except Exception as e:
            print(f"  ❌ Failed: {purchase} - {e}")
    
    print("πŸ’° Adding sales transactions...")
    for sale in sales:
        try:
            request = ChatbotRequest(message=sale)
            response = chatbot.process_message(request)
            print(f"  βœ… {sale}")
        except Exception as e:
            print(f"  ❌ Failed: {sale} - {e}")
    
    chatbot.close()
    print("βœ… Sample data added successfully!")
    print("πŸš€ You can now launch the GUI to see the populated dashboard:")
    print("   python run_gui.py")

if __name__ == "__main__":
    add_sample_data()