File size: 1,999 Bytes
6ce20d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
FRED ML - Configuration Settings
Configuration for FRED API and application settings
"""

import os
from typing import Optional

class Config:
    """Configuration class for FRED ML application"""
    
    # FRED API Configuration
    FRED_API_KEY: Optional[str] = os.getenv('FRED_API_KEY')
    
    # Application Settings
    APP_TITLE = "FRED ML - Economic Analytics Platform"
    APP_DESCRIPTION = "Enterprise-grade economic analytics and forecasting platform"
    
    # Data Settings
    DEFAULT_START_DATE = "2020-01-01"
    DEFAULT_END_DATE = "2024-12-31"
    
    # Analysis Settings
    FORECAST_PERIODS = 12
    CONFIDENCE_LEVEL = 0.95
    
    # UI Settings
    THEME_COLOR = "#1f77b4"
    SUCCESS_COLOR = "#2ca02c"
    WARNING_COLOR = "#ff7f0e"
    ERROR_COLOR = "#d62728"
    
    @classmethod
    def validate_fred_api_key(cls) -> bool:
        """Validate if FRED API key is properly configured"""
        if not cls.FRED_API_KEY:
            return False
        if cls.FRED_API_KEY == 'your-fred-api-key-here':
            return False
        return True
    
    @classmethod
    def get_fred_api_key(cls) -> Optional[str]:
        """Get FRED API key with validation"""
        if cls.validate_fred_api_key():
            return cls.FRED_API_KEY
        return None

def setup_fred_api_key():
    """Helper function to guide users in setting up FRED API key"""
    print("=" * 60)
    print("FRED ML - API Key Setup")
    print("=" * 60)
    print()
    print("To use real FRED data, you need to:")
    print("1. Get a free API key from: https://fred.stlouisfed.org/docs/api/api_key.html")
    print("2. Set the environment variable:")
    print("   export FRED_API_KEY='your-api-key-here'")
    print()
    print("Or create a .env file in the project root with:")
    print("FRED_API_KEY=your-api-key-here")
    print()
    print("The application will work with demo data if no API key is provided.")
    print("=" * 60)

if __name__ == "__main__":
    setup_fred_api_key()