# deepak-rawat1/chitrgupt architecture

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

- Interactive diagram: https://gitdiagram.com/deepak-rawat1/chitrgupt
- Repository: https://github.com/deepak-rawat1/chitrgupt

## Overview

CHITRAGUPT is a prototype cyber-forensics investigation framework. Investigators upload logs to a case, where CSV or Windows Event XML ingestion normalizes evidence and events; the investigation pipeline applies scenario rules, correlation, anomaly detection, and evidence-backed inference. The API also supports case/event review, optional AI explanations, and downloadable reports, surfaced through a React dashboard. The graph combines excerpted calls, SOURCE INDEX references, and documented capabilities; several README stages and reporting/UI details are documented but their implementation was not fully sampled.

Main entry points: [`backend/app/main.py`](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/main.py) (Case API), [`backend/app/pipeline.py`](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/pipeline.py) (Investigation Pipeline), [`backend/app/database.py`](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/database.py) (Relational Database), [`frontend/src/App.jsx`](https://github.com/deepak-rawat1/chitrgupt/blob/main/frontend/src/App.jsx) (Case Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Evidence Intake"]
  node_csv_ingest["CSV Ingestion<br/>[ingestion.py]"]
  node_windows_ingest["Windows XML Ingestion"]
  node_evidence_files["Evidence Files"]
end

subgraph group_analysis["Investigation Analysis"]
  node_pipeline["Investigation Pipeline<br/>[pipeline.py]"]
  node_scenario_rules["Scenario Rules<br/>[rules.py]"]
  node_correlation["Event Correlation<br/>[correlation.py]"]
  node_features["Feature Extraction<br/>[features.py]"]
  node_isolation["Isolation Forest<br/>[anomaly.py]"]
  node_lof["Local Outlier Factor<br/>[lof.py]"]
  node_inference["Finding Inference<br/>[inference.py]"]
end

subgraph group_storage["Persistence"]
  node_anomaly_store["Anomaly Persistence"]
  node_finding_store["Finding Persistence"]
  node_orm["Investigation Records<br/>[models.py]"]
  node_database[("Relational Database<br/>[database.py]")]
end

subgraph group_access["Investigator Access"]
  node_dashboard["Case Dashboard<br/>[App.jsx]"]
  node_api["Case API<br/>[main.py]"]
  node_event_query["Event Search<br/>[queries.py]"]
  node_reports["Investigation Reports<br/>[reporting.py]"]
  node_ai_explanation["AI Explanation"]
end

node_investigator(("Investigator"))
node_external_ai{{"Ollama Service"}}

node_investigator -->|"uses"| node_dashboard
node_dashboard -->|"requests case data"| node_api
node_api -->|"ingests CSV"| node_csv_ingest
node_api -->|"ingests XML"| node_windows_ingest
node_api -->|"retains evidence"| node_evidence_files
node_api -->|"runs investigation"| node_pipeline
node_api -->|"serves event queries"| node_event_query
node_pipeline -->|"loads case events"| node_event_query
node_pipeline -->|"evaluates events"| node_scenario_rules
node_pipeline -->|"correlates events"| node_correlation
node_pipeline -->|"detects anomalies"| node_isolation
node_pipeline -->|"detects anomalies"| node_lof
node_pipeline -->|"infers findings"| node_inference
node_pipeline -->|"persists anomalies"| node_anomaly_store
node_pipeline -->|"persists findings"| node_finding_store
node_isolation -->|"uses features"| node_features
node_lof -->|"uses features"| node_features
node_evidence_files -->|"reads evidence records"| node_database
node_dashboard -->|"requests explanations"| node_api
node_api -->|"requests explanation"| node_ai_explanation
node_api -->|"generates reports"| node_reports
node_anomaly_store -->|"stores anomalies"| node_database
node_finding_store -->|"stores findings"| node_database
node_event_query -->|"queries events"| node_database
node_api -->|"reads and writes records"| node_database
node_ai_explanation -.->|"uses local model"| node_external_ai

click node_dashboard "https://github.com/deepak-rawat1/chitrgupt/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/main.py"
click node_csv_ingest "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/ingestion.py"
click node_windows_ingest "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/windows_event_ingestion.py"
click node_evidence_files "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/evidence_storage.py"
click node_event_query "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/queries.py"
click node_pipeline "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/pipeline.py"
click node_scenario_rules "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/rules.py"
click node_correlation "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/correlation.py"
click node_features "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/features.py"
click node_isolation "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/anomaly.py"
click node_lof "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/lof.py"
click node_inference "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/inference.py"
click node_anomaly_store "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/anomaly_persistence.py"
click node_finding_store "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/finding_persistence.py"
click node_orm "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/models.py"
click node_database "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/database.py"
click node_reports "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/reporting.py"
click node_ai_explanation "https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/ollama_explanation.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_csv_ingest,node_windows_ingest,node_evidence_files toneBlue
class node_pipeline,node_scenario_rules,node_correlation,node_features,node_isolation,node_lof,node_inference toneAmber
class node_anomaly_store,node_finding_store,node_orm,node_database toneMint
class node_dashboard,node_api,node_event_query,node_reports,node_ai_explanation toneRose
class node_investigator,node_external_ai toneIndigo
```

## Components

### Evidence Intake

- [CSV Ingestion](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/ingestion.py): `backend/app/ingestion.py`
- [Windows XML Ingestion](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/windows_event_ingestion.py): `backend/app/windows_event_ingestion.py`
- [Evidence Files](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/evidence_storage.py): `backend/app/evidence_storage.py`

### Investigation Analysis

- [Investigation Pipeline](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/pipeline.py): `backend/app/pipeline.py`
- [Scenario Rules](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/rules.py): `backend/app/rules.py`
- [Event Correlation](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/correlation.py): `backend/app/correlation.py`
- [Feature Extraction](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/features.py): `backend/app/features.py`
- [Isolation Forest](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/anomaly.py): `backend/app/anomaly.py`
- [Local Outlier Factor](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/lof.py): `backend/app/lof.py`
- [Finding Inference](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/inference.py): `backend/app/inference.py`

### Persistence

- [Anomaly Persistence](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/anomaly_persistence.py): `backend/app/anomaly_persistence.py`
- [Finding Persistence](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/finding_persistence.py): `backend/app/finding_persistence.py`
- [Investigation Records](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/models.py): `backend/app/models.py`
- [Relational Database](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/database.py): `backend/app/database.py`

### Investigator Access

- [Case Dashboard](https://github.com/deepak-rawat1/chitrgupt/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Case API](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/main.py): `backend/app/main.py`
- [Event Search](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/queries.py): `backend/app/queries.py`
- [Investigation Reports](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/reporting.py): `backend/app/reporting.py`
- [AI Explanation](https://github.com/deepak-rawat1/chitrgupt/blob/main/backend/app/ollama_explanation.py): `backend/app/ollama_explanation.py`

### Other components

- **Investigator**
- **Ollama Service**

## Connections

- Investigator → Case Dashboard: uses (evidence: `README.md`)
- Case Dashboard → Case API: requests case data (evidence: `frontend/src/App.jsx`)
- Case API → CSV Ingestion: ingests CSV (evidence: `backend/app/main.py`)
- Case API → Windows XML Ingestion: ingests XML (evidence: `backend/app/main.py`)
- Case API → Evidence Files: retains evidence (evidence: `backend/app/main.py`)
- Case API → Investigation Pipeline: runs investigation (evidence: `backend/app/main.py`)
- Case API → Event Search: serves event queries (evidence: `backend/app/main.py`)
- Investigation Pipeline → Event Search: loads case events (evidence: `backend/app/pipeline.py`)
- Investigation Pipeline → Scenario Rules: evaluates events (evidence: `backend/app/pipeline.py`)
- Investigation Pipeline → Event Correlation: correlates events (evidence: `backend/app/pipeline.py`)
- Investigation Pipeline → Isolation Forest: detects anomalies (evidence: `backend/app/pipeline.py`)
- Investigation Pipeline → Local Outlier Factor: detects anomalies (evidence: `backend/app/pipeline.py`)
- Investigation Pipeline → Finding Inference: infers findings (evidence: `backend/app/pipeline.py`)
- Investigation Pipeline → Anomaly Persistence: persists anomalies (evidence: `backend/app/pipeline.py`)
- Investigation Pipeline → Finding Persistence: persists findings (evidence: `backend/app/pipeline.py`)
- Isolation Forest → Feature Extraction: uses features (evidence: `backend/app/anomaly.py`)
- Local Outlier Factor → Feature Extraction: uses features (evidence: `backend/app/lof.py`)
- Evidence Files → Relational Database: reads evidence records (evidence: `backend/app/evidence_storage.py`)
- Case Dashboard → Case API: requests explanations (evidence: `frontend/src/App.jsx`)
- Case API → AI Explanation: requests explanation (evidence: `backend/app/main.py`)
- Case API → Investigation Reports: generates reports (evidence: `backend/app/main.py`)
- Anomaly Persistence → Relational Database: stores anomalies (evidence: `backend/app/anomaly_persistence.py`)
- Finding Persistence → Relational Database: stores findings (evidence: `backend/app/finding_persistence.py`)
- Event Search → Relational Database: queries events (evidence: `backend/app/queries.py`)
- Case API → Relational Database: reads and writes records (evidence: `backend/app/main.py`)
- AI Explanation → Ollama Service: uses local model
