File size: 2,571 Bytes
8024c76
 
2469150
8024c76
 
 
 
 
 
 
 
 
 
2469150
8024c76
 
 
 
 
 
 
 
 
 
2469150
8024c76
 
 
 
 
 
 
 
2469150
8024c76
2469150
 
8024c76
 
 
 
 
2469150
8024c76
2469150
 
8024c76
 
 
2469150
 
8024c76
2469150
 
8024c76
2469150
 
8024c76
2469150
 
8024c76
2469150
 
 
 
 
8024c76
 
2469150
 
 
 
 
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
66
67
68
69
70
71
72
73
#!/usr/bin/env python3
"""
Test script to verify all analytics imports work correctly
"""

import sys
import os

# Add the project root to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

def test_imports():
    """Test all the imports that the analytics need"""
    print("πŸ” Testing analytics imports...")
    
    # Test 1: Config import
    print("\n1. Testing config import...")
    try:
        from config.settings import Config
        print("βœ… Config import successful")
        config = Config()
        print(f"βœ… Config.get_fred_api_key() = {config.get_fred_api_key()}")
    except Exception as e:
        print(f"❌ Config import failed: {e}")
        return False
    
    # Test 2: Analytics import
    print("\n2. Testing analytics import...")
    try:
        from src.analysis.comprehensive_analytics import ComprehensiveAnalytics
        print("βœ… ComprehensiveAnalytics import successful")
    except Exception as e:
        print(f"❌ ComprehensiveAnalytics import failed: {e}")
        return False
    
    # Test 3: FRED Client import
    print("\n3. Testing FRED client import...")
    try:
        from src.core.enhanced_fred_client import EnhancedFREDClient
        print("βœ… EnhancedFREDClient import successful")
    except Exception as e:
        print(f"❌ EnhancedFREDClient import failed: {e}")
        return False
    
    # Test 4: Analytics modules import
    print("\n4. Testing analytics modules import...")
    try:
        from src.analysis.economic_forecasting import EconomicForecaster
        from src.analysis.economic_segmentation import EconomicSegmentation
        from src.analysis.statistical_modeling import StatisticalModeling
        print("βœ… All analytics modules import successful")
    except Exception as e:
        print(f"❌ Analytics modules import failed: {e}")
        return False
    
    # Test 5: Create analytics instance
    print("\n5. Testing analytics instance creation...")
    try:
        analytics = ComprehensiveAnalytics(api_key="test_key", output_dir="test_output")
        print("βœ… ComprehensiveAnalytics instance created successfully")
    except Exception as e:
        print(f"❌ Analytics instance creation failed: {e}")
        return False
    
    print("\nπŸŽ‰ All imports and tests passed successfully!")
    return True

if __name__ == "__main__":
    success = test_imports()
    if success:
        print("\nβœ… All analytics imports are working correctly!")
    else:
        print("\n❌ Some imports failed. Check the errors above.")