# esvanth/quantumshield architecture

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

- Interactive diagram: https://gitdiagram.com/esvanth/quantumshield
- Repository: https://github.com/esvanth/quantumshield

## Overview

QuantumShield is an intrusion-detection system: network-flow datasets are preprocessed into scaled, PCA-reduced features, which feed classical and hybrid-quantum models. The deployed API loads those models and the evaluation-derived voting rule to classify traffic; SHAP provides ranked feature explanations. Evaluation also covers model metrics, hypotheses, ablations, and the QAE anomaly-detection capability. The README documents the dashboard and AWS deployment, but their runtime wiring is not shown in the sampled source, so those links are documented rather than inferred from imports.

Main entry points: [`deployment/api.py`](https://github.com/esvanth/quantumshield/blob/main/deployment/api.py) (Prediction API), [`evaluation/hypotheses.py`](https://github.com/esvanth/quantumshield/blob/main/evaluation/hypotheses.py) (Hypothesis evaluation), [`data/preprocessing.py`](https://github.com/esvanth/quantumshield/blob/main/data/preprocessing.py) (Feature preprocessing), [`models/quantum/circuits.py`](https://github.com/esvanth/quantumshield/blob/main/models/quantum/circuits.py) (Hybrid QNN)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_preprocess["Feature preprocessing<br/>[preprocessing.py]"]
  node_config["Data configuration<br/>[config.py]"]
end

subgraph group_models["Detection models"]
  node_dnn["DNN classifier<br/>[dnn.py]"]
  node_cnn["CNN classifier<br/>[cnn.py]"]
  node_lstm["LSTM classifier<br/>[lstm.py]"]
  node_qnn["Hybrid QNN<br/>[circuits.py]"]
  node_ensemble["Soft-voting ensemble<br/>[ensemble.py]"]
end

subgraph group_analysis["Evaluation and explanation"]
  node_hypotheses["Hypothesis evaluation<br/>[hypotheses.py]"]
  node_metrics["Model metrics<br/>[metrics.py]"]
  node_ablation["Ablation study<br/>[ablation.py]"]
  node_shap["SHAP explanations<br/>[shap_hybrid.py]"]
  node_results[("Evaluation results")]
end

subgraph group_deployment["Serving and interface"]
  node_api["Prediction API<br/>[api.py]"]
  node_dashboard["Dashboard<br/>[dashboard.py]"]
end

subgraph group_research["Quantum anomaly research"]
  node_qae["Quantum autoencoder<br/>[qae.py]"]
  node_qsvm["Quantum SVM<br/>[qsvm.py]"]
  node_qtrain["Hybrid training<br/>[train_hybrid.py]"]
end

node_dataset["Traffic datasets"]
node_client(("Traffic analyst or client"))
node_aws["AWS EC2"]

node_dataset -->|"provides flows"| node_preprocess
node_preprocess -->|"reads settings"| node_config
node_preprocess -->|"produces model features"| node_dnn
node_preprocess -->|"produces model features"| node_cnn
node_preprocess -->|"produces model features"| node_lstm
node_preprocess -->|"produces model features"| node_qnn
node_ensemble -->|"scores with"| node_dnn
node_ensemble -->|"scores with"| node_cnn
node_ensemble -->|"scores with"| node_lstm
node_ensemble -->|"scores with"| node_qnn
node_api -->|"loads model"| node_dnn
node_api -->|"loads model"| node_cnn
node_api -->|"loads model"| node_lstm
node_api -->|"loads model"| node_qnn
node_client -->|"requests prediction"| node_api
node_api -->|"returns classification"| node_client
node_api -->|"reads voting rule"| node_results
node_client -->|"views detections"| node_dashboard
node_dashboard -.->|"uses service"| node_api
node_api -->|"deployed on"| node_aws
node_hypotheses -->|"evaluates"| node_dnn
node_hypotheses -->|"evaluates"| node_cnn
node_hypotheses -->|"evaluates"| node_lstm
node_hypotheses -->|"evaluates"| node_qnn
node_hypotheses -.->|"computes measures"| node_metrics
node_hypotheses -->|"saves findings"| node_results
node_ablation -->|"compares models"| node_metrics
node_shap -->|"explains ensemble member"| node_dnn
node_shap -->|"explains ensemble member"| node_cnn
node_shap -->|"explains ensemble member"| node_lstm
node_shap -->|"explains ensemble member"| node_qnn
node_shap -->|"writes explanations"| node_results
node_qtrain -->|"trains circuit model"| node_qnn
node_qae -.->|"reports anomaly findings"| node_results
node_qsvm -.->|"optional experiment"| node_results

click node_preprocess "https://github.com/esvanth/quantumshield/blob/main/data/preprocessing.py"
click node_config "https://github.com/esvanth/quantumshield/blob/main/data/config.py"
click node_dnn "https://github.com/esvanth/quantumshield/blob/main/models/classical/dnn.py"
click node_cnn "https://github.com/esvanth/quantumshield/blob/main/models/classical/cnn.py"
click node_lstm "https://github.com/esvanth/quantumshield/blob/main/models/classical/lstm.py"
click node_qnn "https://github.com/esvanth/quantumshield/blob/main/models/quantum/circuits.py"
click node_ensemble "https://github.com/esvanth/quantumshield/blob/main/models/ensemble.py"
click node_qae "https://github.com/esvanth/quantumshield/blob/main/models/quantum/qae.py"
click node_qsvm "https://github.com/esvanth/quantumshield/blob/main/models/quantum/qsvm.py"
click node_qtrain "https://github.com/esvanth/quantumshield/blob/main/models/quantum/train_hybrid.py"
click node_api "https://github.com/esvanth/quantumshield/blob/main/deployment/api.py"
click node_dashboard "https://github.com/esvanth/quantumshield/blob/main/deployment/dashboard.py"
click node_hypotheses "https://github.com/esvanth/quantumshield/blob/main/evaluation/hypotheses.py"
click node_metrics "https://github.com/esvanth/quantumshield/blob/main/evaluation/metrics.py"
click node_ablation "https://github.com/esvanth/quantumshield/blob/main/evaluation/ablation.py"
click node_shap "https://github.com/esvanth/quantumshield/blob/main/explainability/shap_hybrid.py"
click node_results "https://github.com/esvanth/quantumshield/tree/main/results"

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_preprocess,node_config,node_client toneBlue
class node_dnn,node_cnn,node_lstm,node_qnn,node_ensemble toneAmber
class node_hypotheses,node_metrics,node_ablation,node_shap,node_results toneMint
class node_api,node_dashboard toneRose
class node_qae,node_qsvm,node_qtrain,node_dataset,node_aws toneIndigo
```

## Components

### Data preparation

- [Feature preprocessing](https://github.com/esvanth/quantumshield/blob/main/data/preprocessing.py): `data/preprocessing.py`
- [Data configuration](https://github.com/esvanth/quantumshield/blob/main/data/config.py): `data/config.py`

### Detection models

- [DNN classifier](https://github.com/esvanth/quantumshield/blob/main/models/classical/dnn.py): `models/classical/dnn.py`
- [CNN classifier](https://github.com/esvanth/quantumshield/blob/main/models/classical/cnn.py): `models/classical/cnn.py`
- [LSTM classifier](https://github.com/esvanth/quantumshield/blob/main/models/classical/lstm.py): `models/classical/lstm.py`
- [Hybrid QNN](https://github.com/esvanth/quantumshield/blob/main/models/quantum/circuits.py): `models/quantum/circuits.py`
- [Soft-voting ensemble](https://github.com/esvanth/quantumshield/blob/main/models/ensemble.py): `models/ensemble.py`

### Evaluation and explanation

- [Hypothesis evaluation](https://github.com/esvanth/quantumshield/blob/main/evaluation/hypotheses.py): `evaluation/hypotheses.py`
- [Model metrics](https://github.com/esvanth/quantumshield/blob/main/evaluation/metrics.py): `evaluation/metrics.py`
- [Ablation study](https://github.com/esvanth/quantumshield/blob/main/evaluation/ablation.py): `evaluation/ablation.py`
- [SHAP explanations](https://github.com/esvanth/quantumshield/blob/main/explainability/shap_hybrid.py): `explainability/shap_hybrid.py`
- [Evaluation results](https://github.com/esvanth/quantumshield/tree/main/results): `results`

### Serving and interface

- [Prediction API](https://github.com/esvanth/quantumshield/blob/main/deployment/api.py): `deployment/api.py`
- [Dashboard](https://github.com/esvanth/quantumshield/blob/main/deployment/dashboard.py): `deployment/dashboard.py`

### Quantum anomaly research

- [Quantum autoencoder](https://github.com/esvanth/quantumshield/blob/main/models/quantum/qae.py): `models/quantum/qae.py`
- [Quantum SVM](https://github.com/esvanth/quantumshield/blob/main/models/quantum/qsvm.py): `models/quantum/qsvm.py`
- [Hybrid training](https://github.com/esvanth/quantumshield/blob/main/models/quantum/train_hybrid.py): `models/quantum/train_hybrid.py`

### Other components

- **Traffic datasets**
- **Traffic analyst or client**
- **AWS EC2**

## Connections

- Traffic datasets → Feature preprocessing: provides flows (evidence: `README.md`)
- Feature preprocessing → Data configuration: reads settings (evidence: `data/preprocessing.py`)
- Feature preprocessing → DNN classifier: produces model features (evidence: `README.md`)
- Feature preprocessing → CNN classifier: produces model features (evidence: `README.md`)
- Feature preprocessing → LSTM classifier: produces model features (evidence: `README.md`)
- Feature preprocessing → Hybrid QNN: produces model features (evidence: `README.md`)
- Soft-voting ensemble → DNN classifier: scores with (evidence: `models/ensemble.py`)
- Soft-voting ensemble → CNN classifier: scores with (evidence: `models/ensemble.py`)
- Soft-voting ensemble → LSTM classifier: scores with (evidence: `models/ensemble.py`)
- Soft-voting ensemble → Hybrid QNN: scores with (evidence: `models/ensemble.py`)
- Prediction API → DNN classifier: loads model (evidence: `deployment/api.py`)
- Prediction API → CNN classifier: loads model (evidence: `deployment/api.py`)
- Prediction API → LSTM classifier: loads model (evidence: `deployment/api.py`)
- Prediction API → Hybrid QNN: loads model (evidence: `deployment/api.py`)
- Traffic analyst or client → Prediction API: requests prediction (evidence: `README.md`)
- Prediction API → Traffic analyst or client: returns classification (evidence: `deployment/api.py`)
- Prediction API → Evaluation results: reads voting rule (evidence: `deployment/api.py`)
- Traffic analyst or client → Dashboard: views detections (evidence: `README.md`)
- Dashboard → Prediction API: uses service
- Prediction API → AWS EC2: deployed on (evidence: `README.md`)
- Hypothesis evaluation → DNN classifier: evaluates (evidence: `evaluation/hypotheses.py`)
- Hypothesis evaluation → CNN classifier: evaluates (evidence: `evaluation/hypotheses.py`)
- Hypothesis evaluation → LSTM classifier: evaluates (evidence: `evaluation/hypotheses.py`)
- Hypothesis evaluation → Hybrid QNN: evaluates (evidence: `evaluation/hypotheses.py`)
- Hypothesis evaluation → Model metrics: computes measures
- Hypothesis evaluation → Evaluation results: saves findings (evidence: `evaluation/hypotheses.py`)
- Ablation study → Model metrics: compares models (evidence: `evaluation/ablation.py`)
- SHAP explanations → DNN classifier: explains ensemble member (evidence: `explainability/shap_hybrid.py`)
- SHAP explanations → CNN classifier: explains ensemble member (evidence: `explainability/shap_hybrid.py`)
- SHAP explanations → LSTM classifier: explains ensemble member (evidence: `explainability/shap_hybrid.py`)
- SHAP explanations → Hybrid QNN: explains ensemble member (evidence: `explainability/shap_hybrid.py`)
- SHAP explanations → Evaluation results: writes explanations (evidence: `README.md`)
- Hybrid training → Hybrid QNN: trains circuit model (evidence: `models/quantum/train_hybrid.py`)
- Quantum autoencoder → Evaluation results: reports anomaly findings
- Quantum SVM → Evaluation results: optional experiment
