# muthukkumaranb/vitcsiorigins architecture

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

- Interactive diagram: https://gitdiagram.com/muthukkumaranb/vitcsiorigins
- Repository: https://github.com/muthukkumaranb/vitcsiorigins

## Overview

#### Purpose and Entry Points
SENTINEL detects privileged-access misuse and insider threats by combining deterministic behavioral analysis, temporal correlation, operational context, and ML classification. The Flask API starts at `backend/app.py`; initial model training runs through `backend/ml/training.py`. The SOC console is a Vite React/TypeScript client bootstrapped by `sentinel-frontend/src/main.tsx` and composed in `sentinel-frontend/src/App.tsx`.

#### Live Detection Plane
`POST /api/events` enters the live processing path exposed in `backend/app.py`. Runtime telemetry is loaded from CSV snapshots and retained in a bounded live buffer by `backend/data_loader.py`; it may originate from source data under `data/events.csv` or generated runtime output such as `output/events.csv`. The ingestion boundary validates event schema before scoring and makes recent events available to API consumers.

#### Deterministic Risk and Correlation
The core event processor in `backend/processor.py` computes baseline-aware behavior signals, ordered prior-event sequences using a 60-minute lookback, and context-adjusted deterministic risk. It is the central boundary between raw telemetry and enriched security assessments. Multi-stage sequences are subsequently grouped into incident records by `backend/incident_correlation.py`; enterprise-level posture and aggregations are served by `backend/analyzer.py`.

#### ML Inference and Hybrid Fusion
The ML subsystem derives a bounded 10-dimensional behavioral feature vector in `backend/ml/features.py`, performs real-time Random Forest inference through `backend/ml/predictor.py`, and merges the ML probability with behavior and sequence scores in `backend/ml/fusion.py`. Persisted production/candidate models are held under `backend/ml/artifacts/sentinel_rf_model.pkl` and version metadata is managed in `backend/ml/registry/model_registry.py`. Deterministic scoring remains the fallback when ML is unavailable.

#### Controlled Learning Plane
Analyst feedback accepted by the API is accumulated into a verified training dataset via `backend/ml/dataset_builder.py`. Candidate training is handled in `backend/ml/trainer.py`, evaluation in `backend/ml/evaluator.py`, and promotion/rollback decisions through the model registry in `backend/ml/registry/model_registry.py`. This plane is intentionally decoupled from live detection: retraining and model governance must not block event processing.

#### Telemetry Simulation
A controllable background simulator provides legitimate and staged attack telemetry independently of the live detection loop. Scenario definitions live in `backend/telemetry/scenarios.py`, schema-compliant events are created by `backend/telemetry/event_generator.py`, and lifecycle controls (start, pause, stop, reset, step) are implemented in `backend/telemetry/simulator.py`. Its emitted events re-enter the same ingestion/processing boundary as external events.

#### API Consumers and SOC Console
The Flask REST surface in `backend/app.py` exposes alerts, identities, risk detail, incidents, audit records, security analysis, simulator controls, and ML lifecycle endpoints. The frontend API boundary is `sentinel-frontend/src/services/api.ts`, with polling/data access in `sentinel-frontend/src/hooks/useSecurityData.ts`. Major operator workflows are represented by pages such as `sentinel-frontend/src/pages/Dashboard.tsx`, `sentinel-frontend/src/pages/Investigation.tsx`, and `sentinel-frontend/src/pages/Analytics.tsx`; authentication and authorization gates are client-side components under `sentinel-frontend/src/components/auth/`.

#### Runtime and External Dependencies
Backend runtime is Python with Flask and ML dependencies declared in `backend/requirements.txt`; model persistence is filesystem-based rather than a separate model-serving platform. Frontend runtime is Node/Vite with package definitions in `sentinel-frontend/package.json`. An optional local LLM copilot integration is isolated behind `backend/llm/ollama_client.py` and prompt definitions in `backend/llm/prompts.py`, preventing it from being a dependency of the primary detection pipeline.

