# vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching architecture

> Architecture diagram of the GitHub repository vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching
- Repository: https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching

## Overview

##### Project type and purpose
- Key indicators: “Streamlit App,” “Python,” modules for batching, clustering, routing, plotting, and static CSV input.

##### File structure
- Top-level
- app.py (Streamlit entry point)
- requirements.txt, README.md, LICENSE
- static/ (input template, output folder, images)
- Utils package (business logic split into subpackages)
- utils/process/processing.py
- utils/routing/{distances.py, routes.py}
- utils/batch/{mapping_batch.py, simulation_batch.py}
- utils/cluster/{clustering.py, mapping_cluster.py, simulation_cluster.py}
- utils/results/plot.py
- No external microservices; all simulation runs in-process.

##### README for additional insights
- Two main experiments:
1. Wave picking with next-closest heuristic
2. Spatial clustering on single/multi-line orders
- Input data: CSV of order lines with (x,y) picks
- Output: total walking distance metrics, route sequences, charts

a. Main components
- Browser UI (user)
- Streamlit Server (app.py)
- Utility Modules (Processing, Batch, Cluster, Routing, Results)
- Data Layer (uploaded CSV, static/in, static/out)
- External Libraries (pandas, scikit-learn, matplotlib/Altair, Streamlit)
b. Relationships & interactions
1. User uploads CSV → Streamlit reads it into a pandas DataFrame
2. app.py invokes Processing to map order lines to (x,y)
3. Depending on experiment:
- Batch module groups orders into waves → Routing computes distances/routes
- Cluster module groups locations → Batch + Routing steps
4. Results module generates plots/tables → Streamlit renders them back to the browser
5. Optionally save outputs to static/out for download
c. Architectural patterns & principles
- Modular separation of concerns (one module per responsibility)
- Two-tier full-stack in a single Python process
d. Key technologies
- Streamlit (UI & server)
- pandas/numpy (data manipulation)
- scikit-learn (spatial clustering)
- matplotlib/Altair/seaborn (plotting)
- Python standard library

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "UI Layer"
        Browser["Browser (User)"]:::front
        Streamlit["Streamlit Server (app.py)"]:::front
    end

    Browser -->|"interacts via UI"| Streamlit
    click Streamlit "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/app.py"

    subgraph "External Libraries"
        Pandas["pandas / numpy"]:::lib
        Sklearn["scikit-learn"]:::lib
        PlotLib["matplotlib / Altair / seaborn"]:::lib
        StreamlitLib["Streamlit"]:::lib
    end

    Streamlit --> Pandas
    Streamlit --> Sklearn
    Streamlit --> PlotLib
    Streamlit --> StreamlitLib

    subgraph "Processing Layer"
        Processing["Processing Module\n(utils/process/processing.py)"]:::logic
    end

    Streamlit -->|"uploads CSV → DataFrame"| Processing
    click Processing "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/utils/process/processing.py"

    subgraph "Simulation Layer"
        subgraph "Batch Module"
            MBatch["Mapping Batch\n(utils/batch/mapping_batch.py)"]:::logic
            SBatch["Simulation Batch\n(utils/batch/simulation_batch.py)"]:::logic
        end

        subgraph "Cluster Module"
            Cluster["Clustering\n(utils/cluster/clustering.py)"]:::logic
            MapClust["Mapping Cluster\n(utils/cluster/mapping_cluster.py)"]:::logic
            SimClust["Simulation Cluster\n(utils/cluster/simulation_cluster.py)"]:::logic
        end

        subgraph "Routing Module"
            Distances["Distances\n(utils/routing/distances.py)"]:::logic
            Routes["Routes\n(utils/routing/routes.py)"]:::logic
        end
    end

    Processing -->|"raw points"| MBatch
    Processing -->|"raw points"| Cluster

    MBatch -->|"wave assignments"| SBatch
    Cluster -->|"clusters"| MapClust
    MapClust -->|"cluster-mapped points"| SimClust

    SBatch -->|"orders DataFrame"| Distances
    SimClust -->|"orders DataFrame"| Distances

    Distances -->|"distance matrix"| Routes
    Routes -->|"route sequence"| Results

    click MBatch "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/utils/batch/mapping_batch.py"
    click SBatch "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/utils/batch/simulation_batch.py"
    click Cluster "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/utils/cluster/clustering.py"
    click MapClust "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/utils/cluster/mapping_cluster.py"
    click SimClust "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/utils/cluster/simulation_cluster.py"
    click Distances "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/utils/routing/distances.py"
    click Routes "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/utils/routing/routes.py"

    Results["Results Module\n(utils/results/plot.py)"]:::logic
    click Results "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/utils/results/plot.py"

    Results --> Streamlit

    subgraph "Data Layer"
        Input["Input CSV Template\n(static/in/df_lines.csv)"]:::data
        Output["Output Folder\n(static/out/)"]:::data
        Images["Images/Assets\n(static/img/)"]:::data
    end

    Browser -->|"downloads template"| Input
    Processing --> Input
    Results --> Output
    Results --> Images

    click Input "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/static/in/df_lines.csv"
    click Output "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/tree/main/static/out/"
    click Images "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/tree/main/static/img/"

    Requirements["Requirements\n(requirements.txt)"]:::lib
    Streamlit --> Requirements
    click Requirements "https://github.com/vinit714/optimizing-warehouse-efficiency-via-python-based-order-batching/blob/main/requirements.txt"

    classDef front fill:#AED6F1,stroke:#21618C,color:#ffffff,shape:rectangle
    classDef logic fill:#ABEBC6,stroke:#196F3D,color:#000000,shape:round-rectangle
    classDef data fill:#F9E79F,stroke:#B7950B,color:#000000,shape:cylinder
    classDef lib fill:#F5B041,stroke:#B9770B,color:#000000,shape:parallelogram
```
