# thangallapallysiddu-10/insider-threat architecture

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

- Interactive diagram: https://gitdiagram.com/thangallapallysiddu-10/insider-threat
- Repository: https://github.com/thangallapallysiddu-10/insider-threat

## Overview

This Django application supports account registration and admin approval, then lets active users train cyberattack classifiers from uploaded CSV data, predict attack types from incident details, and view exploratory charts and model comparisons. The main path runs from routed requests through user views to training or prediction; trained models and preprocessing artifacts are persisted for later predictions. Admin and analytics features are separate branches. The README is empty, and the excerpts do not establish the charts’ dataset source or every URL-to-template relationship, so those links are not inferred.

Main entry points: [`users/views.py`](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/views.py) (User workflows), [`threat_detection/urls.py`](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/threat_detection/urls.py) (URL routes), [`admins/views.py`](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/admins/views.py) (Admin workflows), [`eda.py`](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/eda.py) (Graph workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web routing"]
  node_router["URL routes<br/>[urls.py]"]
  node_user_pages["User pages"]
  node_admin_pages["Admin pages"]
end

subgraph group_accounts["Accounts and admin"]
  node_user_views["User workflows<br/>[views.py]"]
  node_registration_form["Registration validation<br/>[forms.py]"]
  node_admin_views["Admin workflows<br/>[views.py]"]
  node_user_records["User records<br/>[models.py]"]
  node_admin_records["Admin models<br/>[models.py]"]
  node_sqlite[("SQLite database<br/>[db.sqlite3]")]
end

subgraph group_ml["Threat classification"]
  node_training["Model training<br/>[views.py]"]
  node_uploaded_csv["Uploaded dataset"]
  node_preprocessing["Feature preprocessing<br/>[views.py]"]
  node_model_store[("Saved classifiers")]
  node_encoder_store[("Encoders and scaler")]
  node_prediction["Attack prediction<br/>[views.py]"]
end

subgraph group_analytics["Exploration and state"]
  node_eda["Chart generation<br/>[eda.py]"]
  node_graph_view["Graph workflow<br/>[eda.py]"]
  node_graph_cache[("Graph cache<br/>[graph_cache.json]")]
end

node_visitor(("User"))

node_visitor -->|"sends request"| node_router
node_router -->|"dispatches user"| node_user_views
node_router -->|"dispatches admin"| node_admin_views
node_router -->|"dispatches graphs"| node_graph_view
node_user_views -->|"validates registration"| node_registration_form
node_user_views -->|"reads and writes"| node_user_records
node_user_records -->|"persists records"| node_sqlite
node_admin_views -->|"reads and updates"| node_user_records
node_admin_views -->|"uses models"| node_admin_records
node_admin_records -->|"persists records"| node_sqlite
node_user_views -->|"handles training"| node_training
node_training -->|"reads upload"| node_uploaded_csv
node_training -->|"prepares data"| node_preprocessing
node_preprocessing -->|"writes encoders"| node_encoder_store
node_training -->|"saves classifiers"| node_model_store
node_user_views -->|"handles prediction"| node_prediction
node_prediction -->|"loads transforms"| node_encoder_store
node_prediction -->|"loads classifier"| node_model_store
node_user_views -->|"renders pages"| node_user_pages
node_admin_views -->|"renders pages"| node_admin_pages
node_graph_view -->|"reads and writes"| node_graph_cache
node_graph_view -->|"builds charts"| node_eda

click node_router "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/threat_detection/urls.py"
click node_user_views "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/views.py"
click node_registration_form "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/forms.py"
click node_admin_views "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/admins/views.py"
click node_user_records "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/models.py"
click node_admin_records "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/admins/models.py"
click node_sqlite "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/db.sqlite3"
click node_training "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/views.py"
click node_preprocessing "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/views.py"
click node_model_store "https://github.com/thangallapallysiddu-10/insider-threat/tree/main/media/saved_models"
click node_encoder_store "https://github.com/thangallapallysiddu-10/insider-threat/tree/main/media/saved_encoders"
click node_prediction "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/views.py"
click node_eda "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/eda.py"
click node_graph_view "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/eda.py"
click node_graph_cache "https://github.com/thangallapallysiddu-10/insider-threat/blob/main/media/cache/graph_cache.json"
click node_user_pages "https://github.com/thangallapallysiddu-10/insider-threat/tree/main/templates/users"
click node_admin_pages "https://github.com/thangallapallysiddu-10/insider-threat/tree/main/templates/admins"

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_router,node_user_pages,node_admin_pages,node_visitor toneBlue
class node_user_views,node_registration_form,node_admin_views,node_user_records,node_admin_records,node_sqlite toneAmber
class node_training,node_uploaded_csv,node_preprocessing,node_model_store,node_encoder_store,node_prediction toneMint
class node_eda,node_graph_view,node_graph_cache toneRose
```

## Components

### Web routing

- [URL routes](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/threat_detection/urls.py): `threat_detection/urls.py`
- [User pages](https://github.com/thangallapallysiddu-10/insider-threat/tree/main/templates/users): `templates/users`
- [Admin pages](https://github.com/thangallapallysiddu-10/insider-threat/tree/main/templates/admins): `templates/admins`

### Accounts and admin

- [User workflows](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/views.py): `users/views.py`
- [Registration validation](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/forms.py): `users/forms.py`
- [Admin workflows](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/admins/views.py): `admins/views.py`
- [User records](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/models.py): `users/models.py`
- [Admin models](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/admins/models.py): `admins/models.py`
- [SQLite database](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/db.sqlite3): `db.sqlite3`

### Threat classification

- [Model training](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/views.py): `users/views.py`
- **Uploaded dataset**
- [Feature preprocessing](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/views.py): `users/views.py`
- [Saved classifiers](https://github.com/thangallapallysiddu-10/insider-threat/tree/main/media/saved_models): `media/saved_models`
- [Encoders and scaler](https://github.com/thangallapallysiddu-10/insider-threat/tree/main/media/saved_encoders): `media/saved_encoders`
- [Attack prediction](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/users/views.py): `users/views.py`

### Exploration and state

- [Chart generation](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/eda.py): `eda.py`
- [Graph workflow](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/eda.py): `eda.py`
- [Graph cache](https://github.com/thangallapallysiddu-10/insider-threat/blob/main/media/cache/graph_cache.json): `media/cache/graph_cache.json`

### Other components

- **User**

## Connections

- User → URL routes: sends request
- URL routes → User workflows: dispatches user
- URL routes → Admin workflows: dispatches admin
- URL routes → Graph workflow: dispatches graphs
- User workflows → Registration validation: validates registration
- User workflows → User records: reads and writes
- User records → SQLite database: persists records
- Admin workflows → User records: reads and updates
- Admin workflows → Admin models: uses models
- Admin models → SQLite database: persists records
- User workflows → Model training: handles training
- Model training → Uploaded dataset: reads upload
- Model training → Feature preprocessing: prepares data
- Feature preprocessing → Encoders and scaler: writes encoders
- Model training → Saved classifiers: saves classifiers
- User workflows → Attack prediction: handles prediction
- Attack prediction → Encoders and scaler: loads transforms
- Attack prediction → Saved classifiers: loads classifier
- User workflows → User pages: renders pages
- Admin workflows → Admin pages: renders pages
- Graph workflow → Graph cache: reads and writes
- Graph workflow → Chart generation: builds charts
