# siddheshg01/anomaly-sentinel architecture

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

- Interactive diagram: https://gitdiagram.com/siddheshg01/anomaly-sentinel
- Repository: https://github.com/siddheshg01/anomaly-sentinel

## Overview

Anomaly Sentinel monitors Excel business metrics through a command-line run or an interactive dashboard. Both entry points load and analyze metrics; the command-line workflow additionally gates email alerts by risk and writes alert logs and anomaly reports. The dashboard supports uploaded workbooks, visualizes trends, and presents insights and investigation recommendations. The source excerpts show the principal calls and file outputs; the README also documents the monitoring capabilities. The dashboard’s direct upload parsing and the AI/email external integrations are represented separately.

Main entry points: [`src/main.py`](https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/main.py) (Monitor Runner), [`dashboard.py`](https://github.com/siddheshg01/anomaly-sentinel/blob/main/dashboard.py) (Monitoring Dashboard), [`src/data_loader.py`](https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/data_loader.py) (Excel Data Loader), [`src/ai_summarizer.py`](https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/ai_summarizer.py) (AI Summary)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Interfaces"]
  node_cli["Monitor Runner<br/>[main.py]"]
  node_dashboard["Monitoring Dashboard<br/>[dashboard.py]"]
end

subgraph group_analysis["Metric Analysis"]
  node_config["Monitoring Settings<br/>[config.py]"]
  node_loader["Excel Data Loader<br/>[data_loader.py]"]
  node_workbook["Business Workbook<br/>[business_data.xlsx]"]
  node_detector["Anomaly Analysis"]
end

subgraph group_insight["Business Interpretation"]
  node_rules["Business Insights<br/>[business_rules.py]"]
  node_summarizer["AI Summary<br/>[ai_summarizer.py]"]
end

subgraph group_delivery["Alerts and Outputs"]
  node_email["Email Alert Sender<br/>[email_alert.py]"]
  node_alertlog["Alert Log"]
  node_report["Anomaly CSV Report<br/>[anomaly_report.csv]"]
end

node_analyst(("Analyst"))
node_openai{{"OpenAI API"}}
node_smtp{{"SMTP Service"}}

node_analyst -->|"uploads or views"| node_dashboard
node_cli -->|"loads data"| node_loader
node_dashboard -->|"loads sample"| node_loader
node_loader -->|"reads workbook"| node_workbook
node_dashboard -->|"parses upload"| node_workbook
node_cli -->|"uses settings"| node_config
node_dashboard -->|"uses settings"| node_config
node_cli -->|"analyzes metrics"| node_detector
node_dashboard -->|"analyzes metrics"| node_detector
node_cli -->|"generates insights"| node_rules
node_dashboard -->|"generates insights"| node_rules
node_cli -->|"generates summary"| node_summarizer
node_dashboard -->|"generates summary"| node_summarizer
node_summarizer -.->|"requests summary"| node_openai
node_cli -->|"sends on threshold"| node_email
node_email -->|"sends message"| node_smtp
node_cli -->|"appends sent alert"| node_alertlog
node_cli -->|"writes anomalies"| node_report

click node_cli "https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/main.py"
click node_dashboard "https://github.com/siddheshg01/anomaly-sentinel/blob/main/dashboard.py"
click node_config "https://github.com/siddheshg01/anomaly-sentinel/blob/main/config.py"
click node_loader "https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/data_loader.py"
click node_workbook "https://github.com/siddheshg01/anomaly-sentinel/blob/main/data/business_data.xlsx"
click node_detector "https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/anomaly_detector.py"
click node_rules "https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/business_rules.py"
click node_summarizer "https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/ai_summarizer.py"
click node_email "https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/email_alert.py"
click node_alertlog "https://github.com/siddheshg01/anomaly-sentinel/tree/main/logs"
click node_report "https://github.com/siddheshg01/anomaly-sentinel/blob/main/reports/anomaly_report.csv"

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_cli,node_dashboard toneBlue
class node_config,node_loader,node_workbook,node_detector toneAmber
class node_rules,node_summarizer,node_openai toneMint
class node_email,node_alertlog,node_report toneRose
class node_analyst,node_smtp toneIndigo
```

## Components

### User Interfaces

- [Monitor Runner](https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/main.py): `src/main.py`
- [Monitoring Dashboard](https://github.com/siddheshg01/anomaly-sentinel/blob/main/dashboard.py): `dashboard.py`

### Metric Analysis

- [Monitoring Settings](https://github.com/siddheshg01/anomaly-sentinel/blob/main/config.py): `config.py`
- [Excel Data Loader](https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/data_loader.py): `src/data_loader.py`
- [Business Workbook](https://github.com/siddheshg01/anomaly-sentinel/blob/main/data/business_data.xlsx): `data/business_data.xlsx`
- [Anomaly Analysis](https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/anomaly_detector.py): `src/anomaly_detector.py`

### Business Interpretation

- [Business Insights](https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/business_rules.py): `src/business_rules.py`
- [AI Summary](https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/ai_summarizer.py): `src/ai_summarizer.py`

### Alerts and Outputs

- [Email Alert Sender](https://github.com/siddheshg01/anomaly-sentinel/blob/main/src/email_alert.py): `src/email_alert.py`
- [Alert Log](https://github.com/siddheshg01/anomaly-sentinel/tree/main/logs): `logs`
- [Anomaly CSV Report](https://github.com/siddheshg01/anomaly-sentinel/blob/main/reports/anomaly_report.csv): `reports/anomaly_report.csv`

### Other components

- **Analyst**
- **OpenAI API**
- **SMTP Service**

## Connections

- Analyst → Monitoring Dashboard: uploads or views (evidence: `dashboard.py`)
- Monitor Runner → Excel Data Loader: loads data (evidence: `src/main.py`)
- Monitoring Dashboard → Excel Data Loader: loads sample (evidence: `dashboard.py`)
- Excel Data Loader → Business Workbook: reads workbook (evidence: `src/data_loader.py`)
- Monitoring Dashboard → Business Workbook: parses upload (evidence: `dashboard.py`)
- Monitor Runner → Monitoring Settings: uses settings (evidence: `src/main.py`)
- Monitoring Dashboard → Monitoring Settings: uses settings (evidence: `dashboard.py`)
- Monitor Runner → Anomaly Analysis: analyzes metrics (evidence: `src/main.py`)
- Monitoring Dashboard → Anomaly Analysis: analyzes metrics (evidence: `dashboard.py`)
- Monitor Runner → Business Insights: generates insights (evidence: `src/main.py`)
- Monitoring Dashboard → Business Insights: generates insights (evidence: `dashboard.py`)
- Monitor Runner → AI Summary: generates summary (evidence: `src/main.py`)
- Monitoring Dashboard → AI Summary: generates summary (evidence: `dashboard.py`)
- AI Summary → OpenAI API: requests summary (evidence: `src/ai_summarizer.py`)
- Monitor Runner → Email Alert Sender: sends on threshold (evidence: `src/main.py`)
- Email Alert Sender → SMTP Service: sends message (evidence: `src/email_alert.py`)
- Monitor Runner → Alert Log: appends sent alert (evidence: `src/main.py`)
- Monitor Runner → Anomaly CSV Report: writes anomalies (evidence: `src/main.py`)
