# raghavendrabhatbs/decision_rewind architecture

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

- Interactive diagram: https://gitdiagram.com/raghavendrabhatbs/decision_rewind
- Repository: https://github.com/raghavendrabhatbs/decision_rewind

## Overview

DECISION-REWIND is a cybersecurity research prototype that simulates correcting historical event data and selectively rewinding affected decisions. Users work through the React dashboard: generate or select an experiment, propose feature corrections, preview counterfactual decisions, execute a selective rewind, and inspect verification and audit results. FastAPI orchestrates dataset/model operations and the decision workflow; provenance reachability informs replay and recovery, while deterministic verification checks results. SQLite-backed stores preserve experiment state and logs. AI explanation is a separate, non-authoritative capability. Links reflect README workflow documentation and shown source references; unsampled implementation details are not inferred.

Main entry points: [`backend/app/main.py`](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/main.py) (HTTP API), [`backend/app/provenance/graph.py`](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/provenance/graph.py) (Dependency graph), [`backend/app/counterfactual/replay.py`](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/counterfactual/replay.py) (Counterfactual replay), [`frontend/src/App.tsx`](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/frontend/src/App.tsx) (Research dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Dashboard"]
  node_dashboard["Research dashboard<br/>[App.tsx]"]
end

subgraph group_api["API orchestration"]
  node_api_service["HTTP API<br/>[main.py]"]
  node_schemas["Request schemas<br/>[models.py]"]
end

subgraph group_decision["Decision and recovery"]
  node_generator["Event generator<br/>[generator.py]"]
  node_model_registry["Model registry<br/>[model_registry.py]"]
  node_workbench["Model workbench<br/>[workbench_model.py]"]
  node_provenance["Dependency graph<br/>[graph.py]"]
  node_replay["Counterfactual replay<br/>[replay.py]"]
  node_recovery["Selective recovery<br/>[recovery.py]"]
  node_verifier["Deterministic verifier<br/>[verifier.py]"]
end

subgraph group_persistence["Data and assistance"]
  node_dataset_store[("Experiment store<br/>[dataset_store.py]")]
  node_event_store[("Event store<br/>[store.py]")]
  node_audit_log[("Universal audit log<br/>[universal_log.py]")]
  node_llm["AI explanation<br/>[provider.py]"]
end

node_user(("Researcher"))
node_groq["Groq API"]

node_user -->|"uses"| node_dashboard
node_dashboard -->|"submits workflow"| node_api_service
node_api_service -->|"validates requests"| node_schemas
node_api_service -->|"generates events"| node_generator
node_api_service -->|"trains models"| node_workbench
node_api_service -->|"uses registry"| node_model_registry
node_api_service -->|"analyzes corrections"| node_replay
node_api_service -->|"selects rewind"| node_recovery
node_api_service -->|"verifies recovery"| node_verifier
node_api_service -->|"builds graph"| node_provenance
node_api_service -->|"persists experiments"| node_dataset_store
node_api_service -->|"persists events"| node_event_store
node_api_service -->|"records activity"| node_audit_log
node_api_service -->|"requests explanations"| node_llm
node_replay -->|"recomputes decisions"| node_generator
node_replay -->|"uses registry"| node_model_registry
node_replay -->|"checks reachability"| node_provenance
node_recovery -->|"checks reachability"| node_provenance
node_verifier -->|"checks reachability"| node_provenance
node_dataset_store -->|"stores dependencies"| node_provenance
node_llm -->|"requests completion"| node_groq

click node_dashboard "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/frontend/src/App.tsx"
click node_api_service "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/main.py"
click node_schemas "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/schemas/models.py"
click node_generator "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/dataset/generator.py"
click node_model_registry "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/ml/model_registry.py"
click node_workbench "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/ml/workbench_model.py"
click node_provenance "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/provenance/graph.py"
click node_replay "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/counterfactual/replay.py"
click node_recovery "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/recovery/recovery.py"
click node_verifier "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/verification/verifier.py"
click node_dataset_store "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/services/dataset_store.py"
click node_event_store "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/services/store.py"
click node_audit_log "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/services/universal_log.py"
click node_llm "https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/llm/provider.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_dashboard toneBlue
class node_api_service,node_schemas toneAmber
class node_generator,node_model_registry,node_workbench,node_provenance,node_replay,node_recovery,node_verifier,node_groq toneMint
class node_dataset_store,node_event_store,node_audit_log,node_llm toneRose
class node_user toneIndigo
```

## Components

### Dashboard

- [Research dashboard](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`

### API orchestration

- [HTTP API](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/main.py): `backend/app/main.py`
- [Request schemas](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/schemas/models.py): `backend/app/schemas/models.py`

### Decision and recovery

- [Event generator](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/dataset/generator.py): `backend/app/dataset/generator.py`
- [Model registry](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/ml/model_registry.py): `backend/app/ml/model_registry.py`
- [Model workbench](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/ml/workbench_model.py): `backend/app/ml/workbench_model.py`
- [Dependency graph](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/provenance/graph.py): `backend/app/provenance/graph.py`
- [Counterfactual replay](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/counterfactual/replay.py): `backend/app/counterfactual/replay.py`
- [Selective recovery](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/recovery/recovery.py): `backend/app/recovery/recovery.py`
- [Deterministic verifier](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/verification/verifier.py): `backend/app/verification/verifier.py`

### Data and assistance

- [Experiment store](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/services/dataset_store.py): `backend/app/services/dataset_store.py`
- [Event store](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/services/store.py): `backend/app/services/store.py`
- [Universal audit log](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/services/universal_log.py): `backend/app/services/universal_log.py`
- [AI explanation](https://github.com/raghavendrabhatbs/decision_rewind/blob/main/backend/app/llm/provider.py): `backend/app/llm/provider.py`

### Other components

- **Researcher**
- **Groq API**

## Connections

- Researcher → Research dashboard: uses (evidence: `README.md`)
- Research dashboard → HTTP API: submits workflow (evidence: `README.md`)
- HTTP API → Request schemas: validates requests (evidence: `backend/app/main.py`)
- HTTP API → Event generator: generates events (evidence: `backend/app/main.py`)
- HTTP API → Model workbench: trains models (evidence: `backend/app/main.py`)
- HTTP API → Model registry: uses registry (evidence: `backend/app/main.py`)
- HTTP API → Counterfactual replay: analyzes corrections (evidence: `backend/app/main.py`)
- HTTP API → Selective recovery: selects rewind (evidence: `backend/app/main.py`)
- HTTP API → Deterministic verifier: verifies recovery (evidence: `backend/app/main.py`)
- HTTP API → Dependency graph: builds graph (evidence: `backend/app/main.py`)
- HTTP API → Experiment store: persists experiments (evidence: `backend/app/main.py`)
- HTTP API → Event store: persists events (evidence: `backend/app/main.py`)
- HTTP API → Universal audit log: records activity (evidence: `backend/app/main.py`)
- HTTP API → AI explanation: requests explanations (evidence: `backend/app/main.py`)
- Counterfactual replay → Event generator: recomputes decisions (evidence: `backend/app/counterfactual/replay.py`)
- Counterfactual replay → Model registry: uses registry (evidence: `backend/app/counterfactual/replay.py`)
- Counterfactual replay → Dependency graph: checks reachability (evidence: `backend/app/counterfactual/replay.py`)
- Selective recovery → Dependency graph: checks reachability (evidence: `backend/app/recovery/recovery.py`)
- Deterministic verifier → Dependency graph: checks reachability (evidence: `backend/app/verification/verifier.py`)
- Experiment store → Dependency graph: stores dependencies (evidence: `backend/app/services/dataset_store.py`)
- AI explanation → Groq API: requests completion (evidence: `backend/app/llm/provider.py`)
