# aakritiiii16/aml-network-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/aakritiiii16/aml-network-analyzer
- Repository: https://github.com/aakritiiii16/aml-network-analyzer

## Overview

This is an AML analyst platform: transaction IDs enter through the Streamlit portal, are scored by the FastAPI service, and return a risk probability with contribution values for display. A separate API action produces a sampled performance audit. The documented modeling workflow constructs and temporally splits the transaction graph, creates embeddings, combines them with local features, and classifies transactions. README descriptions support these modeling-stage links; the notebooks are present in the tree but were not sampled, so their internal implementations and any unshown connections are not asserted.

Main entry points: [`frontend/app.py`](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/frontend/app.py) (Streamlit Portal), [`api/main.py`](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/api/main.py) (FastAPI Service), [`notebooks/1_make_graph.ipynb`](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/1_make_graph.ipynb) (Transaction Graph), [`notebooks/2_embeddings.ipynb`](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/2_embeddings.ipynb) (GNN Embeddings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Graph Preparation"]
  node_raw["Bitcoin Transactions"]
  node_graph["Transaction Graph<br/>[1_make_graph.ipynb]"]
  node_temporal["Temporal Split<br/>[1_make_graph.ipynb]"]
end

subgraph group_model["Modeling"]
  node_embeddings["GNN Embeddings<br/>[2_embeddings.ipynb]"]
  node_hybrid["Hybrid Graph Model<br/>[2_embeddings.ipynb]"]
  node_features["Feature Merge<br/>[2_embeddings.ipynb]"]
  node_classifier["LightGBM Classifier<br/>[3_train_LGBM.ipynb]"]
  node_shap["SHAP Explanations"]
end

subgraph group_serving["Scoring And Monitoring"]
  node_api["FastAPI Service<br/>[main.py]"]
  node_scoring["Transaction Scoring<br/>[main.py]"]
  node_audit["Performance Audit<br/>[main.py]"]
  node_monitor["Evidently Metrics<br/>[main.py]"]
end

subgraph group_portal["Analyst Portal"]
  node_portal["Streamlit Portal<br/>[app.py]"]
  node_risk_view["Risk And Explanation View<br/>[app.py]"]
  node_monitor_view["Monitoring Dashboard<br/>[app.py]"]
end

node_analyst(("AML Analyst"))

node_raw -->|"constructs"| node_graph
node_graph -->|"splits chronologically"| node_temporal
node_temporal -->|"trains leak-proof"| node_hybrid
node_hybrid -->|"generates embeddings"| node_embeddings
node_embeddings -->|"merges with local features"| node_features
node_features -->|"classifies"| node_classifier
node_classifier -->|"explains predictions"| node_shap
node_analyst -->|"enters transaction ID"| node_portal
node_portal -->|"POST /predict"| node_api
node_api -->|"routes prediction"| node_scoring
node_scoring -->|"returns probability and shifts"| node_risk_view
node_portal -->|"renders result"| node_risk_view
node_analyst -->|"requests audit"| node_monitor_view
node_portal -->|"POST /performance"| node_api
node_api -->|"routes audit"| node_audit
node_audit -->|"builds classification report"| node_monitor
node_monitor -->|"returns HTML report"| node_monitor_view

click node_graph "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/1_make_graph.ipynb"
click node_temporal "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/1_make_graph.ipynb"
click node_embeddings "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/2_embeddings.ipynb"
click node_hybrid "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/2_embeddings.ipynb"
click node_features "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/2_embeddings.ipynb"
click node_classifier "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/3_train_LGBM.ipynb"
click node_shap "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/4_SHAP_values.ipynb"
click node_api "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/api/main.py"
click node_scoring "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/api/main.py"
click node_audit "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/api/main.py"
click node_monitor "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/api/main.py"
click node_portal "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/frontend/app.py"
click node_risk_view "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/frontend/app.py"
click node_monitor_view "https://github.com/aakritiiii16/aml-network-analyzer/blob/main/frontend/app.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_raw,node_graph,node_temporal toneBlue
class node_embeddings,node_hybrid,node_features,node_classifier,node_shap toneAmber
class node_api,node_scoring,node_audit,node_monitor toneMint
class node_portal,node_risk_view,node_monitor_view toneRose
class node_analyst toneIndigo
```

## Components

### Graph Preparation

- **Bitcoin Transactions**
- [Transaction Graph](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/1_make_graph.ipynb): `notebooks/1_make_graph.ipynb`
- [Temporal Split](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/1_make_graph.ipynb): `notebooks/1_make_graph.ipynb`

### Modeling

- [GNN Embeddings](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/2_embeddings.ipynb): `notebooks/2_embeddings.ipynb`
- [Hybrid Graph Model](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/2_embeddings.ipynb): `notebooks/2_embeddings.ipynb`
- [Feature Merge](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/2_embeddings.ipynb): `notebooks/2_embeddings.ipynb`
- [LightGBM Classifier](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/3_train_LGBM.ipynb): `notebooks/3_train_LGBM.ipynb`
- [SHAP Explanations](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/notebooks/4_SHAP_values.ipynb): `notebooks/4_SHAP_values.ipynb`

### Scoring And Monitoring

- [FastAPI Service](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/api/main.py): `api/main.py`
- [Transaction Scoring](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/api/main.py): `api/main.py`
- [Performance Audit](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/api/main.py): `api/main.py`
- [Evidently Metrics](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/api/main.py): `api/main.py`

### Analyst Portal

- [Streamlit Portal](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/frontend/app.py): `frontend/app.py`
- [Risk And Explanation View](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/frontend/app.py): `frontend/app.py`
- [Monitoring Dashboard](https://github.com/aakritiiii16/aml-network-analyzer/blob/main/frontend/app.py): `frontend/app.py`

### Other components

- **AML Analyst**

## Connections

- Bitcoin Transactions → Transaction Graph: constructs (evidence: `README.md`)
- Transaction Graph → Temporal Split: splits chronologically (evidence: `README.md`)
- Temporal Split → Hybrid Graph Model: trains leak-proof (evidence: `README.md`)
- Hybrid Graph Model → GNN Embeddings: generates embeddings (evidence: `README.md`)
- GNN Embeddings → Feature Merge: merges with local features (evidence: `README.md`)
- Feature Merge → LightGBM Classifier: classifies (evidence: `README.md`)
- LightGBM Classifier → SHAP Explanations: explains predictions (evidence: `README.md`)
- AML Analyst → Streamlit Portal: enters transaction ID (evidence: `README.md`)
- Streamlit Portal → FastAPI Service: POST /predict (evidence: `frontend/app.py`)
- FastAPI Service → Transaction Scoring: routes prediction (evidence: `api/main.py`)
- Transaction Scoring → Risk And Explanation View: returns probability and shifts (evidence: `api/main.py`)
- Streamlit Portal → Risk And Explanation View: renders result (evidence: `frontend/app.py`)
- AML Analyst → Monitoring Dashboard: requests audit (evidence: `README.md`)
- Streamlit Portal → FastAPI Service: POST /performance (evidence: `frontend/app.py`)
- FastAPI Service → Performance Audit: routes audit (evidence: `api/main.py`)
- Performance Audit → Evidently Metrics: builds classification report (evidence: `api/main.py`)
- Evidently Metrics → Monitoring Dashboard: returns HTML report (evidence: `api/main.py`)
