# pranavparuchur1/ai-stack-atlas architecture

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

- Interactive diagram: https://gitdiagram.com/pranavparuchur1/ai-stack-atlas
- Repository: https://github.com/pranavparuchur1/ai-stack-atlas
- Video tour (about a minute): https://gitdiagram.com/pranavparuchur1/ai-stack-atlas/video

## Overview

AI Stack Atlas combines a Python market-data pipeline with a React market-map application. Its user workflow is to explore company and supply-chain relationships, inspect cited exposures, simulate a shock and its hop-by-hop impacts, and review historical backtests. The pipeline gathers curated and market data, computes valuations and analytics, validates quality, and publishes snapshots consumed by the UI. The README documents major views and the pipeline stages; several view implementations were not sampled, so their internal call relationships are not inferred.

Main entry points: [`pipeline/run.py`](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/run.py) (Pipeline orchestration), [`web/src/App.tsx`](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/App.tsx) (Application shell), [`web/src/views/SimulatorView.tsx`](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/SimulatorView.tsx) (Simulator view), [`pipeline/load/snapshot.py`](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/load/snapshot.py) (JSON snapshots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Data pipeline"]
  node_curated["Curated inputs<br/>[curated.py]"]
  node_provider["Daily market extraction<br/>[yfinance.py]"]
  node_quotes["Quote providers<br/>[base.py]"]
  node_run["Pipeline orchestration<br/>[run.py]"]
  node_warehouse[("DuckDB warehouse<br/>[warehouse.py]")]
  node_marketcap["FX and market caps<br/>[market_cap.py]"]
  node_attribution["Layer attribution<br/>[attribution.py]"]
  node_analytics["Indices and analytics<br/>[analytics.py]"]
  node_backtestinputs["Backtest inputs<br/>[backtest_inputs.py]"]
  node_validation["Quality checks<br/>[checks.py]"]
  node_snapshots["JSON snapshots<br/>[snapshot.py]"]
  node_contract["Data contract<br/>[models.py]"]
end

subgraph group_web["Market map UI"]
  node_app["Application shell<br/>[App.tsx]"]
  node_api["Snapshot data access<br/>[api.ts]"]
  node_derived["Live marks and layers<br/>[derived.ts]"]
  node_live["Browser live store<br/>[store.ts]"]
end

subgraph group_engine["Shock engine"]
  node_engine["Shock propagation<br/>[propagate.ts]"]
  node_channels["Edge sensitivities<br/>[channels.ts]"]
  node_backtest["Backtest engine<br/>[backtest.ts]"]
  node_why["Impact explanations<br/>[why.ts]"]
end

subgraph group_domain["Exploration views"]
  node_stack["Stack view<br/>[StackView.tsx]"]
  node_network["Network view<br/>[NetworkView.tsx]"]
  node_flow["Value flow view<br/>[FlowView.tsx]"]
  node_company["Company drawer<br/>[CompanyDrawer.tsx]"]
  node_simulator["Simulator view<br/>[SimulatorView.tsx]"]
  node_analyticsview["Analytics view<br/>[AnalyticsView.tsx]"]
  node_health["Pipeline health view<br/>[HealthView.tsx]"]
  node_controls["Scenario controls<br/>[Controls.tsx]"]
  node_impact["Impact results<br/>[ImpactTable.tsx]"]
  node_backtestpanel["Backtest panel<br/>[BacktestPanel.tsx]"]
end

node_user(("Visitor"))
node_market["Market data providers"]
node_finnhub["Finnhub stream"]

node_user -->|"opens"| node_app
node_app -->|"routes"| node_stack
node_app -->|"routes"| node_network
node_app -->|"routes"| node_flow
node_app -->|"routes"| node_simulator
node_app -->|"routes"| node_analyticsview
node_app -->|"routes"| node_health
node_market -->|"supplies prices"| node_provider
node_run -->|"loads inputs"| node_curated
node_run -->|"requests history"| node_provider
node_run -->|"requests quotes"| node_quotes
node_run -->|"loads and upserts"| node_warehouse
node_run -->|"computes marks"| node_marketcap
node_run -->|"computes layers"| node_attribution
node_run -->|"computes analytics"| node_analytics
node_run -->|"builds inputs"| node_backtestinputs
node_run -->|"runs checks"| node_validation
node_run -->|"publishes JSON"| node_snapshots
node_curated -->|"validates entities"| node_contract
node_validation -->|"checks totals"| node_attribution
node_validation -->|"checks data"| node_contract
node_snapshots -->|"provides app data"| node_api
node_api -->|"supplies snapshot"| node_derived
node_live -->|"overlays ticks"| node_derived
node_derived -->|"provides marked companies"| node_stack
node_derived -->|"provides marked companies"| node_simulator
node_derived -->|"provides exposure data"| node_company
node_finnhub -.->|"streams trades"| node_live
node_user -->|"configures shock"| node_simulator
node_simulator -->|"computes impacts"| node_engine
node_engine -->|"uses sensitivities"| node_channels
node_simulator -->|"renders controls"| node_controls
node_simulator -->|"renders impacts"| node_impact
node_simulator -->|"renders backtests"| node_backtestpanel
node_backtestpanel -->|"replays events"| node_backtest
node_company -->|"computes exposures"| node_engine
node_engine -.->|"explains paths"| node_why
node_snapshots -.->|"provides analytics"| node_analyticsview
node_snapshots -.->|"provides lineage and checks"| node_health
node_snapshots -.->|"provides contracts"| node_flow

click node_curated "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/extract/curated.py"
click node_provider "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/extract/providers/yfinance.py"
click node_quotes "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/extract/providers/base.py"
click node_run "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/run.py"
click node_warehouse "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/load/warehouse.py"
click node_marketcap "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/transform/market_cap.py"
click node_attribution "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/transform/attribution.py"
click node_analytics "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/transform/analytics.py"
click node_backtestinputs "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/transform/backtest_inputs.py"
click node_validation "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/validate/checks.py"
click node_snapshots "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/load/snapshot.py"
click node_contract "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/models.py"
click node_app "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/App.tsx"
click node_api "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/data/api.ts"
click node_derived "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/data/derived.ts"
click node_live "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/live/store.ts"
click node_stack "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/StackView.tsx"
click node_network "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/NetworkView.tsx"
click node_flow "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/FlowView.tsx"
click node_company "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/components/CompanyDrawer.tsx"
click node_simulator "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/SimulatorView.tsx"
click node_analyticsview "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/AnalyticsView.tsx"
click node_health "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/HealthView.tsx"
click node_engine "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/engine/propagate.ts"
click node_channels "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/engine/channels.ts"
click node_backtest "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/engine/backtest.ts"
click node_why "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/engine/why.ts"
click node_controls "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/components/sim/Controls.tsx"
click node_impact "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/components/sim/ImpactTable.tsx"
click node_backtestpanel "https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/components/sim/BacktestPanel.tsx"

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_curated,node_provider,node_quotes,node_run,node_warehouse,node_marketcap,node_attribution,node_analytics,node_backtestinputs,node_validation,node_snapshots,node_contract toneBlue
class node_app,node_api,node_derived,node_live toneAmber
class node_engine,node_channels,node_backtest,node_why toneMint
class node_stack,node_network,node_flow,node_company,node_simulator,node_analyticsview,node_health,node_controls,node_impact,node_backtestpanel toneRose
class node_user,node_market,node_finnhub toneIndigo
```

## Components

### Data pipeline

- [Curated inputs](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/extract/curated.py): `pipeline/extract/curated.py`
- [Daily market extraction](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/extract/providers/yfinance.py): `pipeline/extract/providers/yfinance.py`
- [Quote providers](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/extract/providers/base.py): `pipeline/extract/providers/base.py`
- [Pipeline orchestration](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/run.py): `pipeline/run.py`
- [DuckDB warehouse](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/load/warehouse.py): `pipeline/load/warehouse.py`
- [FX and market caps](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/transform/market_cap.py): `pipeline/transform/market_cap.py`
- [Layer attribution](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/transform/attribution.py): `pipeline/transform/attribution.py`
- [Indices and analytics](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/transform/analytics.py): `pipeline/transform/analytics.py`
- [Backtest inputs](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/transform/backtest_inputs.py): `pipeline/transform/backtest_inputs.py`
- [Quality checks](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/validate/checks.py): `pipeline/validate/checks.py`
- [JSON snapshots](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/load/snapshot.py): `pipeline/load/snapshot.py`
- [Data contract](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/pipeline/models.py): `pipeline/models.py`

### Market map UI

- [Application shell](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Snapshot data access](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/data/api.ts): `web/src/data/api.ts`
- [Live marks and layers](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/data/derived.ts): `web/src/data/derived.ts`
- [Browser live store](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/live/store.ts): `web/src/live/store.ts`

### Shock engine

- [Shock propagation](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/engine/propagate.ts): `web/src/engine/propagate.ts`
- [Edge sensitivities](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/engine/channels.ts): `web/src/engine/channels.ts`
- [Backtest engine](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/engine/backtest.ts): `web/src/engine/backtest.ts`
- [Impact explanations](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/engine/why.ts): `web/src/engine/why.ts`

### Exploration views

- [Stack view](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/StackView.tsx): `web/src/views/StackView.tsx`
- [Network view](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/NetworkView.tsx): `web/src/views/NetworkView.tsx`
- [Value flow view](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/FlowView.tsx): `web/src/views/FlowView.tsx`
- [Company drawer](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/components/CompanyDrawer.tsx): `web/src/components/CompanyDrawer.tsx`
- [Simulator view](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/SimulatorView.tsx): `web/src/views/SimulatorView.tsx`
- [Analytics view](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/AnalyticsView.tsx): `web/src/views/AnalyticsView.tsx`
- [Pipeline health view](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/views/HealthView.tsx): `web/src/views/HealthView.tsx`
- [Scenario controls](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/components/sim/Controls.tsx): `web/src/components/sim/Controls.tsx`
- [Impact results](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/components/sim/ImpactTable.tsx): `web/src/components/sim/ImpactTable.tsx`
- [Backtest panel](https://github.com/pranavparuchur1/ai-stack-atlas/blob/main/web/src/components/sim/BacktestPanel.tsx): `web/src/components/sim/BacktestPanel.tsx`

### Other components

- **Visitor**
- **Market data providers**
- **Finnhub stream**

## Connections

- Visitor → Application shell: opens (evidence: `web/src/App.tsx`)
- Application shell → Stack view: routes (evidence: `web/src/App.tsx`)
- Application shell → Network view: routes (evidence: `web/src/App.tsx`)
- Application shell → Value flow view: routes (evidence: `web/src/App.tsx`)
- Application shell → Simulator view: routes (evidence: `web/src/App.tsx`)
- Application shell → Analytics view: routes (evidence: `web/src/App.tsx`)
- Application shell → Pipeline health view: routes (evidence: `web/src/App.tsx`)
- Market data providers → Daily market extraction: supplies prices
- Pipeline orchestration → Curated inputs: loads inputs (evidence: `pipeline/run.py`)
- Pipeline orchestration → Daily market extraction: requests history (evidence: `pipeline/run.py`)
- Pipeline orchestration → Quote providers: requests quotes (evidence: `pipeline/run.py`)
- Pipeline orchestration → DuckDB warehouse: loads and upserts (evidence: `pipeline/run.py`)
- Pipeline orchestration → FX and market caps: computes marks (evidence: `pipeline/run.py`)
- Pipeline orchestration → Layer attribution: computes layers (evidence: `pipeline/run.py`)
- Pipeline orchestration → Indices and analytics: computes analytics (evidence: `pipeline/run.py`)
- Pipeline orchestration → Backtest inputs: builds inputs (evidence: `pipeline/run.py`)
- Pipeline orchestration → Quality checks: runs checks (evidence: `pipeline/run.py`)
- Pipeline orchestration → JSON snapshots: publishes JSON (evidence: `pipeline/run.py`)
- Curated inputs → Data contract: validates entities (evidence: `pipeline/extract/curated.py`)
- Quality checks → Layer attribution: checks totals (evidence: `pipeline/validate/checks.py`)
- Quality checks → Data contract: checks data (evidence: `pipeline/validate/checks.py`)
- JSON snapshots → Snapshot data access: provides app data
- Snapshot data access → Live marks and layers: supplies snapshot (evidence: `web/src/data/derived.ts`)
- Browser live store → Live marks and layers: overlays ticks (evidence: `web/src/data/derived.ts`)
- Live marks and layers → Stack view: provides marked companies (evidence: `web/src/views/StackView.tsx`)
- Live marks and layers → Simulator view: provides marked companies (evidence: `web/src/views/SimulatorView.tsx`)
- Live marks and layers → Company drawer: provides exposure data (evidence: `web/src/components/CompanyDrawer.tsx`)
- Finnhub stream → Browser live store: streams trades
- Visitor → Simulator view: configures shock (evidence: `web/src/views/SimulatorView.tsx`)
- Simulator view → Shock propagation: computes impacts (evidence: `web/src/views/SimulatorView.tsx`)
- Shock propagation → Edge sensitivities: uses sensitivities (evidence: `web/src/engine/propagate.ts`)
- Simulator view → Scenario controls: renders controls (evidence: `web/src/views/SimulatorView.tsx`)
- Simulator view → Impact results: renders impacts (evidence: `web/src/views/SimulatorView.tsx`)
- Simulator view → Backtest panel: renders backtests (evidence: `web/src/views/SimulatorView.tsx`)
- Backtest panel → Backtest engine: replays events (evidence: `web/src/components/sim/BacktestPanel.tsx`)
- Company drawer → Shock propagation: computes exposures (evidence: `web/src/components/CompanyDrawer.tsx`)
- Shock propagation → Impact explanations: explains paths
- JSON snapshots → Analytics view: provides analytics
- JSON snapshots → Pipeline health view: provides lineage and checks
- JSON snapshots → Value flow view: provides contracts
