Morocco Economic Analysis Pipeline - R/Python ETL, ML/DL models, Kaggle published
# Morocco Economic Pipeline
End-to-end socio-economic-financial analysis pipeline for Morocco — from raw data ingestion to machine learning forecasting and an enriched HTML report.
---
## Kaggle Resources
| Resource | Link |
|----------|------|
| **Dataset** (22 CSVs) | amarzouyoussef/economie-maroc-rasd |
| **R Kernel** (notebook, linked to GitHub) | amarzouyoussef/maroc-pipeline-r |
| **Forecasting Model** | amarzouyoussef/morocco-economic-forecasting |
### Model Variations
| Variation | Framework | Kaggle URL |
|-----------|-----------|------------|
| Random Forest | scikit-learn | ScikitLearn/random-forest |
| Lasso | scikit-learn | ScikitLearn/lasso |
| ARIMA | statsmodels | Other/arima |
| Deep Learning | Keras | Keras/deep-learning |
---
## Architecture
```
Raw Data (WB, IMF, OWID, Casablanca SE)
|
[Python ETL] fetch_wb.py / fetch_owid.py / fetch_imf2.py
| clean.py / transform.py / merge.py / load.py
v
22 clean CSVs --> Kaggle Dataset (economie-maroc-rasd)
|
[R Kernel] maroc_pipeline.R (Kaggle R notebook)
| 11 sections: Ingest → Clean → Join → EDA → Stats
| → Scenarios → ML → DL → Benchmark → Validation
| → Export + HTML Report
v
HTML Report rapport_economie_maroc.html
|
[Kaggle Models] 4 variations published for inference
```
---
## ETL Pipeline (Python)
| Script | Purpose |
|--------|---------|
| `fetch_wb.py` | World Bank WDI indicators (GDP, inflation, debt, trade, etc.) |
| `fetch_owid.py` | Our World in Data (energy, demographics, health) |
| `fetch_imf2.py` | IMF WEO forecasts and historical data |
| `clean.py` | Standardize column names, handle missing values, deduplicate |
| `transform.py` | Pivot, aggregate, create derived indicators |
| `merge.py` | Join all sources into a unified master dataset |
| `load.py` | Export final CSVs for Kaggle upload |
| `spark_etl.py` | Optional Spark-based distributed ETL for large volumes |
| `config.py` | Shared configuration (paths, constants) |
| `run_all.py` | …