File size: 984 Bytes
3e151a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import sys
import os

# Ensure project root is in Python path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

import config

def main():
    print("=== Starting FreightIQ Data Environment Setup ===")
    
    json_path = config.CARRIERS_JSON_PATH
    if not os.path.exists(json_path):
        print("carriers.json not found. Generating synthetic data...")
        from rag.generate_carriers import main as generate_data
        generate_data()
        
    try:
        from rag.setup_sqlite import setup_sqlite
        setup_sqlite()
    except Exception as e:
        print(f"Error setting up SQLite: {e}", file=sys.stderr)
        sys.exit(1)
        
    try:
        from rag.ingest_chroma import ingest_chroma
        ingest_chroma()
    except Exception as e:
        print(f"Error setting up ChromaDB: {e}", file=sys.stderr)
        sys.exit(1)
        
    print("=== Setup Completed Successfully ===")

if __name__ == "__main__":
    main()