# vivasvana1/sparepartsinventory architecture

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

- Interactive diagram: https://gitdiagram.com/vivasvana1/sparepartsinventory
- Repository: https://github.com/vivasvana1/sparepartsinventory

## Overview

##### Main Components
- Data Ingestion & Storage
- Data Preparation & Feature Engineering
- Forecasting Engine
- Optimization Framework
- Simulation & Validation
- Visualization & Dashboards
- External Services & Tools

##### Relationships & Data Flow
- Feedback loops where simulation results update models or dashboards.

##### Architectural Patterns
- Modular pipeline: each stage is a separate “service” or notebook group.
- Hybrid execution: Python notebooks + external solvers (CPLEX) + GUI tools (anyLogistix, Power BI).
- Batch processing: sequential notebook runs.
- File‐based integration: CSV/Excel/OPL files exchanged between components.

##### Technologies & Frameworks
- Python (pandas, NumPy, statsmodels, fbprophet, scikit-learn)
- Jupyter Notebooks
- PuLP & IBM CPLEX (MILP solver)
- anyLogistix™ (network simulation)
- Power BI
- Conda environment

##### Capturing Details
- MILP objective & constraints
- Service-level tiers (A/B/C)
- Regional lead‐time multipliers

##### Final Touches
- Components are clearly labeled.
- Footnote the technologies (.env, Python libs, conda, CPLEX, anyLogistix, Power BI).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Title
    title["Spare Parts Inventory: Forecast → Optimization → Simulation → BI Pipeline"]

    %% Top Layer: Raw Data
    subgraph "Raw Data" 
        direction TB
        M5["M5 Dataset (CSV/Parquet)"]:::data
        DataLake["Local File System / Data Lake"]:::data
    end

    %% Data Ingestion & Storage
    subgraph "Data Ingestion & Storage" 
        direction TB
        Prep1["01_data_preparation.ipynb"]:::ingestion
        Prep2["02_data_preparation.ipynb"]:::ingestion
    end

    %% Exploratory Analysis & Demand Classification
    subgraph "Exploratory Analysis & Demand Classification"
        direction TB
        EDA["03_exploratory_data_analysis.ipynb"]:::ingestion
    end

    %% Forecasting Engine
    subgraph "Forecasting Engine"
        direction TB
        Forecast["04_demand_forecasting.ipynb"]:::forecasting
        ForecastModels["Croston, TSB, Prophet, SARIMAX, ETS"]:::forecasting
    end

    %% Optimization Framework
    subgraph "Optimization Framework"
        direction TB
        OptNB["05_inventory_optimization.ipynb"]:::optimization
        CPLEX["IBM CPLEX OPL Models"]:::optimization
    end

    %% Simulation & Validation
    subgraph "Simulation & Validation"
        direction TB
        SimNB["06_anylogistix_simuation_tables.ipynb"]:::simulation
        AnyLog["anyLogistix GUI & Templates"]:::simulation
    end

    %% Visualization & Reporting
    subgraph "Visualization & Reporting"
        direction TB
        PB1["Inventory Optimization Effectiveness Dashboard.pbix"]:::visualization
        PB2["SpareParts.pbix"]:::visualization
    end

    %% Side Components
    subgraph "Repository Artifacts"
        direction TB
        Plots["All plots/"]:::docs
        Req["requirements.txt"]:::docs
        Readme["README.md"]:::docs
        License["License.md"]:::docs
    end

    %% Data Flow
    M5 -->|ingest raw files| Prep1
    DataLake -->|store raw data| Prep1
    Prep1 -->|features.csv| Prep2
    Prep2 -->|cleaned_data.csv| EDA
    EDA -->|classified_data.csv| Forecast
    Forecast -->|forecast.csv| OptNB
    OptNB -->|.dat/.mod files| CPLEX
    CPLEX -->|optimized_params.csv| SimNB
    SimNB -->|anylogistix tables| AnyLog
    AnyLog -->|simulation_results.xlsx| PB1
    AnyLog -->|network_results.xlsx| PB2

    %% Click Events
    click Prep1 "https://github.com/vivasvana1/sparepartsinventory/blob/main/notebooks/01_data_preparation.ipynb"
    click Prep2 "https://github.com/vivasvana1/sparepartsinventory/blob/main/notebooks/02_data_preparation.ipynb"
    click EDA "https://github.com/vivasvana1/sparepartsinventory/blob/main/notebooks/03_exploratory_data_analysis.ipynb"
    click Forecast "https://github.com/vivasvana1/sparepartsinventory/blob/main/notebooks/04_demand_forecasting.ipynb"
    click OptNB "https://github.com/vivasvana1/sparepartsinventory/blob/main/notebooks/05_inventory_optimization.ipynb"
    click CPLEX "https://github.com/vivasvana1/sparepartsinventory/tree/main/Optimization_models_CPLEX/"
    click SimNB "https://github.com/vivasvana1/sparepartsinventory/blob/main/notebooks/06_anylogistix_simuation_tables.ipynb"
    click AnyLog "https://github.com/vivasvana1/sparepartsinventory/tree/main/Anylogistix/"
    click PB1 "https://github.com/vivasvana1/sparepartsinventory/blob/main/Power-BI Dashboards/Inventory Optimization Effectiveness Dashboard.pbix"
    click PB2 "https://github.com/vivasvana1/sparepartsinventory/blob/main/Power-BI Dashboards/SpareParts.pbix"
    click Plots "https://github.com/vivasvana1/sparepartsinventory/tree/main/All plots/"
    click Req "https://github.com/vivasvana1/sparepartsinventory/blob/main/requirements.txt"
    click Readme "https://github.com/vivasvana1/sparepartsinventory/blob/main/README.md"
    click License "https://github.com/vivasvana1/sparepartsinventory/blob/main/License.md"

    %% Styles
    classDef data fill:#D0E6A5,stroke:#4B8B3B,stroke-width:1px
    classDef ingestion fill:#ADD8E6,stroke:#1E90FF,stroke-width:1px
    classDef forecasting fill:#90EE90,stroke:#228B22,stroke-width:1px
    classDef optimization fill:#FFA500,stroke:#FF8C00,stroke-width:1px
    classDef simulation fill:#DDA0DD,stroke:#800080,stroke-width:1px
    classDef visualization fill:#20B2AA,stroke:#008080,stroke-width:1px
    classDef docs fill:#F0E68C,stroke:#DAA520,stroke-width:1px
```
