# surendraraju09/supply_ops architecture

> Architecture diagram of the GitHub repository surendraraju09/supply_ops, 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/surendraraju09/supply_ops
- Repository: https://github.com/surendraraju09/supply_ops

## Overview

APEXX is a supply-chain disruption control tower. Its main workflow discovers external signals, resolves them against shipment and ERP data, calculates inventory and customer-order impact, evaluates recovery options and constraints, then presents role-based decisions and audit evidence. The README documents the end-to-end stages and workspaces; sampled code confirms the SerpAPI fallback, impact calculations, and frontend API boundary. Several backend connections below rely on README documentation because those source files were not excerpted.

Main entry points: [`graph.py`](https://github.com/surendraraju09/supply_ops/blob/main/graph.py) (Agent Orchestrator), [`server.py`](https://github.com/surendraraju09/supply_ops/blob/main/server.py) (Control Tower API), [`impact_engine_v2.py`](https://github.com/surendraraju09/supply_ops/blob/main/impact_engine_v2.py) (Impact and PAB), [`serp_client.py`](https://github.com/surendraraju09/supply_ops/blob/main/serp_client.py) (News Search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_signals["Signal and Evidence"]
  node_serp["News Search<br/>[serp_client.py]"]
  node_cache["Signal Cache<br/>[serp_cache.json]"]
  node_parser["Disruption Parser"]
  node_signal_agent["Signal Agent<br/>[signal_agent.py]"]
end

subgraph group_erp["ERP and Impact"]
  node_erp_db[("ERP Database<br/>[mock_erp.db]")]
  node_resolver["ERP Resolver<br/>[erp_resolver.py]"]
  node_impact["Impact and PAB"]
  node_legacy_impact["Impact Engine<br/>[impact_engine.py]"]
end

subgraph group_decisions["Decision Services"]
  node_orchestrator["Agent Orchestrator<br/>[graph.py]"]
  node_constraints["Constraint Rules"]
  node_recovery["Recovery Agent<br/>[recovery_agent.py]"]
  node_recommendation["Recovery Scoring<br/>[recommendation.py]"]
  node_api_server["Control Tower API<br/>[server.py]"]
end

subgraph group_workspaces["Role Workspaces"]
  node_ui["Control Tower UI<br/>[App.tsx]"]
  node_api_client["Frontend API Client<br/>[api.ts]"]
  node_ui_types["Workspace Data Types<br/>[types.ts]"]
end

node_planner(("Supply Planner"))

node_planner -->|"searches signals"| node_serp
node_serp -->|"reads or writes"| node_cache
node_serp -->|"supplies news"| node_parser
node_parser -->|"provides parsed signal"| node_signal_agent
node_signal_agent -->|"resolves ERP entities"| node_resolver
node_resolver -->|"looks up records"| node_erp_db
node_impact -->|"reads shipment and BOM data"| node_erp_db
node_impact -->|"requests AI synthesis"| node_recommendation
node_impact -->|"provides impact dossier"| node_orchestrator
node_orchestrator -->|"validates options"| node_constraints
node_orchestrator -->|"coordinates recovery"| node_recovery
node_orchestrator -->|"scores recovery options"| node_recommendation
node_api_server -->|"serves decisions"| node_orchestrator
node_api_server -->|"records ERP decisions"| node_erp_db
node_ui -->|"uses API client"| node_api_client
node_api_client -->|"calls API routes"| node_api_server
node_ui -->|"uses workspace types"| node_ui_types
node_api_client -->|"uses response types"| node_ui_types
node_api_server -->|"serves role workspaces"| node_ui

click node_serp "https://github.com/surendraraju09/supply_ops/blob/main/serp_client.py"
click node_cache "https://github.com/surendraraju09/supply_ops/blob/main/cache/serp_cache.json"
click node_parser "https://github.com/surendraraju09/supply_ops/blob/main/disruption_parser.py"
click node_signal_agent "https://github.com/surendraraju09/supply_ops/blob/main/signal_agent.py"
click node_erp_db "https://github.com/surendraraju09/supply_ops/blob/main/mock_erp.db"
click node_resolver "https://github.com/surendraraju09/supply_ops/blob/main/erp_resolver.py"
click node_impact "https://github.com/surendraraju09/supply_ops/blob/main/impact_engine_v2.py"
click node_legacy_impact "https://github.com/surendraraju09/supply_ops/blob/main/impact_engine.py"
click node_orchestrator "https://github.com/surendraraju09/supply_ops/blob/main/graph.py"
click node_constraints "https://github.com/surendraraju09/supply_ops/blob/main/constraint_agent.py"
click node_recovery "https://github.com/surendraraju09/supply_ops/blob/main/recovery_agent.py"
click node_recommendation "https://github.com/surendraraju09/supply_ops/blob/main/recommendation.py"
click node_api_server "https://github.com/surendraraju09/supply_ops/blob/main/server.py"
click node_ui "https://github.com/surendraraju09/supply_ops/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/surendraraju09/supply_ops/blob/main/frontend/src/api.ts"
click node_ui_types "https://github.com/surendraraju09/supply_ops/blob/main/frontend/src/types.ts"

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_serp,node_cache,node_parser,node_signal_agent toneBlue
class node_erp_db,node_resolver,node_impact,node_legacy_impact toneAmber
class node_orchestrator,node_constraints,node_recovery,node_recommendation,node_api_server toneMint
class node_ui,node_api_client,node_ui_types toneRose
class node_planner toneIndigo
```

## Components

### Signal and Evidence

- [News Search](https://github.com/surendraraju09/supply_ops/blob/main/serp_client.py): `serp_client.py`
- [Signal Cache](https://github.com/surendraraju09/supply_ops/blob/main/cache/serp_cache.json): `cache/serp_cache.json`
- [Disruption Parser](https://github.com/surendraraju09/supply_ops/blob/main/disruption_parser.py): `disruption_parser.py`
- [Signal Agent](https://github.com/surendraraju09/supply_ops/blob/main/signal_agent.py): `signal_agent.py`

### ERP and Impact

- [ERP Database](https://github.com/surendraraju09/supply_ops/blob/main/mock_erp.db): `mock_erp.db`
- [ERP Resolver](https://github.com/surendraraju09/supply_ops/blob/main/erp_resolver.py): `erp_resolver.py`
- [Impact and PAB](https://github.com/surendraraju09/supply_ops/blob/main/impact_engine_v2.py): `impact_engine_v2.py`
- [Impact Engine](https://github.com/surendraraju09/supply_ops/blob/main/impact_engine.py): `impact_engine.py`

### Decision Services

- [Agent Orchestrator](https://github.com/surendraraju09/supply_ops/blob/main/graph.py): `graph.py`
- [Constraint Rules](https://github.com/surendraraju09/supply_ops/blob/main/constraint_agent.py): `constraint_agent.py`
- [Recovery Agent](https://github.com/surendraraju09/supply_ops/blob/main/recovery_agent.py): `recovery_agent.py`
- [Recovery Scoring](https://github.com/surendraraju09/supply_ops/blob/main/recommendation.py): `recommendation.py`
- [Control Tower API](https://github.com/surendraraju09/supply_ops/blob/main/server.py): `server.py`

### Role Workspaces

- [Control Tower UI](https://github.com/surendraraju09/supply_ops/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Frontend API Client](https://github.com/surendraraju09/supply_ops/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [Workspace Data Types](https://github.com/surendraraju09/supply_ops/blob/main/frontend/src/types.ts): `frontend/src/types.ts`

### Other components

- **Supply Planner**

## Connections

- Supply Planner → News Search: searches signals (evidence: `README.md`)
- News Search → Signal Cache: reads or writes (evidence: `serp_client.py`)
- News Search → Disruption Parser: supplies news (evidence: `README.md`)
- Disruption Parser → Signal Agent: provides parsed signal (evidence: `README.md`)
- Signal Agent → ERP Resolver: resolves ERP entities (evidence: `README.md`)
- ERP Resolver → ERP Database: looks up records (evidence: `README.md`)
- Impact and PAB → ERP Database: reads shipment and BOM data (evidence: `impact_engine_v2.py`)
- Impact and PAB → Recovery Scoring: requests AI synthesis (evidence: `impact_engine_v2.py`)
- Impact and PAB → Agent Orchestrator: provides impact dossier (evidence: `README.md`)
- Agent Orchestrator → Constraint Rules: validates options (evidence: `README.md`)
- Agent Orchestrator → Recovery Agent: coordinates recovery (evidence: `README.md`)
- Agent Orchestrator → Recovery Scoring: scores recovery options (evidence: `README.md`)
- Control Tower API → Agent Orchestrator: serves decisions (evidence: `README.md`)
- Control Tower API → ERP Database: records ERP decisions (evidence: `README.md`)
- Control Tower UI → Frontend API Client: uses API client (evidence: `frontend/src/App.tsx`)
- Frontend API Client → Control Tower API: calls API routes (evidence: `README.md`)
- Control Tower UI → Workspace Data Types: uses workspace types (evidence: `frontend/src/App.tsx`)
- Frontend API Client → Workspace Data Types: uses response types (evidence: `frontend/src/api.ts`)
- Control Tower API → Control Tower UI: serves role workspaces (evidence: `README.md`)
