CAMS-AI / setup_data.py
Rahul-rr's picture
Deploy CAMS Assistant
91651eb
Raw History Blame Contribute Delete
1.79 kB
"""
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()