# lokeshaijt/capacity-vs-order-distribution architecture

> Architecture diagram of the GitHub repository lokeshaijt/capacity-vs-order-distribution, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lokeshaijt/capacity-vs-order-distribution
- Repository: https://github.com/lokeshaijt/capacity-vs-order-distribution

## Overview

This Streamlit application turns an uploaded Order Status Report into a downloadable, 12-week Capacity vs Order Distribution workbook. The principal workflow is upload and configure inputs, generate a refreshed workbook from the template, then download it with summary and routing diagnostics. The generator extracts order rows, rebuilds the hidden WORKING sheet and carries routing and machine inputs forward when a prior report is supplied. The template provides the report layout, capacity formulas, masters, and regional mirror sheets. Internal generator stages are based on the documented behavior; omitted source excerpts limit verification of their exact call sequence.

Main entry points: [`report_generator.py`](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py) (Report generator), [`app.py`](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/app.py) (Streamlit interface), [`reference_workbook.xlsx`](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/reference_workbook.xlsx) (Report template and masters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_ui["Streamlit interface<br/>[app.py]"]
  node_diagnostics["Generation summary<br/>[app.py]"]
end

subgraph group_processing["Report generation"]
  node_generator["Report generator"]
  node_extract["OSR extraction"]
  node_routing["Routing carry-forward"]
  node_working["WORKING sheet rebuild"]
  node_aggregation["Weekly order aggregation"]
end

subgraph group_workbook["Workbook artifacts"]
  node_template["Report template and masters"]
  node_final["Generated report"]
end

node_operator(("Report operator"))
node_osr["Order Status Report"]
node_prior["Prior report"]

node_operator -->|"uploads inputs"| node_ui
node_osr -->|"provides OSR"| node_ui
node_prior -->|"optionally provides"| node_ui
node_ui -->|"calls generate"| node_generator
node_generator -->|"reads OSR"| node_extract
node_generator -->|"refreshes routing"| node_routing
node_generator -->|"rebuilds sheet"| node_working
node_generator -->|"calculates weekly orders"| node_aggregation
node_generator -->|"refreshes template"| node_template
node_template -->|"supplies layout and formulas"| node_final
node_generator -->|"saves workbook"| node_final
node_generator -->|"returns summary"| node_diagnostics
node_final -->|"offers download"| node_ui

click node_ui "https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/app.py"
click node_generator "https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py"
click node_extract "https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py"
click node_routing "https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py"
click node_working "https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py"
click node_aggregation "https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py"
click node_template "https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/reference_workbook.xlsx"
click node_final "https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py"
click node_diagnostics "https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/app.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_diagnostics toneBlue
class node_generator,node_extract,node_routing,node_working,node_aggregation toneAmber
class node_template,node_final toneMint
class node_operator,node_osr,node_prior toneIndigo
```

## Components

### User interface

- [Streamlit interface](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/app.py): `app.py`
- [Generation summary](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/app.py): `app.py`

### Report generation

- [Report generator](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py): `report_generator.py`
- [OSR extraction](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py): `report_generator.py`
- [Routing carry-forward](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py): `report_generator.py`
- [WORKING sheet rebuild](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py): `report_generator.py`
- [Weekly order aggregation](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py): `report_generator.py`

### Workbook artifacts

- [Report template and masters](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/reference_workbook.xlsx): `reference_workbook.xlsx`
- [Generated report](https://github.com/lokeshaijt/capacity-vs-order-distribution/blob/main/report_generator.py): `report_generator.py`

### Other components

- **Report operator**
- **Order Status Report**
- **Prior report**

## Connections

- Report operator → Streamlit interface: uploads inputs (evidence: `app.py`)
- Order Status Report → Streamlit interface: provides OSR (evidence: `app.py`)
- Prior report → Streamlit interface: optionally provides (evidence: `app.py`)
- Streamlit interface → Report generator: calls generate (evidence: `app.py`)
- Report generator → OSR extraction: reads OSR (evidence: `README.md`)
- Report generator → Routing carry-forward: refreshes routing (evidence: `README.md`)
- Report generator → WORKING sheet rebuild: rebuilds sheet (evidence: `README.md`)
- Report generator → Weekly order aggregation: calculates weekly orders (evidence: `README.md`)
- Report generator → Report template and masters: refreshes template (evidence: `README.md`)
- Report template and masters → Generated report: supplies layout and formulas (evidence: `README.md`)
- Report generator → Generated report: saves workbook (evidence: `report_generator.py`)
- Report generator → Generation summary: returns summary (evidence: `app.py`)
- Generated report → Streamlit interface: offers download (evidence: `app.py`)
