# codingnuz/innovation-g2 architecture

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

- Interactive diagram: https://gitdiagram.com/codingnuz/innovation-g2
- Repository: https://github.com/codingnuz/innovation-g2

## Overview

Innovation-G2 is a spam, malware, and process-detection application: users submit text, files, or process counters through a React interface; FastAPI dispatches requests to the corresponding prediction path and returns results. The Assistant adds tool-driven chat and attachment analysis, while training and data preparation produce the models used at runtime. The graph preserves the documented product branches, but some backend endpoint wiring and unsampled training details are represented only where the README or source index supports them.

Main entry points: [`frontend-react/src/App.jsx`](https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/App.jsx) (App shell), [`frontend-react/src/api/client.js`](https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/api/client.js) (API client), [`spam_malware_detection_model/predict.py`](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/predict.py) (Prediction entry), [`innovation-g2/main.py`](https://github.com/codingnuz/innovation-g2/blob/main/innovation-g2/main.py) (FastAPI service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React interface"]
  node_app["App shell<br/>[App.jsx]"]
  node_spam_ui["Spam screen<br/>[SpamView.jsx]"]
  node_malware_ui["Malware screen<br/>[MalwareView.jsx]"]
  node_process_ui["Process screen<br/>[ProcessView.jsx]"]
  node_chat_ui["Assistant chat<br/>[ChatView.jsx]"]
  node_history_ui["History view<br/>[HistoryView.jsx]"]
  node_api_client["API client<br/>[client.js]"]
end

subgraph group_service["API and assistant"]
  node_fastapi["FastAPI service<br/>[main.py]"]
  node_agent["Chat agent<br/>[agent.py]"]
  node_attachments["Attachment analysis<br/>[attachments.py]"]
  node_malware_scan["Upload scan<br/>[malware_scan.py]"]
end

subgraph group_inference["Prediction runtime"]
  node_predict["Prediction entry<br/>[predict.py]"]
  node_spam_infer["Spam inference<br/>[spam.py]"]
  node_malware_infer["Malware inference<br/>[malware.py]"]
  node_process_infer["Process inference<br/>[process.py]"]
  node_scan_router["Format router<br/>[router.py]"]
end

subgraph group_models["Model development"]
  node_train_all["Training orchestrator<br/>[run_all.py]"]
  node_spam_train["Spam training<br/>[train.py]"]
  node_malware_train["Tabular malware training<br/>[train.py]"]
  node_engine_train["File model training<br/>[train_pipeline.py]"]
  node_regression_train["Process training<br/>[train.py]"]
  node_bundle[("Saved model bundle<br/>[paths.py]")]
end

node_person(("User"))
node_llm{{"OpenAI-compatible server"}}

node_person -->|"uses"| node_app
node_app -->|"shows"| node_spam_ui
node_app -->|"shows"| node_malware_ui
node_app -->|"shows"| node_process_ui
node_app -->|"shows"| node_chat_ui
node_app -->|"shows"| node_history_ui
node_app -->|"checks health"| node_api_client
node_spam_ui -.->|"requests predictions"| node_api_client
node_malware_ui -->|"requests scans"| node_api_client
node_process_ui -.->|"requests predictions"| node_api_client
node_chat_ui -.->|"streams chat"| node_api_client
node_malware_ui -->|"uploads files"| node_api_client
node_api_client -->|"calls API"| node_fastapi
node_fastapi -->|"dispatches predictions"| node_predict
node_fastapi -->|"runs chat"| node_agent
node_fastapi -->|"passes attachments"| node_attachments
node_fastapi -->|"dispatches uploads"| node_malware_scan
node_agent -->|"uses attachment tools"| node_attachments
node_agent -->|"requests completions"| node_llm
node_attachments -->|"routes file formats"| node_scan_router
node_attachments -->|"scores attachment content"| node_predict
node_malware_scan -.->|"identifies formats"| node_scan_router
node_predict -->|"delegates spam"| node_spam_infer
node_predict -->|"delegates malware"| node_malware_infer
node_predict -->|"delegates process"| node_process_infer
node_person -->|"runs training"| node_train_all
node_train_all -->|"invokes"| node_spam_train
node_train_all -->|"invokes"| node_malware_train
node_train_all -->|"invokes"| node_engine_train
node_train_all -->|"invokes"| node_regression_train
node_spam_train -.->|"saves model"| node_bundle
node_malware_train -.->|"saves models"| node_bundle
node_engine_train -->|"saves specialists"| node_bundle
node_regression_train -.->|"saves model"| node_bundle
node_predict -->|"loads models"| node_bundle

click node_app "https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/App.jsx"
click node_spam_ui "https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/views/SpamView.jsx"
click node_malware_ui "https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/views/MalwareView.jsx"
click node_process_ui "https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/views/ProcessView.jsx"
click node_chat_ui "https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/views/ChatView.jsx"
click node_history_ui "https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/views/HistoryView.jsx"
click node_api_client "https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/api/client.js"
click node_fastapi "https://github.com/codingnuz/innovation-g2/blob/main/innovation-g2/main.py"
click node_agent "https://github.com/codingnuz/innovation-g2/blob/main/innovation-g2/agent.py"
click node_attachments "https://github.com/codingnuz/innovation-g2/blob/main/innovation-g2/attachments.py"
click node_malware_scan "https://github.com/codingnuz/innovation-g2/blob/main/innovation-g2/malware_scan.py"
click node_predict "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/predict.py"
click node_spam_infer "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/inference/spam.py"
click node_malware_infer "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/inference/malware.py"
click node_process_infer "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/inference/process.py"
click node_scan_router "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/malware_engine/inference/router.py"
click node_train_all "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/training/run_all.py"
click node_spam_train "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/spam/train.py"
click node_malware_train "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/malware_tabular/train.py"
click node_engine_train "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/malware_engine/training/train_pipeline.py"
click node_regression_train "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/regression/train.py"
click node_bundle "https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/config/paths.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_app,node_spam_ui,node_malware_ui,node_process_ui,node_chat_ui,node_history_ui,node_api_client,node_person toneBlue
class node_fastapi,node_agent,node_attachments,node_malware_scan toneAmber
class node_predict,node_spam_infer,node_malware_infer,node_process_infer,node_scan_router,node_llm toneMint
class node_train_all,node_spam_train,node_malware_train,node_engine_train,node_regression_train,node_bundle toneRose
```

## Components

### React interface

- [App shell](https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/App.jsx): `frontend-react/src/App.jsx`
- [Spam screen](https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/views/SpamView.jsx): `frontend-react/src/views/SpamView.jsx`
- [Malware screen](https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/views/MalwareView.jsx): `frontend-react/src/views/MalwareView.jsx`
- [Process screen](https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/views/ProcessView.jsx): `frontend-react/src/views/ProcessView.jsx`
- [Assistant chat](https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/views/ChatView.jsx): `frontend-react/src/views/ChatView.jsx`
- [History view](https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/views/HistoryView.jsx): `frontend-react/src/views/HistoryView.jsx`
- [API client](https://github.com/codingnuz/innovation-g2/blob/main/frontend-react/src/api/client.js): `frontend-react/src/api/client.js`

### API and assistant

- [FastAPI service](https://github.com/codingnuz/innovation-g2/blob/main/innovation-g2/main.py): `innovation-g2/main.py`
- [Chat agent](https://github.com/codingnuz/innovation-g2/blob/main/innovation-g2/agent.py): `innovation-g2/agent.py`
- [Attachment analysis](https://github.com/codingnuz/innovation-g2/blob/main/innovation-g2/attachments.py): `innovation-g2/attachments.py`
- [Upload scan](https://github.com/codingnuz/innovation-g2/blob/main/innovation-g2/malware_scan.py): `innovation-g2/malware_scan.py`

### Prediction runtime

- [Prediction entry](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/predict.py): `spam_malware_detection_model/predict.py`
- [Spam inference](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/inference/spam.py): `spam_malware_detection_model/inference/spam.py`
- [Malware inference](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/inference/malware.py): `spam_malware_detection_model/inference/malware.py`
- [Process inference](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/inference/process.py): `spam_malware_detection_model/inference/process.py`
- [Format router](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/malware_engine/inference/router.py): `spam_malware_detection_model/malware_engine/inference/router.py`

### Model development

- [Training orchestrator](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/training/run_all.py): `spam_malware_detection_model/training/run_all.py`
- [Spam training](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/spam/train.py): `spam_malware_detection_model/spam/train.py`
- [Tabular malware training](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/malware_tabular/train.py): `spam_malware_detection_model/malware_tabular/train.py`
- [File model training](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/malware_engine/training/train_pipeline.py): `spam_malware_detection_model/malware_engine/training/train_pipeline.py`
- [Process training](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/regression/train.py): `spam_malware_detection_model/regression/train.py`
- [Saved model bundle](https://github.com/codingnuz/innovation-g2/blob/main/spam_malware_detection_model/config/paths.py): `spam_malware_detection_model/config/paths.py`

### Other components

- **User**
- **OpenAI-compatible server**

## Connections

- User → App shell: uses
- App shell → Spam screen: shows (evidence: `frontend-react/src/App.jsx`)
- App shell → Malware screen: shows (evidence: `frontend-react/src/App.jsx`)
- App shell → Process screen: shows (evidence: `frontend-react/src/App.jsx`)
- App shell → Assistant chat: shows (evidence: `frontend-react/src/App.jsx`)
- App shell → History view: shows (evidence: `frontend-react/src/App.jsx`)
- App shell → API client: checks health (evidence: `frontend-react/src/App.jsx`)
- Spam screen → API client: requests predictions
- Malware screen → API client: requests scans (evidence: `frontend-react/src/views/MalwareView.jsx`)
- Process screen → API client: requests predictions
- Assistant chat → API client: streams chat
- Malware screen → API client: uploads files (evidence: `frontend-react/src/views/MalwareView.jsx`)
- API client → FastAPI service: calls API
- FastAPI service → Prediction entry: dispatches predictions (evidence: `innovation-g2/main.py`)
- FastAPI service → Chat agent: runs chat (evidence: `innovation-g2/main.py`)
- FastAPI service → Attachment analysis: passes attachments (evidence: `innovation-g2/main.py`)
- FastAPI service → Upload scan: dispatches uploads (evidence: `innovation-g2/main.py`)
- Chat agent → Attachment analysis: uses attachment tools (evidence: `innovation-g2/agent.py`)
- Chat agent → OpenAI-compatible server: requests completions
- Attachment analysis → Format router: routes file formats (evidence: `innovation-g2/attachments.py`)
- Attachment analysis → Prediction entry: scores attachment content (evidence: `innovation-g2/attachments.py`)
- Upload scan → Format router: identifies formats
- Prediction entry → Spam inference: delegates spam (evidence: `spam_malware_detection_model/predict.py`)
- Prediction entry → Malware inference: delegates malware (evidence: `spam_malware_detection_model/predict.py`)
- Prediction entry → Process inference: delegates process (evidence: `spam_malware_detection_model/predict.py`)
- User → Training orchestrator: runs training
- Training orchestrator → Spam training: invokes (evidence: `spam_malware_detection_model/training/run_all.py`)
- Training orchestrator → Tabular malware training: invokes (evidence: `spam_malware_detection_model/training/run_all.py`)
- Training orchestrator → File model training: invokes (evidence: `spam_malware_detection_model/training/run_all.py`)
- Training orchestrator → Process training: invokes (evidence: `spam_malware_detection_model/training/run_all.py`)
- Spam training → Saved model bundle: saves model (evidence: `spam_malware_detection_model/spam/train.py`)
- Tabular malware training → Saved model bundle: saves models (evidence: `spam_malware_detection_model/malware_tabular/train.py`)
- File model training → Saved model bundle: saves specialists (evidence: `spam_malware_detection_model/malware_engine/training/train_pipeline.py`)
- Process training → Saved model bundle: saves model (evidence: `spam_malware_detection_model/regression/train.py`)
- Prediction entry → Saved model bundle: loads models (evidence: `spam_malware_detection_model/predict.py`)
