File size: 11,377 Bytes
506c2e0
 
 
 
 
 
2469150
f35bff2
2469150
f35bff2
2469150
f35bff2
2469150
26a8ea5
 
2b395f2
 
 
2469150
 
 
f35bff2
2469150
 
26a8ea5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2469150
f35bff2
 
38a6b6a
2b395f2
 
 
 
 
2469150
2b395f2
 
2469150
 
 
 
 
 
 
 
 
2b395f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2469150
2b395f2
f35bff2
 
2469150
f35bff2
2b395f2
f35bff2
2469150
2b395f2
 
2469150
832348e
2b395f2
832348e
2b395f2
 
2469150
fa5b1e0
2b395f2
832348e
2469150
2b395f2
2469150
 
 
 
 
 
2b395f2
2469150
2b395f2
832348e
2469150
2b395f2
 
2469150
 
 
 
2b395f2
832348e
2469150
6ce20d9
2469150
6ce20d9
 
2469150
2b395f2
2469150
2b395f2
832348e
2469150
f35bff2
2b395f2
f35bff2
2469150
38a6b6a
 
2b395f2
38a6b6a
2469150
 
 
 
 
f35bff2
2469150
 
f35bff2
2469150
 
f35bff2
 
2469150
2b395f2
2469150
 
 
 
 
2b395f2
f35bff2
2469150
f35bff2
2b395f2
 
 
2469150
f35bff2
2469150
 
2b395f2
f35bff2
2469150
6ce20d9
2469150
 
 
 
 
 
 
 
6ce20d9
 
2469150
2b395f2
2469150
 
f35bff2
2469150
 
2b395f2
f35bff2
2469150
f35bff2
2469150
2b395f2
2469150
 
 
 
 
 
 
 
2b395f2
f35bff2
2469150
2b395f2
2469150
 
 
 
 
2b395f2
f35bff2
2469150
26a8ea5
2469150
 
26a8ea5
2469150
 
 
f35bff2
2469150
6ce20d9
2469150
 
6ce20d9
2469150
 
6ce20d9
2469150
 
 
 
6ce20d9
832348e
2469150
 
2b395f2
2469150
 
 
832348e
2469150
832348e
2469150
 
 
 
f35bff2
2469150
 
2b395f2
f35bff2
2469150
 
 
832348e
2469150
 
 
832348e
2469150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
832348e
2469150
 
 
832348e
2469150
832348e
2469150
 
 
 
 
f35bff2
2469150
832348e
 
 
2469150
832348e
f35bff2
2469150
 
 
 
 
 
 
2b395f2
f35bff2
2469150
 
 
 
 
 
 
f35bff2
2469150
2b395f2
2469150
506c2e0
2469150
 
2b395f2
 
f35bff2
2469150
506c2e0
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
---
tags:
- fred
- economic
- ML
---
# FRED ML - Enterprise Economic Analytics Platform

A comprehensive, enterprise-grade Machine Learning system for analyzing Federal Reserve Economic Data (FRED) with automated data processing, advanced analytics, and interactive visualizations.

## ๐Ÿข Enterprise Features

### ๐Ÿš€ Core Capabilities
- **๐Ÿ“Š Real-time Data Processing**: Automated FRED API integration with enhanced client
- **๐Ÿ” Data Quality Assessment**: Comprehensive data validation and quality metrics
- **๐Ÿ”„ Automated Workflows**: CI/CD pipeline with quality gates
- **โ˜๏ธ Cloud-Native**: AWS Lambda and S3 integration
- **๐Ÿงช Comprehensive Testing**: Unit, integration, and E2E tests
- **๐Ÿ”’ Security**: Enterprise-grade security with audit logging
- **๐Ÿ“ˆ Performance**: Optimized for high-throughput data processing
- **๐Ÿ›ก๏ธ Reliability**: Robust error handling and recovery mechanisms

### ๐Ÿค– Advanced Analytics
- **๐Ÿ“Š Statistical Modeling**: 
  - Linear regression with lagged variables
  - Correlation analysis (Pearson, Spearman, Kendall)
  - Granger causality testing
  - Comprehensive diagnostic testing (normality, homoscedasticity, autocorrelation, multicollinearity)
  - Principal Component Analysis (PCA)

- **๐Ÿ”ฎ Time Series Forecasting**:
  - ARIMA models with automatic order selection
  - Exponential Smoothing (ETS) models
  - Stationarity testing (ADF, KPSS)
  - Time series decomposition (trend, seasonal, residual)
  - Backtesting with performance metrics (MAE, RMSE, MAPE)
  - Confidence intervals and uncertainty quantification

- **๐ŸŽฏ Economic Segmentation**:
  - Time period clustering (economic regimes)
  - Series clustering (behavioral patterns)
  - K-means and hierarchical clustering
  - Optimal cluster detection (elbow method, silhouette analysis)
  - Dimensionality reduction (PCA, t-SNE)

