# man5ic/inventoryintelligence architecture

> Architecture diagram of the GitHub repository man5ic/inventoryintelligence, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/man5ic/inventoryintelligence
- Repository: https://github.com/man5ic/inventoryintelligence

## Overview

This is a Flask inventory analytics and procurement decision-support application. Users upload CSV/Excel data, map its columns, then view filtered inventory KPIs, forecasts, material-level recommendations, risk alerts, rankings, and downloadable reports. app.py is the web entry point and coordinator; specialized modules implement analytics and automation. The README documents several capabilities whose route-level wiring was not sampled, so those branches are represented at subsystem level; edges follow sampled calls or documented relationships.

Main entry points: [`app.py`](https://github.com/man5ic/inventoryintelligence/blob/main/app.py) (Flask Routes), [`modules/scheduler.py`](https://github.com/man5ic/inventoryintelligence/blob/main/modules/scheduler.py) (Scheduled Jobs), [`modules/inventory_intelligence.py`](https://github.com/man5ic/inventoryintelligence/blob/main/modules/inventory_intelligence.py) (Inventory Intelligence), [`modules/forecasting.py`](https://github.com/man5ic/inventoryintelligence/blob/main/modules/forecasting.py) (Demand Forecasting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Data and Filters"]
  node_dataset[("Uploaded Dataset")]
  node_columnmap["Column Mapping<br/>[column_map.json]"]
  node_filter["Dataset Filtering<br/>[filter_engine.py]"]
end

subgraph group_analytics["Inventory Analytics"]
  node_inventory["Inventory Intelligence"]
  node_forecast["Demand Forecasting<br/>[forecasting.py]"]
  node_material["Material Intelligence"]
  node_deadstock["Dead Stock Detection"]
  node_ranking["Procurement Ranking"]
end

subgraph group_risk["Risk and Automation"]
  node_alerts["Alert Engine<br/>[alert_engine.py]"]
  node_automation["Automation Layer"]
  node_scheduler["Scheduled Jobs<br/>[scheduler.py]"]
  node_email["Email Alerts<br/>[email_alerts.py]"]
end

subgraph group_presentation["Insights and Reports"]
  node_charts["Chart Generation<br/>[chart_generator.py]"]
  node_summary["Executive Summary"]
  node_fullreport["Inventory Export<br/>[report_export.py]"]
  node_materialreport["Material Export<br/>[material_report.py]"]
  node_executivereport["Executive Export"]
end

subgraph group_web["Web Application"]
  node_webapp["Flask Routes<br/>[app.py]"]
end

node_user(("Inventory User"))

node_user -->|"uploads and views"| node_webapp
node_webapp -->|"saves uploads"| node_dataset
node_webapp -->|"persists mapping"| node_columnmap
node_webapp -->|"filters data"| node_filter
node_webapp -->|"runs analysis"| node_inventory
node_webapp -->|"runs forecasts"| node_forecast
node_webapp -->|"loads deep dive"| node_material
node_webapp -->|"detects dead stock"| node_deadstock
node_webapp -->|"ranks materials"| node_ranking
node_webapp -->|"classifies alerts"| node_alerts
node_webapp -->|"enriches alerts"| node_automation
node_webapp -->|"generates charts"| node_charts
node_webapp -->|"builds summary"| node_summary
node_webapp -->|"exports workbook"| node_fullreport
node_webapp -->|"exports material"| node_materialreport
node_webapp -->|"exports snapshot"| node_executivereport
node_scheduler -->|"refreshes forecasts"| node_forecast
node_scheduler -->|"runs analysis"| node_inventory
node_scheduler -->|"checks alerts"| node_alerts
node_scheduler -->|"generates summary"| node_summary
node_scheduler -->|"sends notifications"| node_email
node_scheduler -->|"logs events"| node_automation

click node_webapp "https://github.com/man5ic/inventoryintelligence/blob/main/app.py"
click node_dataset "https://github.com/man5ic/inventoryintelligence/tree/main/data"
click node_columnmap "https://github.com/man5ic/inventoryintelligence/blob/main/data/column_map.json"
click node_filter "https://github.com/man5ic/inventoryintelligence/blob/main/modules/filter_engine.py"
click node_inventory "https://github.com/man5ic/inventoryintelligence/blob/main/modules/inventory_intelligence.py"
click node_forecast "https://github.com/man5ic/inventoryintelligence/blob/main/modules/forecasting.py"
click node_material "https://github.com/man5ic/inventoryintelligence/blob/main/modules/material_intelligence.py"
click node_deadstock "https://github.com/man5ic/inventoryintelligence/blob/main/modules/dead_stock_detection.py"
click node_ranking "https://github.com/man5ic/inventoryintelligence/blob/main/modules/procurement_ranking.py"
click node_charts "https://github.com/man5ic/inventoryintelligence/blob/main/modules/chart_generator.py"
click node_alerts "https://github.com/man5ic/inventoryintelligence/blob/main/modules/alert_engine.py"
click node_automation "https://github.com/man5ic/inventoryintelligence/blob/main/modules/automation_engine.py"
click node_scheduler "https://github.com/man5ic/inventoryintelligence/blob/main/modules/scheduler.py"
click node_email "https://github.com/man5ic/inventoryintelligence/blob/main/modules/email_alerts.py"
click node_summary "https://github.com/man5ic/inventoryintelligence/blob/main/modules/executive_summary.py"
click node_fullreport "https://github.com/man5ic/inventoryintelligence/blob/main/modules/report_export.py"
click node_materialreport "https://github.com/man5ic/inventoryintelligence/blob/main/modules/material_report.py"
click node_executivereport "https://github.com/man5ic/inventoryintelligence/blob/main/modules/executive_report.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_dataset,node_columnmap,node_filter,node_user toneBlue
class node_inventory,node_forecast,node_material,node_deadstock,node_ranking toneAmber
class node_alerts,node_automation,node_scheduler,node_email toneMint
class node_charts,node_summary,node_fullreport,node_materialreport,node_executivereport toneRose
class node_webapp toneIndigo
```

## Components

### Data and Filters

- [Uploaded Dataset](https://github.com/man5ic/inventoryintelligence/tree/main/data): `data`
- [Column Mapping](https://github.com/man5ic/inventoryintelligence/blob/main/data/column_map.json): `data/column_map.json`
- [Dataset Filtering](https://github.com/man5ic/inventoryintelligence/blob/main/modules/filter_engine.py): `modules/filter_engine.py`

### Inventory Analytics

- [Inventory Intelligence](https://github.com/man5ic/inventoryintelligence/blob/main/modules/inventory_intelligence.py): `modules/inventory_intelligence.py`
- [Demand Forecasting](https://github.com/man5ic/inventoryintelligence/blob/main/modules/forecasting.py): `modules/forecasting.py`
- [Material Intelligence](https://github.com/man5ic/inventoryintelligence/blob/main/modules/material_intelligence.py): `modules/material_intelligence.py`
- [Dead Stock Detection](https://github.com/man5ic/inventoryintelligence/blob/main/modules/dead_stock_detection.py): `modules/dead_stock_detection.py`
- [Procurement Ranking](https://github.com/man5ic/inventoryintelligence/blob/main/modules/procurement_ranking.py): `modules/procurement_ranking.py`

### Risk and Automation

- [Alert Engine](https://github.com/man5ic/inventoryintelligence/blob/main/modules/alert_engine.py): `modules/alert_engine.py`
- [Automation Layer](https://github.com/man5ic/inventoryintelligence/blob/main/modules/automation_engine.py): `modules/automation_engine.py`
- [Scheduled Jobs](https://github.com/man5ic/inventoryintelligence/blob/main/modules/scheduler.py): `modules/scheduler.py`
- [Email Alerts](https://github.com/man5ic/inventoryintelligence/blob/main/modules/email_alerts.py): `modules/email_alerts.py`

### Insights and Reports

- [Chart Generation](https://github.com/man5ic/inventoryintelligence/blob/main/modules/chart_generator.py): `modules/chart_generator.py`
- [Executive Summary](https://github.com/man5ic/inventoryintelligence/blob/main/modules/executive_summary.py): `modules/executive_summary.py`
- [Inventory Export](https://github.com/man5ic/inventoryintelligence/blob/main/modules/report_export.py): `modules/report_export.py`
- [Material Export](https://github.com/man5ic/inventoryintelligence/blob/main/modules/material_report.py): `modules/material_report.py`
- [Executive Export](https://github.com/man5ic/inventoryintelligence/blob/main/modules/executive_report.py): `modules/executive_report.py`

### Web Application

- [Flask Routes](https://github.com/man5ic/inventoryintelligence/blob/main/app.py): `app.py`

### Other components

- **Inventory User**

## Connections

- Inventory User → Flask Routes: uploads and views (evidence: `README.md`)
- Flask Routes → Uploaded Dataset: saves uploads (evidence: `README.md`)
- Flask Routes → Column Mapping: persists mapping (evidence: `README.md`)
- Flask Routes → Dataset Filtering: filters data (evidence: `app.py`)
- Flask Routes → Inventory Intelligence: runs analysis (evidence: `app.py`)
- Flask Routes → Demand Forecasting: runs forecasts (evidence: `app.py`)
- Flask Routes → Material Intelligence: loads deep dive (evidence: `app.py`)
- Flask Routes → Dead Stock Detection: detects dead stock (evidence: `app.py`)
- Flask Routes → Procurement Ranking: ranks materials (evidence: `app.py`)
- Flask Routes → Alert Engine: classifies alerts (evidence: `app.py`)
- Flask Routes → Automation Layer: enriches alerts (evidence: `app.py`)
- Flask Routes → Chart Generation: generates charts (evidence: `README.md`)
- Flask Routes → Executive Summary: builds summary (evidence: `README.md`)
- Flask Routes → Inventory Export: exports workbook (evidence: `README.md`)
- Flask Routes → Material Export: exports material (evidence: `README.md`)
- Flask Routes → Executive Export: exports snapshot (evidence: `README.md`)
- Scheduled Jobs → Demand Forecasting: refreshes forecasts (evidence: `modules/scheduler.py`)
- Scheduled Jobs → Inventory Intelligence: runs analysis (evidence: `modules/scheduler.py`)
- Scheduled Jobs → Alert Engine: checks alerts (evidence: `modules/scheduler.py`)
- Scheduled Jobs → Executive Summary: generates summary (evidence: `modules/scheduler.py`)
- Scheduled Jobs → Email Alerts: sends notifications (evidence: `modules/scheduler.py`)
- Scheduled Jobs → Automation Layer: logs events (evidence: `modules/scheduler.py`)
