Edwin Salguero commited on
Commit
38a6b6a
Β·
1 Parent(s): ebe627d

Security: Move API key to environment variables and update documentation

Browse files
.env.example ADDED
@@ -0,0 +1 @@
 
 
1
+ FRED_API_KEY=your_fred_api_key_here
README.md CHANGED
@@ -20,29 +20,53 @@ pip install -r requirements.txt
20
 
21
  ### 2. API Key Configuration
22
 
23
- Your FRED API key is already configured in `config.py`:
24
- - API Key: `acf8bbec7efe3b6dfa6ae083e7152314`
 
 
 
 
 
 
 
25
 
26
  ### 3. Project Structure
27
 
28
  ```
29
- economic_output_datasets/
30
- β”œβ”€β”€ config.py # Configuration settings
31
- β”œβ”€β”€ fred_data_collector.py # Main data collection script
32
- β”œβ”€β”€ requirements.txt # Python dependencies
33
- β”œβ”€β”€ README.md # This file
34
- β”œβ”€β”€ data/ # Output directory for CSV files
35
- └── plots/ # Output directory for visualizations
 
 
 
 
 
 
 
 
 
 
 
36
  ```
37
 
38
  ## Usage
39
 
40
  ### Basic Usage
41
 
42
- Run the main script to collect and analyze economic data:
43
 
44
  ```bash
45
- python fred_data_collector.py
 
 
 
 
 
 
46
  ```
47
 
48
  This will:
@@ -53,13 +77,14 @@ This will:
53
 
54
  ### Custom Analysis
55
 
56
- You can customize the analysis by modifying the script:
57
 
58
  ```python
59
- from fred_data_collector import FREDDataCollector
 
60
 
61
  # Initialize collector
62
- collector = FREDDataCollector()
63
 
64
  # Custom series and date range
65
  custom_series = ['GDP', 'UNRATE', 'CPIAUCSL']
@@ -111,12 +136,13 @@ The tool includes error handling for rate limit issues.
111
 
112
  ## Configuration
113
 
114
- Edit `config.py` to customize:
115
- - API key (if needed)
116
  - Default date ranges
117
  - Output directories
118
  - Default indicators
119
 
 
 
120
  ## Dependencies
121
 
122
  - `fredapi`: FRED API client
 
20
 
21
  ### 2. API Key Configuration
22
 
23
+ 1. Get your FRED API key from [FRED API](https://fred.stlouisfed.org/docs/api/api_key.html)
24
+ 2. Copy `.env.example` to `.env`:
25
+ ```bash
26
+ cp .env.example .env
27
+ ```
28
+ 3. Edit `.env` and add your API key:
29
+ ```
30
+ FRED_API_KEY=your_actual_api_key_here
31
+ ```
32
 
33
  ### 3. Project Structure
34
 
35
  ```
36
+ FRED_ML/
37
+ β”œβ”€β”€ config/ # Configuration settings
38
+ β”‚ β”œβ”€β”€ settings.py # Environment variables and settings
39
+ β”‚ └── pipeline.yaml # Pipeline configuration
40
+ β”œβ”€β”€ src/ # Source code
41
+ β”‚ β”œβ”€β”€ core/ # Core functionality
42
+ β”‚ β”œβ”€β”€ analysis/ # Analysis modules
43
+ β”‚ β”œβ”€β”€ utils/ # Utility functions
44
+ β”‚ └── visualization/ # Visualization modules
45
+ β”œβ”€β”€ scripts/ # Executable scripts
46
+ β”œβ”€β”€ tests/ # Test files
47
+ β”œβ”€β”€ data/ # Data directories
48
+ β”‚ β”œβ”€β”€ raw/ # Raw data
49
+ β”‚ β”œβ”€β”€ processed/ # Processed data
50
+ β”‚ └── exports/ # Exported files
51
+ β”œβ”€β”€ requirements.txt # Python dependencies
52
+ β”œβ”€β”€ .env.example # Environment variables template
53
+ └── README.md # This file
54
  ```
55
 
56
  ## Usage
57
 
58
  ### Basic Usage
59
 
60
+ Run the EDA script to perform exploratory data analysis:
61
 
62
  ```bash
63
+ python scripts/run_eda.py
64
+ ```
65
+
66
+ Or run the advanced analytics:
67
+
68
+ ```bash
69
+ python scripts/run_advanced_analytics.py
70
  ```
71
 
72
  This will:
 
77
 
78
  ### Custom Analysis
79
 
80
+ You can customize the analysis by importing the modules:
81
 
82
  ```python
83
+ from src.core.fred_client import FREDDataCollectorV2
84
+ from src.analysis.advanced_analytics import AdvancedAnalytics
85
 
86
  # Initialize collector
87
+ collector = FREDDataCollectorV2()
88
 
89
  # Custom series and date range
90
  custom_series = ['GDP', 'UNRATE', 'CPIAUCSL']
 
136
 
137
  ## Configuration
138
 
139
+ Edit `config/settings.py` to customize:
 
140
  - Default date ranges
141
  - Output directories
142
  - Default indicators
143
 
144
+ The API key is now managed through environment variables (see Setup section above).
145
+
146
  ## Dependencies
147
 
148
  - `fredapi`: FRED API client
config/settings.py CHANGED
@@ -1,5 +1,11 @@
 
 
 
 
 
 
1
  # FRED API Configuration
2
- FRED_API_KEY = "acf8bbec7efe3b6dfa6ae083e7152314"
3
 
4
  # Data settings
5
  DEFAULT_START_DATE = "2010-01-01"
 
1
+ import os
2
+ from dotenv import load_dotenv
3
+
4
+ # Load environment variables from .env file
5
+ load_dotenv()
6
+
7
  # FRED API Configuration
8
+ FRED_API_KEY = os.getenv("FRED_API_KEY")
9
 
10
  # Data settings
11
  DEFAULT_START_DATE = "2010-01-01"
data/exports/fred_data_20250710_221702.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/exports/fred_data_20250710_223022.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/exports/fred_data_20250710_223149.csv ADDED
The diff for this file is too large to render. See raw diff