File size: 1,791 Bytes
91651eb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
setup_data.py
--------------
Generates synthetic investor data and knowledge base.
Auto-runs on first startup if data files don't exist.
Can also be run manually: python setup_data.py
"""
import sys, json
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))

def run():
    data_dir = Path("data")
    data_dir.mkdir(exist_ok=True)

    investors_path = data_dir / "investors.json"
    kb_path        = data_dir / "knowledge_base.json"

    # ── Investor data ──────────────────────────────────────────────────────
    if not investors_path.exists():
        print("[setup] Generating synthetic investor records...")
        from data.synthetic_investors import generate_investors
        investors = generate_investors(20)
        with open(investors_path, "w") as f:
            json.dump(investors, f, indent=2)
        print(f"[setup] βœ… {len(investors)} investor records β†’ {investors_path}")
    else:
        print(f"[setup] βœ… investors.json already exists β€” skipping")

    # ── Knowledge base ─────────────────────────────────────────────────────
    if not kb_path.exists():
        print("[setup] Generating CAMS knowledge base...")
        from data.knowledge_base_generator import KNOWLEDGE_BASE
        with open(kb_path, "w") as f:
            json.dump(KNOWLEDGE_BASE, f, indent=2)
        print(f"[setup] βœ… {len(KNOWLEDGE_BASE)} KB documents β†’ {kb_path}")
    else:
        print(f"[setup] βœ… knowledge_base.json already exists β€” skipping")

    print("[setup] Data ready βœ…")

if __name__ == "__main__":
    run()