# ehgeraldo/rossmann_store_sales architecture

> Architecture diagram of the GitHub repository ehgeraldo/rossmann_store_sales, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ehgeraldo/rossmann_store_sales
- Repository: https://github.com/ehgeraldo/rossmann_store_sales

## Overview

##### Project Type and Purpose
- This is a data-science / machine-learning forecasting pipeline.
- Purpose: Ingest historical store data, run transformations / EDA, train & tune models, and expose a prediction API for six-week-ahead daily sales forecasts.

##### Main High-Level Components
a. Data Storage
- Raw CSV files: “data/train.csv”, “data/test.csv”, “data/store.csv”
b. ETL & Preprocessing Layer
- Notebooks c0 → c7 (Planning, Fill NAs, Descriptive Stats, Feature Engineering, Data Preparation)
c. Exploration & Feature Selection
- Notebooks c4 → c8 (Univariate → Multivariate EDA, Boruta Selection)
d. Model Training & Validation
- Notebooks c9 → c15 (Linear & Non-Linear Models, Cross-Validation, Hyperparameter Tuning, Error Interpretation, Rossmann Classifier)
e. Model Artifact Store
- Serialized model files (e.g., pickle / joblib) on disk or model registry
f. Deployment / Serving Layer
- Notebook c16 (API_Handler) → a REST API service (Flask or FastAPI)
- Client (web dashboard or external consumer) calls the API

##### Relationships & Data Flow
- Data Storage → ETL/Preprocessing: raw CSVs flow into transformation routines
- ETL → EDA & Selection: cleaned data feeds exploratory plots and feature pickers
- EDA → Model Training: selected features and splits feed into training routines
- Training → Model Store: best model and tuned parameters are saved
- Model Store → API Service: the production model is loaded for inference
- Client → API Service: external calls for daily-sales predictions

##### Architectural Patterns & Technologies
- Pipeline Pattern: a linear, staged data-processing flow
- Layered Architecture: Data Layer → Processing Layer → Model Layer → Service Layer
- Key Libraries: pandas / numpy (ingest & transform), scikit-learn (modeling & CV), BorutaPy (feature selection), Flask/FastAPI (serving)
- Notebooks should be refactored into Python modules for production

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Layer"
        DS1["train.csv"]:::dataStorage
        DS2["test.csv"]:::dataStorage
        DS3["store.csv"]:::dataStorage
    end

    subgraph "Data Pipeline"
        subgraph "ETL & Preprocessing"
            ETL1["Planning"]:::processing
            ETL2["Fill NAs"]:::processing
            ETL3["Descriptive Stats"]:::processing
            ETL4["Feature Engineering"]:::processing
            ETL5["Data Preparation"]:::processing
        end

        subgraph "EDA & Feature Selection"
            EDA1["Univariate EDA"]:::processing
            EDA2["Bivariate EDA"]:::processing
            EDA3["Multivariate EDA"]:::processing
            EDA4["Boruta Selection"]:::processing
        end

        subgraph "Model Training & Validation"
            M1["Linear Models"]:::processing
            M2["Non-Linear Models"]:::processing
            M3["Cross-Validation"]:::processing
            M4["Hyperparameter Tuning"]:::processing
            M5["Error Interpretation"]:::processing
            M6["Rossmann Classifier"]:::processing
        end
    end

    MA["Model Artifacts Store"]:::artifact
    API["Prediction API"]:::external
    CLIENT("Client"):::external

    DS1 --> ETL1
    DS2 --> ETL1
    DS3 --> ETL1

    ETL1 --> ETL2 --> ETL3 --> ETL4 --> ETL5
    ETL5 --> EDA1 --> EDA2 --> EDA3 --> EDA4
    EDA4 --> M1 --> M2 --> M3 --> M4 --> M5 --> M6

    M6 --> MA
    MA --> API
    CLIENT -->|"HTTP/JSON"| API

    click DS1 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/data/train.csv"
    click DS2 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/data/test.csv"
    click DS3 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/data/store.csv"

    click ETL1 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c0.0-ehgeraldo-Planning.ipynb"
    click ETL2 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c1.0-ehgeraldo-Fill_NAs.ipynb"
    click ETL3 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c2.0-ehgeraldo-Descriptive_Statistical.ipynb"
    click ETL4 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c3.0-ehgeraldo-Feature_Engineering.ipynb"
    click ETL5 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c7.0-ehgeraldo-Data_Preparation.ipynb"

    click EDA1 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c4.0-ehgeraldo-EDA_Univariate_Analysis.ipynb"
    click EDA2 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c5.0-ehgeraldo-EDA_Bivariate_Analysis.ipynb"
    click EDA3 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c6.0-ehgeraldo-EDA_Multivariate_Analysis.ipynb"
    click EDA4 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c8.0-ehgeraldo-Boruta_Selection.ipynb"

    click M1 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c9.0-ehgeraldo-Linear Model.ipynb"
    click M2 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c10.0-ehgeraldo-Non_Linear Model.ipynb"
    click M3 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c11.0-ehgeraldo-Cross_Validation.ipynb"
    click M4 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c13.0-ehgeraldo-Hyperparameters_Fine_Tuning.ipynb"
    click M5 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c14.0-ehgeraldo-Error_Interpretation.ipynb"
    click M6 "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c15.0-ehgeraldo-Rossmann_Class.ipynb"

    click API "https://github.com/ehgeraldo/rossmann_store_sales/blob/main/notebooks/c16.0-ehgeraldo-API_Handler.ipynb"

    classDef dataStorage fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef processing fill:#FFA500,stroke:#000,stroke-width:1px;
    classDef artifact fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef external fill:#DDA0DD,stroke:#000,stroke-width:1px;
```