- **๐Ÿ“ˆ Interactive Visualizations**: Dynamic charts and dashboards
- **๐Ÿ’ก Comprehensive Insights**: Automated insights extraction and key findings identification

## ๐Ÿ“ Enterprise Project Structure

```
FRED_ML/
โ”œโ”€โ”€ ๐Ÿ“ src/                    # Core application code
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ core/              # Core pipeline components
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ analysis/          # Economic analysis modules
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ visualization/     # Data visualization components
โ”‚   โ””โ”€โ”€ ๐Ÿ“ lambda/           # AWS Lambda functions
โ”œโ”€โ”€ ๐Ÿ“ tests/                 # Enterprise test suite
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ unit/             # Unit tests
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ integration/      # Integration tests
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ e2e/              # End-to-end tests
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ run_tests.py      # Comprehensive test runner
โ”œโ”€โ”€ ๐Ÿ“ scripts/               # Enterprise automation scripts
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ cleanup_redundant_files.py  # Project cleanup
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ deploy_complete.py          # Complete deployment
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ health_check.py             # System health monitoring
โ”œโ”€โ”€ ๐Ÿ“ config/               # Enterprise configuration
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ settings.py       # Centralized configuration management
โ”œโ”€โ”€ ๐Ÿ“ docs/                  # Comprehensive documentation
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ api/              # API documentation
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ architecture/     # System architecture docs
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ CONVERSATION_SUMMARY.md
โ”œโ”€โ”€ ๐Ÿ“ data/                 # Data storage
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ raw/             # Raw data files
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ processed/       # Processed data
โ”‚   โ””โ”€โ”€ ๐Ÿ“ exports/         # Generated exports
โ”œโ”€โ”€ ๐Ÿ“ deploy/               # Deployment configurations
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ docker/          # Docker configurations
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ kubernetes/      # Kubernetes manifests
โ”‚   โ””โ”€โ”€ ๐Ÿ“ helm/            # Helm charts
โ”œโ”€โ”€ ๐Ÿ“ infrastructure/       # Infrastructure as code
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ ci-cd/          # CI/CD configurations
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ monitoring/      # Monitoring setup
โ”‚   โ””โ”€โ”€ ๐Ÿ“ alerts/          # Alert configurations
โ”œโ”€โ”€ ๐Ÿ“ .github/workflows/    # GitHub Actions workflows
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt      # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“„ pyproject.toml       # Project configuration
โ”œโ”€โ”€ ๐Ÿ“„ Dockerfile           # Container configuration
โ”œโ”€โ”€ ๐Ÿ“„ Makefile             # Enterprise build automation
โ””โ”€โ”€ ๐Ÿ“„ README.md            # This file
```

## ๐Ÿ› ๏ธ Enterprise Quick Start

### Prerequisites

- Python 3.9+
- AWS Account (for cloud features)
- FRED API Key
- Docker (optional, for containerized deployment)

### Installation

1. **Clone the repository**
   ```bash
   git clone https://github.com/your-org/FRED_ML.git
   cd FRED_ML
   ```

2. **Set up development environment**
   ```bash
   # Complete setup with all dependencies
   make setup
   
   # Or manual setup
   python -m venv .venv
   source .venv/bin/activate  # On Windows: .venv\Scripts\activate
   pip install -r requirements.txt
   pip install -e .
   ```

3. **Configure environment variables**
   ```bash
   export FRED_API_KEY="your_fred_api_key"
   export AWS_ACCESS_KEY_ID="your_aws_access_key"
   export AWS_SECRET_ACCESS_KEY="your_aws_secret_key"
   export AWS_DEFAULT_REGION="us-east-1"
   export ENVIRONMENT="development"  # or "production"
   ```

4. **Validate configuration**
   ```bash
   make config-validate
   ```

5. **Run comprehensive tests**
   ```bash
   make test
   ```

## ๐Ÿงช Enterprise Testing

### Run all tests
```bash
make test
```

### Run specific test types
```bash
# Unit tests only
make test-unit

# Integration tests only
make test-integration

# End-to-end tests only
make test-e2e

# Tests with coverage
make test-coverage
```

### Quality Assurance
```bash
# Full QA suite (linting, formatting, type checking, tests)
make qa

# Pre-commit checks
make pre-commit
```

## ๐Ÿš€ Enterprise Deployment

### Local Development
```bash
# Start development environment
make dev

# Start local development server
make dev-local
```

### Production Deployment
```bash
# Production environment
make prod

# Deploy to AWS
make deploy-aws

# Deploy to Streamlit Cloud
make deploy-streamlit
```

### Docker Deployment
```bash
# Build Docker image
make build-docker

# Run with Docker
docker run -p 8501:8501 fred-ml:latest
```

