# innovaitors2026/sentry-sc-digital-twin architecture

> Architecture diagram of the GitHub repository innovaitors2026/sentry-sc-digital-twin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/innovaitors2026/sentry-sc-digital-twin
- Repository: https://github.com/innovaitors2026/sentry-sc-digital-twin

## Overview

SENTRY-SC is a supply-chain digital twin and disruption stress-test application, not an ML training system or live SAP connector. Users inspect the seeded network, configure disruptions and recoveries, simulate scenarios, then review results or compare scenarios. The React UI calls a FastAPI API; scenario storage supplies a fresh baseline twin to the discrete-time engine, which returns metrics, events, and timelines. The README documents additional risk-prediction and recovery-optimizer ingestion; sampled source confirms the risk adapter, while recovery details are less visible. Backend excerpts are partial, so some internal simulation links are intentionally omitted.

Main entry points: [`backend/app/api/routes.py`](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/api/routes.py) (API Routes), [`frontend/src/api/client.ts`](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/api/client.ts) (API Client), [`frontend/src/pages/Overview.tsx`](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/Overview.tsx) (Network Overview), [`frontend/src/pages/Results.tsx`](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/Results.tsx) (Simulation Results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Demonstration UI"]
  node_overview["Network Overview<br/>[Overview.tsx]"]
  node_stress["Stress Test<br/>[StressTest.tsx]"]
  node_results["Simulation Results<br/>[Results.tsx]"]
  node_compare["Scenario Compare<br/>[Compare.tsx]"]
  node_node_details["Node Details<br/>[NodeDetails.tsx]"]
  node_graph["Network Graph<br/>[NetworkGraph.tsx]"]
  node_metrics["Metric Cards<br/>[MetricCard.tsx]"]
  node_client["API Client<br/>[client.ts]"]
end

subgraph group_api["HTTP API"]
  node_routes["API Routes<br/>[routes.py]"]
  node_schemas["API Contracts<br/>[schemas.py]"]
end

subgraph group_scenario["Scenario Simulation"]
  node_store[("Scenario Store<br/>[store.py]")]
  node_engine["Daily Simulator<br/>[engine.py]"]
end

subgraph group_twin["Twin Model"]
  node_network["Seeded Demo Network<br/>[demo_network.py]"]
  node_models["Twin and Event Models<br/>[models.py]"]
end

subgraph group_integrations["Adapters"]
  node_risk_adapter["Risk Adapter<br/>[risk.py]"]
  node_recovery_adapter["Recovery Adapter<br/>[recovery.py]"]
  node_sap_adapter["SAP Stub<br/>[sap.py]"]
end

node_user(("User"))
node_risk_service(("Risk Prediction Provider"))
node_optimizer(("Recovery Optimizer"))

node_user -->|"inspect"| node_overview
node_user -->|"configure"| node_stress
node_user -->|"review"| node_results
node_user -->|"compare"| node_compare
node_user -->|"inspect node"| node_node_details
node_overview -->|"fetches network"| node_client
node_stress -->|"manages scenarios"| node_client
node_results -->|"loads results"| node_client
node_compare -->|"compares scenarios"| node_client
node_node_details -->|"fetches node"| node_client
node_overview -->|"renders network"| node_graph
node_results -->|"renders impacts"| node_graph
node_results -->|"displays KPIs"| node_metrics
node_overview -->|"displays metrics"| node_metrics
node_compare -->|"displays KPIs"| node_metrics
node_client -->|"calls REST API"| node_routes
node_routes -->|"uses contracts"| node_schemas
node_routes -->|"reads and updates"| node_store
node_routes -->|"runs simulation"| node_engine
node_routes -->|"translates predictions"| node_risk_adapter
node_routes -->|"translates recoveries"| node_recovery_adapter
node_store -->|"builds baseline"| node_network
node_network -->|"constructs entities"| node_models
node_store -->|"stores scenarios"| node_models
node_engine -->|"uses twin types"| node_models
node_risk_adapter -->|"creates disruptions"| node_models
node_risk_adapter -->|"validates targets against"| node_store
node_risk_service -.->|"provides predictions"| node_risk_adapter
node_optimizer -.->|"provides interventions"| node_recovery_adapter
node_sap_adapter -.->|"documents stub context"| node_network

click node_overview "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/Overview.tsx"
click node_stress "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/StressTest.tsx"
click node_results "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/Results.tsx"
click node_compare "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/Compare.tsx"
click node_node_details "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/NodeDetails.tsx"
click node_graph "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/components/NetworkGraph.tsx"
click node_metrics "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/components/MetricCard.tsx"
click node_client "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/api/client.ts"
click node_routes "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/api/routes.py"
click node_schemas "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/api/schemas.py"
click node_store "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/store.py"
click node_engine "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/simulation/engine.py"
click node_network "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/data/demo_network.py"
click node_models "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/domain/models.py"
click node_risk_adapter "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/adapters/risk.py"
click node_recovery_adapter "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/adapters/recovery.py"
click node_sap_adapter "https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/adapters/sap.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_overview,node_stress,node_results,node_compare,node_node_details,node_graph,node_metrics,node_client,node_user toneBlue
class node_routes,node_schemas toneAmber
class node_store,node_engine toneMint
class node_network,node_models toneRose
class node_risk_adapter,node_recovery_adapter,node_sap_adapter,node_risk_service,node_optimizer toneIndigo
```

## Components

### Demonstration UI

- [Network Overview](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/Overview.tsx): `frontend/src/pages/Overview.tsx`
- [Stress Test](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/StressTest.tsx): `frontend/src/pages/StressTest.tsx`
- [Simulation Results](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/Results.tsx): `frontend/src/pages/Results.tsx`
- [Scenario Compare](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/Compare.tsx): `frontend/src/pages/Compare.tsx`
- [Node Details](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/pages/NodeDetails.tsx): `frontend/src/pages/NodeDetails.tsx`
- [Network Graph](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/components/NetworkGraph.tsx): `frontend/src/components/NetworkGraph.tsx`
- [Metric Cards](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/components/MetricCard.tsx): `frontend/src/components/MetricCard.tsx`
- [API Client](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### HTTP API

- [API Routes](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/api/routes.py): `backend/app/api/routes.py`
- [API Contracts](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/api/schemas.py): `backend/app/api/schemas.py`

### Scenario Simulation

- [Scenario Store](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/store.py): `backend/app/store.py`
- [Daily Simulator](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/simulation/engine.py): `backend/app/simulation/engine.py`

### Twin Model

- [Seeded Demo Network](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/data/demo_network.py): `backend/app/data/demo_network.py`
- [Twin and Event Models](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/domain/models.py): `backend/app/domain/models.py`

### Adapters

- [Risk Adapter](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/adapters/risk.py): `backend/app/adapters/risk.py`
- [Recovery Adapter](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/adapters/recovery.py): `backend/app/adapters/recovery.py`
- [SAP Stub](https://github.com/innovaitors2026/sentry-sc-digital-twin/blob/master/backend/app/adapters/sap.py): `backend/app/adapters/sap.py`

### Other components

- **User**
- **Risk Prediction Provider**
- **Recovery Optimizer**

## Connections

- User → Network Overview: inspect (evidence: `README.md`)
- User → Stress Test: configure (evidence: `README.md`)
- User → Simulation Results: review (evidence: `README.md`)
- User → Scenario Compare: compare (evidence: `README.md`)
- User → Node Details: inspect node
- Network Overview → API Client: fetches network (evidence: `frontend/src/pages/Overview.tsx`)
- Stress Test → API Client: manages scenarios (evidence: `frontend/src/pages/StressTest.tsx`)
- Simulation Results → API Client: loads results (evidence: `frontend/src/pages/Results.tsx`)
- Scenario Compare → API Client: compares scenarios (evidence: `frontend/src/pages/Compare.tsx`)
- Node Details → API Client: fetches node (evidence: `frontend/src/pages/NodeDetails.tsx`)
- Network Overview → Network Graph: renders network (evidence: `frontend/src/pages/Overview.tsx`)
- Simulation Results → Network Graph: renders impacts (evidence: `frontend/src/pages/Results.tsx`)
- Simulation Results → Metric Cards: displays KPIs (evidence: `frontend/src/pages/Results.tsx`)
- Network Overview → Metric Cards: displays metrics (evidence: `frontend/src/pages/Overview.tsx`)
- Scenario Compare → Metric Cards: displays KPIs (evidence: `frontend/src/pages/Compare.tsx`)
- API Client → API Routes: calls REST API (evidence: `frontend/src/api/client.ts`)
- API Routes → API Contracts: uses contracts (evidence: `backend/app/api/routes.py`)
- API Routes → Scenario Store: reads and updates (evidence: `backend/app/api/routes.py`)
- API Routes → Daily Simulator: runs simulation (evidence: `backend/app/api/routes.py`)
- API Routes → Risk Adapter: translates predictions (evidence: `backend/app/api/routes.py`)
- API Routes → Recovery Adapter: translates recoveries (evidence: `backend/app/api/routes.py`)
- Scenario Store → Seeded Demo Network: builds baseline (evidence: `backend/app/store.py`)
- Seeded Demo Network → Twin and Event Models: constructs entities (evidence: `backend/app/data/demo_network.py`)
- Scenario Store → Twin and Event Models: stores scenarios (evidence: `backend/app/store.py`)
- Daily Simulator → Twin and Event Models: uses twin types (evidence: `backend/app/simulation/engine.py`)
- Risk Adapter → Twin and Event Models: creates disruptions (evidence: `backend/app/adapters/risk.py`)
- Risk Adapter → Scenario Store: validates targets against (evidence: `backend/app/adapters/risk.py`)
- Risk Prediction Provider → Risk Adapter: provides predictions (evidence: `README.md`)
- Recovery Optimizer → Recovery Adapter: provides interventions (evidence: `README.md`)
- SAP Stub → Seeded Demo Network: documents stub context (evidence: `README.md`)
