# jayyydrian/insighter architecture

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

- Interactive diagram: https://gitdiagram.com/jayyydrian/insighter
- Repository: https://github.com/jayyydrian/insighter

## Overview

InSighter is a local insider-threat monitoring application with a Flask backend and PyQt desktop client (plus a web dashboard). Users authenticate, then view role-appropriate risk dashboards and alerts; the backend ingests or simulates events, protects and stores them, scores behavior, and can generate AI alert explanations. Major branches include sector/UAV configuration, compliance and audit views, and external event-source integrations. Evidence is limited to the README and sampled excerpts/index references; unshown links are omitted.

Main entry points: [`app.py`](https://github.com/jayyydrian/insighter/blob/main/app.py) (Web backend), [`desktop_app/main.py`](https://github.com/jayyydrian/insighter/blob/main/desktop_app/main.py) (Desktop launcher), [`desktop_app/main_window.py`](https://github.com/jayyydrian/insighter/blob/main/desktop_app/main_window.py) (Main window), [`ingestion.py`](https://github.com/jayyydrian/insighter/blob/main/ingestion.py) (Event ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop client"]
  node_desktop["Desktop launcher<br/>[main.py]"]
  node_login["Login window<br/>[login_window.py]"]
  node_window["Main window<br/>[main_window.py]"]
  node_api["API client<br/>[api_client.py]"]
  node_async["Async workers<br/>[async_utils.py]"]
  node_dash["Dashboard and views<br/>[dashboard_tab.py]"]
  node_uav["UAV configuration<br/>[uav_config_tab.py]"]
end

subgraph group_backend["Backend and access"]
  node_flask["Web backend<br/>[app.py]"]
  node_auth["Login and RBAC<br/>[auth.py]"]
  node_sector["Sector taxonomy<br/>[sector_config.py]"]
  node_database[("Event database<br/>[database.py]")]
end

subgraph group_events["Event handling"]
  node_privacy["Privacy protection<br/>[privacy.py]"]
  node_ingestion["Event ingestion<br/>[ingestion.py]"]
  node_generator["Synthetic log generator<br/>[generate_logs.py]"]
  node_simulation["Live simulation<br/>[simulation.py]"]
end

subgraph group_analysis["Risk analysis"]
  node_model["Risk scoring<br/>[model.py]"]
  node_advisor["AI alert explanations<br/>[llm_advisor.py]"]
end

node_operator(("Analyst"))
node_source["External event source"]
node_ollama["Local Ollama"]

node_operator -->|"launches"| node_desktop
node_desktop -->|"opens"| node_login
node_desktop -->|"opens"| node_window
node_desktop -->|"starts backend"| node_flask
node_login -->|"authenticates via"| node_api
node_window -->|"shows"| node_dash
node_window -->|"shows"| node_uav
node_window -->|"requests data"| node_api
node_dash -->|"dispatches work"| node_async
node_api -->|"HTTP requests"| node_flask
node_flask -->|"checks access"| node_auth
node_flask -->|"gets scores"| node_model
node_flask -->|"requests explanation"| node_advisor
node_flask -->|"reseeds logs"| node_generator
node_flask -->|"runs tick"| node_simulation
node_flask -.->|"dispatches ingest"| node_ingestion
node_ingestion -->|"fetches events"| node_source
node_ingestion -->|"protects events"| node_privacy
node_ingestion -->|"stores events"| node_database
node_generator -->|"writes logs"| node_database
node_generator -->|"uses roster"| node_sector
node_generator -->|"uses activity profiles"| node_simulation
node_simulation -->|"stores events"| node_database
node_model -->|"reads and writes"| node_database
node_model -->|"sanitizes event"| node_privacy
node_model -->|"uses sector roles"| node_sector
node_advisor -.->|"queries model"| node_ollama
node_uav -.->|"requests settings"| node_api

click node_desktop "https://github.com/jayyydrian/insighter/blob/main/desktop_app/main.py"
click node_login "https://github.com/jayyydrian/insighter/blob/main/desktop_app/login_window.py"
click node_window "https://github.com/jayyydrian/insighter/blob/main/desktop_app/main_window.py"
click node_api "https://github.com/jayyydrian/insighter/blob/main/desktop_app/api_client.py"
click node_async "https://github.com/jayyydrian/insighter/blob/main/desktop_app/async_utils.py"
click node_dash "https://github.com/jayyydrian/insighter/blob/main/desktop_app/dashboard_tab.py"
click node_uav "https://github.com/jayyydrian/insighter/blob/main/desktop_app/uav_config_tab.py"
click node_flask "https://github.com/jayyydrian/insighter/blob/main/app.py"
click node_auth "https://github.com/jayyydrian/insighter/blob/main/auth.py"
click node_sector "https://github.com/jayyydrian/insighter/blob/main/sector_config.py"
click node_database "https://github.com/jayyydrian/insighter/blob/main/database.py"
click node_privacy "https://github.com/jayyydrian/insighter/blob/main/privacy.py"
click node_ingestion "https://github.com/jayyydrian/insighter/blob/main/ingestion.py"
click node_generator "https://github.com/jayyydrian/insighter/blob/main/generate_logs.py"
click node_simulation "https://github.com/jayyydrian/insighter/blob/main/simulation.py"
click node_model "https://github.com/jayyydrian/insighter/blob/main/model.py"
click node_advisor "https://github.com/jayyydrian/insighter/blob/main/llm_advisor.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_desktop,node_login,node_window,node_api,node_async,node_dash,node_uav toneBlue
class node_flask,node_auth,node_sector,node_database toneAmber
class node_privacy,node_ingestion,node_generator,node_simulation toneMint
class node_model,node_advisor toneRose
class node_operator,node_source,node_ollama toneIndigo
```

## Components

### Desktop client

- [Desktop launcher](https://github.com/jayyydrian/insighter/blob/main/desktop_app/main.py): `desktop_app/main.py`
- [Login window](https://github.com/jayyydrian/insighter/blob/main/desktop_app/login_window.py): `desktop_app/login_window.py`
- [Main window](https://github.com/jayyydrian/insighter/blob/main/desktop_app/main_window.py): `desktop_app/main_window.py`
- [API client](https://github.com/jayyydrian/insighter/blob/main/desktop_app/api_client.py): `desktop_app/api_client.py`
- [Async workers](https://github.com/jayyydrian/insighter/blob/main/desktop_app/async_utils.py): `desktop_app/async_utils.py`
- [Dashboard and views](https://github.com/jayyydrian/insighter/blob/main/desktop_app/dashboard_tab.py): `desktop_app/dashboard_tab.py`
- [UAV configuration](https://github.com/jayyydrian/insighter/blob/main/desktop_app/uav_config_tab.py): `desktop_app/uav_config_tab.py`

### Backend and access

- [Web backend](https://github.com/jayyydrian/insighter/blob/main/app.py): `app.py`
- [Login and RBAC](https://github.com/jayyydrian/insighter/blob/main/auth.py): `auth.py`
- [Sector taxonomy](https://github.com/jayyydrian/insighter/blob/main/sector_config.py): `sector_config.py`
- [Event database](https://github.com/jayyydrian/insighter/blob/main/database.py): `database.py`

### Event handling

- [Privacy protection](https://github.com/jayyydrian/insighter/blob/main/privacy.py): `privacy.py`
- [Event ingestion](https://github.com/jayyydrian/insighter/blob/main/ingestion.py): `ingestion.py`
- [Synthetic log generator](https://github.com/jayyydrian/insighter/blob/main/generate_logs.py): `generate_logs.py`
- [Live simulation](https://github.com/jayyydrian/insighter/blob/main/simulation.py): `simulation.py`

### Risk analysis

- [Risk scoring](https://github.com/jayyydrian/insighter/blob/main/model.py): `model.py`
- [AI alert explanations](https://github.com/jayyydrian/insighter/blob/main/llm_advisor.py): `llm_advisor.py`

### Other components

- **Analyst**
- **External event source**
- **Local Ollama**

## Connections

- Analyst → Desktop launcher: launches (evidence: `README.md`)
- Desktop launcher → Login window: opens (evidence: `desktop_app/main.py`)
- Desktop launcher → Main window: opens (evidence: `desktop_app/main.py`)
- Desktop launcher → Web backend: starts backend (evidence: `desktop_app/main.py`)
- Login window → API client: authenticates via (evidence: `desktop_app/login_window.py`)
- Main window → Dashboard and views: shows (evidence: `desktop_app/main_window.py`)
- Main window → UAV configuration: shows (evidence: `desktop_app/main_window.py`)
- Main window → API client: requests data (evidence: `desktop_app/main_window.py`)
- Dashboard and views → Async workers: dispatches work (evidence: `desktop_app/dashboard_tab.py`)
- API client → Web backend: HTTP requests (evidence: `desktop_app/api_client.py`)
- Web backend → Login and RBAC: checks access (evidence: `app.py`)
- Web backend → Risk scoring: gets scores (evidence: `app.py`)
- Web backend → AI alert explanations: requests explanation (evidence: `app.py`)
- Web backend → Synthetic log generator: reseeds logs (evidence: `app.py`)
- Web backend → Live simulation: runs tick (evidence: `app.py`)
- Web backend → Event ingestion: dispatches ingest (evidence: `app.py`)
- Event ingestion → External event source: fetches events (evidence: `ingestion.py`)
- Event ingestion → Privacy protection: protects events (evidence: `README.md`)
- Event ingestion → Event database: stores events (evidence: `ingestion.py`)
- Synthetic log generator → Event database: writes logs (evidence: `generate_logs.py`)
- Synthetic log generator → Sector taxonomy: uses roster (evidence: `generate_logs.py`)
- Synthetic log generator → Live simulation: uses activity profiles (evidence: `generate_logs.py`)
- Live simulation → Event database: stores events (evidence: `model.py`)
- Risk scoring → Event database: reads and writes (evidence: `model.py`)
- Risk scoring → Privacy protection: sanitizes event (evidence: `model.py`)
- Risk scoring → Sector taxonomy: uses sector roles (evidence: `model.py`)
- AI alert explanations → Local Ollama: queries model
- UAV configuration → API client: requests settings