Main entry points: [`backend/app.py`](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/app.py) (Flask REST API), [`backend/processor.py`](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/processor.py) (Event processor), [`backend/data_loader.py`](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/data_loader.py) (Telemetry buffer), [`backend/ml/predictor.py`](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/predictor.py) (RF predictor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_live["Live Detection"]
  node_api["Flask REST API<br/>Python / Flask<br/>[app.py]"]
  node_loader["Telemetry buffer<br/>runtime data<br/>[data_loader.py]"]
  node_telemetry_csv["Telemetry CSV<br/>CSV snapshots<br/>[events.csv]"]
  node_processor["Event processor<br/>risk engine<br/>[processor.py]"]
  node_correlation["Incident correlation<br/>correlation engine"]
  node_analyzer["Security analyzer<br/>posture analytics<br/>[analyzer.py]"]
end

subgraph group_ml["ML &amp; Governance"]
  node_features["Behavior features<br/>feature extraction<br/>[features.py]"]
  node_predictor["RF predictor<br/>ML inference<br/>[predictor.py]"]
  node_fusion["Hybrid fusion<br/>score fusion<br/>[fusion.py]"]
  node_registry[("Model registry<br/>model governance<br/>[model_registry.py]")]
  node_model_artifact["Production model<br/>pickle artifact"]
  node_dataset["Verified dataset<br/>training data builder<br/>[dataset_builder.py]"]
  node_trainer["Candidate trainer<br/>model training<br/>[trainer.py]"]
  node_evaluator["Model evaluator<br/>evaluation<br/>[evaluator.py]"]
end

subgraph group_sim["Telemetry Simulation"]
  node_simulator["Simulator controls<br/>background simulator<br/>[simulator.py]"]
  node_generator["Event generator<br/>telemetry generator<br/>[event_generator.py]"]
  node_scenarios["Attack scenarios<br/>scenario definitions<br/>[scenarios.py]"]
end

subgraph group_ui["SOC Console"]
  node_frontend_api["Frontend API client<br/>TypeScript API boundary<br/>[api.ts]"]
  node_security_hook["Security data polling<br/>React data hook<br/>[useSecurityData.ts]"]
  node_app_ui["SOC console<br/>React application<br/>[App.tsx]"]
end

node_llm{{"Optional LLM copilot<br/>Ollama client<br/>[ollama_client.py]"}}

node_telemetry_csv -->|"load snapshots"| node_loader
node_api -->|"ingest events"| node_loader
node_loader -->|"validated telemetry"| node_processor
node_processor -->|"behavior signals"| node_features
node_features -->|"feature vector"| node_predictor
node_model_artifact -->|"load model"| node_predictor
node_processor -->|"deterministic scores"| node_fusion
node_predictor -->|"ML probability"| node_fusion
node_fusion -->|"enriched assessments"| node_correlation
node_correlation -->|"incidents"| node_analyzer
node_api -->|"alerts and analysis"| node_analyzer
node_api -.->|"analyst feedback"| node_dataset
node_dataset -->|"training dataset"| node_trainer
node_trainer -->|"candidate model"| node_evaluator
node_evaluator -->|"evaluation decision"| node_registry
node_registry -->|"promote or rollback"| node_model_artifact
node_scenarios -->|"scenario stages"| node_generator
node_simulator -->|"lifecycle control"| node_generator
node_generator -->|"simulated events"| node_api
node_api -->|"simulator endpoints"| node_simulator
node_app_ui -->|"operator views"| node_security_hook
node_security_hook -->|"poll and fetch"| node_frontend_api
node_frontend_api -->|"REST requests"| node_api
node_api -.->|"optional copilot request"| node_llm

click node_api "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/app.py"
click node_loader "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/data_loader.py"
click node_telemetry_csv "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/data/events.csv"
click node_processor "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/processor.py"
click node_correlation "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/incident_correlation.py"
click node_analyzer "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/analyzer.py"
click node_features "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/features.py"
click node_predictor "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/predictor.py"
click node_fusion "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/fusion.py"
click node_registry "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/registry/model_registry.py"
click node_model_artifact "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/artifacts/sentinel_rf_model.pkl"
click node_dataset "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/dataset_builder.py"
click node_trainer "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/trainer.py"
click node_evaluator "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/evaluator.py"
click node_simulator "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/telemetry/simulator.py"
click node_generator "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/telemetry/event_generator.py"
click node_scenarios "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/telemetry/scenarios.py"
click node_frontend_api "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/sentinel-frontend/src/services/api.ts"
click node_security_hook "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/sentinel-frontend/src/hooks/useSecurityData.ts"
click node_app_ui "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/sentinel-frontend/src/App.tsx"
click node_llm "https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/llm/ollama_client.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_api,node_loader,node_telemetry_csv,node_processor,node_correlation,node_analyzer toneBlue
class node_features,node_predictor,node_fusion,node_registry,node_model_artifact,node_dataset,node_trainer,node_evaluator toneAmber
class node_simulator,node_generator,node_scenarios toneMint
class node_frontend_api,node_security_hook,node_app_ui toneRose
class node_llm toneNeutral
```

## Components

### Live Detection

Synchronous telemetry-to-assessment path.

- [Flask REST API](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/app.py): Python / Flask · Event ingestion and SOC control surface. · `backend/app.py`
- [Telemetry buffer](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/data_loader.py): runtime data · Validates snapshots and retains recent events. · `backend/data_loader.py`
- [Telemetry CSV](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/data/events.csv): CSV snapshots · `data/events.csv`
- [Event processor](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/processor.py): risk engine · Computes behavioral, sequence, and contextual risk. · `backend/processor.py`
- [Incident correlation](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/incident_correlation.py): correlation engine · Groups multi-stage sequences into incidents. · `backend/incident_correlation.py`
- [Security analyzer](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/analyzer.py): posture analytics · Serves enterprise aggregations and posture. · `backend/analyzer.py`

### ML & Governance

Inference and decoupled model lifecycle.

- [Behavior features](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/features.py): feature extraction · Builds bounded 10-dimensional vectors. · `backend/ml/features.py`
- [RF predictor](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/predictor.py): ML inference · `backend/ml/predictor.py`
- [Hybrid fusion](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/fusion.py): score fusion · Falls back to deterministic scoring when ML is unavailable. · `backend/ml/fusion.py`
- [Model registry](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/registry/model_registry.py): model governance · Controls candidate promotion and rollback. · `backend/ml/registry/model_registry.py`
- [Production model](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/artifacts/sentinel_rf_model.pkl): pickle artifact · `backend/ml/artifacts/sentinel_rf_model.pkl`
- [Verified dataset](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/dataset_builder.py): training data builder · Converts analyst feedback into training data. · `backend/ml/dataset_builder.py`
- [Candidate trainer](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/trainer.py): model training · `backend/ml/trainer.py`
- [Model evaluator](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/ml/evaluator.py): evaluation · `backend/ml/evaluator.py`

### Telemetry Simulation

- [Simulator controls](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/telemetry/simulator.py): background simulator · Owns start, pause, stop, reset, and step lifecycle. · `backend/telemetry/simulator.py`
- [Event generator](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/telemetry/event_generator.py): telemetry generator · Creates schema-compliant legitimate and attack events. · `backend/telemetry/event_generator.py`
- [Attack scenarios](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/telemetry/scenarios.py): scenario definitions · `backend/telemetry/scenarios.py`

### SOC Console

- [Frontend API client](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/sentinel-frontend/src/services/api.ts): TypeScript API boundary · `sentinel-frontend/src/services/api.ts`
- [Security data polling](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/sentinel-frontend/src/hooks/useSecurityData.ts): React data hook · `sentinel-frontend/src/hooks/useSecurityData.ts`
- [SOC console](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/sentinel-frontend/src/App.tsx): React application · Dashboard, investigation, analytics, and client-side auth workflows. · `sentinel-frontend/src/App.tsx`

### Other components

- [Optional LLM copilot](https://github.com/muthukkumaranb/vitcsiorigins/blob/main/backend/llm/ollama_client.py): Ollama client · Isolated from the primary detection pipeline. · `backend/llm/ollama_client.py`

## Connections

- Telemetry CSV → Telemetry buffer: load snapshots
- Flask REST API → Telemetry buffer: ingest events
- Telemetry buffer → Event processor: validated telemetry
- Event processor → Behavior features: behavior signals
- Behavior features → RF predictor: feature vector
- Production model → RF predictor: load model
- Event processor → Hybrid fusion: deterministic scores
- RF predictor → Hybrid fusion: ML probability
- Hybrid fusion → Incident correlation: enriched assessments
- Incident correlation → Security analyzer: incidents
- Flask REST API → Security analyzer: alerts and analysis
- Flask REST API → Verified dataset: analyst feedback
- Verified dataset → Candidate trainer: training dataset
- Candidate trainer → Model evaluator: candidate model
- Model evaluator → Model registry: evaluation decision
- Model registry → Production model: promote or rollback
- Attack scenarios → Event generator: scenario stages
- Simulator controls → Event generator: lifecycle control
- Event generator → Flask REST API: simulated events
- Flask REST API → Simulator controls: simulator endpoints
- SOC console → Security data polling: operator views
- Security data polling → Frontend API client: poll and fetch
- Frontend API client → Flask REST API: REST requests
- Flask REST API → Optional LLM copilot: optional copilot request
