# guifagundes01/vending-machine-sales-forecasting architecture

> Architecture diagram of the GitHub repository guifagundes01/vending-machine-sales-forecasting, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/guifagundes01/vending-machine-sales-forecasting
- Repository: https://github.com/guifagundes01/vending-machine-sales-forecasting

## Overview

##### Project type and purpose
- This is a data‐processing and time‐series forecasting pipeline written in Python.
- It ingests vending machine sales data, applies three forecasting techniques (Moving Average, Exponential Smoothing, ARIMA), analyzes model performance, and writes results to an output directory.

##### File structure
- Top level:
- `vending_machine_sales.csv` – raw input data
- forecasting scripts: `moving_average.py`, `exponential_smoothing.py`, `arima_forecasting.py`
- “top‐products” variants: `top10_products_ma.py`, `top10_products_exponential_smoothing.py`, `top_products_arima.py`
- comparison & analysis: `all_methods_forecast_summary.py`, `forecasting_model_analysis.py`, `analyze_vending_machines.py`
- `output/` directory organized by method and subfolders for summaries and per‐product forecasts
- `requirements.txt` defines external libraries
- No web front end or database; filesystem is the primary I/O.

##### README for additional insights
- Confirms the three forecasting methods and step‐by‐step usage instructions.
- All outputs are saved under `output/`, including CSV summaries and plain‐text results.

a. Main components
1. Data Ingestion (reads CSV)
2. Preprocessing (shared code or in‐script data wrangling using pandas/numpy)
3. Forecasting Modules (three separate scripts)
4. Top‐N Forecasting Modules (per‐method variants)
5. Analysis Module (model performance, comparisons)
6. Output Store (filesystem under `output/`)
7. External Libraries (pandas, numpy, statsmodels, pmdarima, matplotlib, seaborn)
b. Relationships and interactions
- Data Ingestion → Preprocessing → Forecasting Modules → Output Store
- Forecasting Modules feed results into Analysis Module
- Analysis Module reads outputs from each method and writes comparison summaries back to Output Store
- Top‐N Forecasting Modules are specialized forecasting modules that branch off the main forecasting stage
c. Architectural patterns
- Pipeline pattern: a linear sequence of data processing stages
- Modular design: each forecasting method in its own script, analysis in separate modules
d. Relevant technologies
- Python 3.8+ runtime
- pandas / numpy for data manipulation
- statsmodels / pmdarima for statistical modeling
- matplotlib / seaborn for any plotting (if extended)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data & Storage
    rawCSV(["Raw Data CSV\n(vending_machine_sales.csv)"]):::data
    ingestion(["Data Ingestion\n(analyze_vending_machines.py)"]):::processing
    click rawCSV "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/vending_machine_sales.csv"
    click ingestion "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/analyze_vending_machines.py"

    %% Forecasting Layer
    subgraph "Forecasting Layer"
        direction TB
        ma(["moving_average.py\n(pandas, numpy)"]):::processing
        es(["exponential_smoothing.py\n(pandas, statsmodels)"]):::processing
        arima(["arima_forecasting.py\n(pmdarima, statsmodels)"]):::processing

        ma_top10(["top10_products_ma.py\n(pandas, numpy)"]):::processing
        es_top10(["top10_products_exponential_smoothing.py\n(pandas, statsmodels)"]):::processing
        arima_topn(["top_products_arima.py\n(pmdarima, statsmodels)"]):::processing

        ma --> ma_top10
        es --> es_top10
        arima --> arima_topn

        click ma "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/moving_average.py"
        click es "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/exponential_smoothing.py"
        click arima "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/arima_forecasting.py"
        click ma_top10 "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/top10_products_ma.py"
        click es_top10 "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/top10_products_exponential_smoothing.py"
        click arima_topn "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/top_products_arima.py"
    end

    %% Analysis & Reporting
    subgraph "Analysis Layer"
        direction TB
        summary(["all_methods_forecast_summary.py\n(analysis)"]):::analysis
        modelAnalysis(["forecasting_model_analysis.py\n(analysis)"]):::analysis

        click summary "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/all_methods_forecast_summary.py"
        click modelAnalysis "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/forecasting_model_analysis.py"
    end

    %% Output Store
    subgraph "Output Directory" 
        direction TB
        out_summaryCSV(["all_methods_forecast_summary.csv"]):::data
        out_overviewTXT(["vending_machine_summary.txt"]):::data
        out_ma_folder(["moving_average/"]):::data
        out_es_folder(["exponential_smoothing/"]):::data
        out_arima_folder(["arima/"]):::data

        click out_summaryCSV "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/output/all_methods_forecast_summary.csv"
        click out_overviewTXT "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/output/dataset_overview/vending_machine_summary.txt"
        click out_ma_folder "https://github.com/guifagundes01/vending-machine-sales-forecasting/tree/main/output/moving_average/"
        click out_es_folder "https://github.com/guifagundes01/vending-machine-sales-forecasting/tree/main/output/exponential_smoothing/"
        click out_arima_folder "https://github.com/guifagundes01/vending-machine-sales-forecasting/tree/main/output/arima/"
    end

    %% Dependencies
    deps(["External Libraries\n(requirements.txt)"]):::external
    click deps "https://github.com/guifagundes01/vending-machine-sales-forecasting/blob/main/requirements.txt"

    %% Connections
    rawCSV --> ingestion
    ingestion --> ma
    ingestion --> es
    ingestion --> arima

    ma --> summary
    es --> summary
    arima --> summary

    summary --> out_summaryCSV
    modelAnalysis --> out_overviewTXT

    ma_top10 --> out_ma_folder
    es_top10 --> out_es_folder
    arima_topn --> out_arima_folder

    deps -.-> ingestion
    deps -.-> ma
    deps -.-> es
    deps -.-> arima
    deps -.-> modelAnalysis

    %% Styles
    classDef data fill:#D0E8FF,stroke:#007BFF,color:#000;
    classDef processing fill:#DFF7E2,stroke:#28A745,color:#000;
    classDef analysis fill:#FFE8C4,stroke:#FF8C00,color:#000;
    classDef external fill:#F0F0F0,stroke:#666,color:#000;
```
