|
--- |
|
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* |