## ๐Ÿ“Š Enterprise Monitoring

### Health Checks
```bash
# System health check
make health

# View application logs
make logs

# Clear application logs
make logs-clear
```

### Performance Monitoring
```bash
# Performance tests
make performance-test

# Performance profiling
make performance-profile
```

### Security Audits
```bash
# Security scan
make security-scan

# Security audit
make security-audit
```

## ๐Ÿ”ง Enterprise Configuration

### Configuration Management
The project uses a centralized configuration system in `config/settings.py`:

```python
from config.settings import get_config

config = get_config()
fred_api_key = config.get_fred_api_key()
aws_credentials = config.get_aws_credentials()
```

### Environment Variables
- `FRED_API_KEY`: Your FRED API key
- `AWS_ACCESS_KEY_ID`: AWS access key for cloud features
- `AWS_SECRET_ACCESS_KEY`: AWS secret key
- `ENVIRONMENT`: Set to 'production' for production mode
- `LOG_LEVEL`: Logging level (DEBUG, INFO, WARNING, ERROR)
- `DB_HOST`, `DB_PORT`, `DB_NAME`, `DB_USER`, `DB_PASSWORD`: Database configuration

## ๐Ÿ“ˆ Enterprise Analytics

### Running Analytics Pipeline
```bash
# Run complete analytics pipeline
make analytics-run

# Clear analytics cache
make analytics-cache-clear
```

### Custom Analytics
```python
from src.analysis.comprehensive_analytics import ComprehensiveAnalytics

analytics = ComprehensiveAnalytics(api_key="your_key")
results = analytics.run_complete_analysis()
```

## ๐Ÿ›ก๏ธ Enterprise Security

### Security Features
- **API Rate Limiting**: Configurable rate limits for API calls
- **Audit Logging**: Comprehensive audit trail for all operations
- **SSL/TLS**: Secure communication protocols
- **Input Validation**: Robust input validation and sanitization
- **Error Handling**: Secure error handling without information leakage

### Security Best Practices
- All API keys stored as environment variables
- No hardcoded credentials in source code
- Regular security audits and dependency updates
- Comprehensive logging for security monitoring

## ๐Ÿ“Š Enterprise Performance

### Performance Optimizations
- **Caching**: Intelligent caching of frequently accessed data
- **Parallel Processing**: Multi-threaded data processing
- **Memory Management**: Efficient memory usage and garbage collection
- **Database Optimization**: Optimized database queries and connections
- **CDN Integration**: Content delivery network for static assets

### Performance Monitoring
- Real-time performance metrics
- Automated performance testing
- Resource usage monitoring
- Scalability testing

## ๐Ÿ”„ Enterprise CI/CD

### Automated Workflows
- **Quality Gates**: Automated quality checks before deployment
- **Testing**: Comprehensive test suite execution
- **Security Scanning**: Automated security vulnerability scanning
- **Performance Testing**: Automated performance regression testing
- **Deployment**: Automated deployment to multiple environments

### GitHub Actions
The project includes comprehensive GitHub Actions workflows:
- Automated testing on pull requests
- Security scanning and vulnerability assessment
- Performance testing and monitoring
- Automated deployment to staging and production

## ๐Ÿ“š Enterprise Documentation

### Documentation Structure
- **API Documentation**: Comprehensive API reference
- **Architecture Documentation**: System design and architecture
- **Deployment Guides**: Step-by-step deployment instructions
- **Troubleshooting**: Common issues and solutions
- **Performance Tuning**: Optimization guidelines

### Generating Documentation
```bash
# Generate documentation
make docs

# Serve documentation locally
make docs-serve
```

## ๐Ÿค Enterprise Support

### Getting Help
- **Documentation**: Comprehensive documentation in `/docs`
- **Issues**: Report bugs and feature requests via GitHub Issues
- **Discussions**: Community discussions via GitHub Discussions
- **Security**: Report security vulnerabilities via GitHub Security

### Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Run the full test suite: `make test`
5. Submit a pull request

### Code Quality Standards
- **Linting**: Automated code linting with flake8
- **Formatting**: Consistent code formatting with black and isort
- **Type Checking**: Static type checking with mypy
- **Testing**: Comprehensive test coverage requirements
- **Documentation**: Inline documentation and docstrings

## ๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ™ Acknowledgments

- Federal Reserve Economic Data (FRED) for providing the economic data API
- Streamlit for the interactive web framework
- The open-source community for various libraries and tools

## ๐Ÿ“ž Contact

For enterprise support and inquiries:
- **Email**: [email protected]
- **Documentation**: https://docs.your-org.com/fred-ml
- **Issues**: https://github.com/your-org/FRED_ML/issues

---

**FRED ML** - Enterprise Economic Analytics Platform  
*Version 2.0.1 - Enterprise Grade*