# rivaldotimoty/graph-fraud-risk architecture

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

- Interactive diagram: https://gitdiagram.com/rivaldotimoty/graph-fraud-risk
- Repository: https://github.com/rivaldotimoty/graph-fraud-risk

## Overview

This repository studies whether graph-derived fraud features generalize under temporal validation, then presents model, network, and score-threshold results in an interactive dashboard. The evidenced workflow runs from temporal splitting and feature construction through model comparison and risk evaluation to dashboard artifacts. Several dashboard data-consumption links are not visible in the excerpts, so those are left unverified rather than treated as direct calls.

Main entry points: [`src/evaluation/phase5.py`](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/phase5.py) (Final evaluation), [`src/data/split.py`](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/data/split.py) (Temporal split), [`dashboard/app/page.tsx`](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/app/page.tsx) (Interactive dashboard), [`src/models/gbdt.py`](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/models/gbdt.py) (GBDT training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_config["Configuration<br/>[config.py]"]
  node_loader["Data loading<br/>[load.py]"]
  node_split["Temporal split<br/>[split.py]"]
  node_eda["Data profiling<br/>[eda.py]"]
end

subgraph group_features["Feature engineering"]
  node_tabular["Tabular features<br/>[tabular.py]"]
  node_featurebuild["Feature assembly<br/>[build.py]"]
  node_graphbuild["Incidence graph<br/>[build.py]"]
  node_structural["Structural features<br/>[pipeline.py]"]
  node_community["Community analysis<br/>[community.py]"]
  node_labelfeatures["Label features<br/>[level3_pipeline.py]"]
  node_labelcalc["Label propagation<br/>[label_features.py]"]
end

subgraph group_modeling["Modeling"]
  node_gbdt["GBDT training<br/>[gbdt.py]"]
  node_ablation["Model ablation<br/>[ablation.py]"]
  node_experiments[("Experiment log<br/>[experiment.py]")]
end

subgraph group_evaluation["Risk evaluation"]
  node_metrics["Ranking metrics<br/>[metrics.py]"]
  node_phase5["Final evaluation<br/>[phase5.py]"]
  node_business["Cost thresholds<br/>[business.py]"]
  node_scorecard["Scorecard<br/>[scorecard.py]"]
  node_stability["Stability analysis<br/>[stability.py]"]
  node_plots["Evaluation plots"]
end

subgraph group_dashboard["Dashboard"]
  node_export["Dashboard data export"]
  node_dashboard["Interactive dashboard<br/>[page.tsx]"]
  node_comparison["Model comparison"]
  node_network["Network explorer"]
  node_scores["Score explorer<br/>[ScoreExplorer.tsx]"]
  node_plot["Chart rendering<br/>[Plot.tsx]"]
  node_ui["Shared UI<br/>[ui.tsx]"]
end

node_analyst(("Researcher"))

node_analyst -.->|"profiles data"| node_eda
node_loader -->|"loads settings"| node_config
node_eda -->|"loads settings"| node_config
node_eda -->|"uses masks"| node_split
node_eda -->|"uses data"| node_loader
node_featurebuild -->|"loads settings"| node_config
node_featurebuild -->|"uses masks"| node_split
node_featurebuild -->|"builds features"| node_tabular
node_structural -->|"loads settings"| node_config
node_structural -->|"builds graph"| node_graphbuild
node_structural -->|"computes communities"| node_community
node_labelfeatures -->|"loads masks"| node_split
node_labelfeatures -->|"builds graph"| node_graphbuild
node_labelfeatures -->|"computes communities"| node_community
node_labelfeatures -->|"builds label features"| node_labelcalc
node_gbdt -->|"loads masks"| node_split
node_gbdt -->|"evaluates predictions"| node_metrics
node_gbdt -->|"logs runs"| node_experiments
node_ablation -->|"trains models"| node_gbdt
node_ablation -->|"loads masks"| node_split
node_ablation -->|"evaluates models"| node_metrics
node_ablation -->|"logs runs"| node_experiments
node_phase5 -->|"trains final model"| node_gbdt
node_phase5 -->|"loads masks"| node_split
node_phase5 -->|"assesses costs"| node_business
node_phase5 -->|"builds scorecard"| node_scorecard
node_phase5 -->|"assesses stability"| node_stability
node_phase5 -->|"evaluates predictions"| node_metrics
node_phase5 -->|"renders results"| node_plots
node_export -->|"trains final model"| node_phase5
node_export -->|"computes cost curves"| node_business
node_export -->|"computes score bands"| node_scorecard
node_analyst -->|"explores results"| node_dashboard
node_dashboard -.->|"shows models"| node_comparison
node_dashboard -.->|"explores network"| node_network
node_dashboard -.->|"simulates thresholds"| node_scores
node_comparison -->|"renders charts"| node_plot
node_comparison -->|"uses components"| node_ui
node_network -->|"renders charts"| node_plot
node_network -->|"uses components"| node_ui
node_scores -->|"renders charts"| node_plot
node_scores -->|"uses components"| node_ui
node_export -.->|"provides artifacts"| node_dashboard

click node_config "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/config.py"
click node_loader "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/data/load.py"
click node_split "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/data/split.py"
click node_eda "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/data/eda.py"
click node_tabular "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/features/tabular.py"
click node_featurebuild "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/features/build.py"
click node_graphbuild "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/graph/build.py"
click node_structural "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/graph/pipeline.py"
click node_community "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/graph/community.py"
click node_labelfeatures "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/graph/level3_pipeline.py"
click node_labelcalc "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/graph/label_features.py"
click node_gbdt "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/models/gbdt.py"
click node_ablation "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/models/ablation.py"
click node_experiments "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/models/experiment.py"
click node_metrics "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/metrics.py"
click node_phase5 "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/phase5.py"
click node_business "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/business.py"
click node_scorecard "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/scorecard.py"
click node_stability "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/stability.py"
click node_plots "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/viz/evaluation_plots.py"
click node_export "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/viz/export_dashboard_data.py"
click node_dashboard "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/app/page.tsx"
click node_comparison "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/components/ModelComparison.tsx"
click node_network "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/components/NetworkExplorer.tsx"
click node_scores "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/components/ScoreExplorer.tsx"
click node_plot "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/components/Plot.tsx"
click node_ui "https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/components/ui.tsx"

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_config,node_loader,node_split,node_eda toneBlue
class node_tabular,node_featurebuild,node_graphbuild,node_structural,node_community,node_labelfeatures,node_labelcalc toneAmber
class node_gbdt,node_ablation,node_experiments toneMint
class node_metrics,node_phase5,node_business,node_scorecard,node_stability,node_plots toneRose
class node_export,node_dashboard,node_comparison,node_network,node_scores,node_plot,node_ui,node_analyst toneIndigo
```

## Components

### Data preparation

- [Configuration](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/config.py): `src/config.py`
- [Data loading](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/data/load.py): `src/data/load.py`
- [Temporal split](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/data/split.py): `src/data/split.py`
- [Data profiling](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/data/eda.py): `src/data/eda.py`

### Feature engineering

- [Tabular features](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/features/tabular.py): `src/features/tabular.py`
- [Feature assembly](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/features/build.py): `src/features/build.py`
- [Incidence graph](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/graph/build.py): `src/graph/build.py`
- [Structural features](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/graph/pipeline.py): `src/graph/pipeline.py`
- [Community analysis](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/graph/community.py): `src/graph/community.py`
- [Label features](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/graph/level3_pipeline.py): `src/graph/level3_pipeline.py`
- [Label propagation](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/graph/label_features.py): `src/graph/label_features.py`

### Modeling

- [GBDT training](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/models/gbdt.py): `src/models/gbdt.py`
- [Model ablation](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/models/ablation.py): `src/models/ablation.py`
- [Experiment log](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/models/experiment.py): `src/models/experiment.py`

### Risk evaluation

- [Ranking metrics](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/metrics.py): `src/evaluation/metrics.py`
- [Final evaluation](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/phase5.py): `src/evaluation/phase5.py`
- [Cost thresholds](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/business.py): `src/evaluation/business.py`
- [Scorecard](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/scorecard.py): `src/evaluation/scorecard.py`
- [Stability analysis](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/evaluation/stability.py): `src/evaluation/stability.py`
- [Evaluation plots](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/viz/evaluation_plots.py): `src/viz/evaluation_plots.py`

### Dashboard

- [Dashboard data export](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/src/viz/export_dashboard_data.py): `src/viz/export_dashboard_data.py`
- [Interactive dashboard](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/app/page.tsx): `dashboard/app/page.tsx`
- [Model comparison](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/components/ModelComparison.tsx): `dashboard/components/ModelComparison.tsx`
- [Network explorer](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/components/NetworkExplorer.tsx): `dashboard/components/NetworkExplorer.tsx`
- [Score explorer](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/components/ScoreExplorer.tsx): `dashboard/components/ScoreExplorer.tsx`
- [Chart rendering](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/components/Plot.tsx): `dashboard/components/Plot.tsx`
- [Shared UI](https://github.com/rivaldotimoty/graph-fraud-risk/blob/main/dashboard/components/ui.tsx): `dashboard/components/ui.tsx`

### Other components

- **Researcher**

## Connections

- Researcher → Data profiling: profiles data
- Data loading → Configuration: loads settings (evidence: `src/data/load.py`)
- Data profiling → Configuration: loads settings (evidence: `src/data/eda.py`)
- Data profiling → Temporal split: uses masks (evidence: `src/data/eda.py`)
- Data profiling → Data loading: uses data (evidence: `src/data/eda.py`)
- Feature assembly → Configuration: loads settings (evidence: `src/features/build.py`)
- Feature assembly → Temporal split: uses masks (evidence: `src/features/build.py`)
- Feature assembly → Tabular features: builds features (evidence: `src/features/build.py`)
- Structural features → Configuration: loads settings (evidence: `src/graph/pipeline.py`)
- Structural features → Incidence graph: builds graph (evidence: `src/graph/pipeline.py`)
- Structural features → Community analysis: computes communities (evidence: `src/graph/pipeline.py`)
- Label features → Temporal split: loads masks (evidence: `src/graph/level3_pipeline.py`)
- Label features → Incidence graph: builds graph (evidence: `src/graph/level3_pipeline.py`)
- Label features → Community analysis: computes communities (evidence: `src/graph/level3_pipeline.py`)
- Label features → Label propagation: builds label features (evidence: `src/graph/level3_pipeline.py`)
- GBDT training → Temporal split: loads masks (evidence: `src/models/gbdt.py`)
- GBDT training → Ranking metrics: evaluates predictions (evidence: `src/models/gbdt.py`)
- GBDT training → Experiment log: logs runs (evidence: `src/models/gbdt.py`)
- Model ablation → GBDT training: trains models (evidence: `src/models/ablation.py`)
- Model ablation → Temporal split: loads masks (evidence: `src/models/ablation.py`)
- Model ablation → Ranking metrics: evaluates models (evidence: `src/models/ablation.py`)
- Model ablation → Experiment log: logs runs (evidence: `src/models/ablation.py`)
- Final evaluation → GBDT training: trains final model (evidence: `src/evaluation/phase5.py`)
- Final evaluation → Temporal split: loads masks (evidence: `src/evaluation/phase5.py`)
- Final evaluation → Cost thresholds: assesses costs (evidence: `src/evaluation/phase5.py`)
- Final evaluation → Scorecard: builds scorecard (evidence: `src/evaluation/phase5.py`)
- Final evaluation → Stability analysis: assesses stability (evidence: `src/evaluation/phase5.py`)
- Final evaluation → Ranking metrics: evaluates predictions (evidence: `src/evaluation/phase5.py`)
- Final evaluation → Evaluation plots: renders results (evidence: `src/evaluation/phase5.py`)
- Dashboard data export → Final evaluation: trains final model (evidence: `src/viz/export_dashboard_data.py`)
- Dashboard data export → Cost thresholds: computes cost curves (evidence: `src/viz/export_dashboard_data.py`)
- Dashboard data export → Scorecard: computes score bands (evidence: `src/viz/export_dashboard_data.py`)
- Researcher → Interactive dashboard: explores results
- Interactive dashboard → Model comparison: shows models
- Interactive dashboard → Network explorer: explores network
- Interactive dashboard → Score explorer: simulates thresholds
- Model comparison → Chart rendering: renders charts (evidence: `dashboard/components/ModelComparison.tsx`)
- Model comparison → Shared UI: uses components (evidence: `dashboard/components/ModelComparison.tsx`)
- Network explorer → Chart rendering: renders charts (evidence: `dashboard/components/NetworkExplorer.tsx`)
- Network explorer → Shared UI: uses components (evidence: `dashboard/components/NetworkExplorer.tsx`)
- Score explorer → Chart rendering: renders charts (evidence: `dashboard/components/ScoreExplorer.tsx`)
- Score explorer → Shared UI: uses components (evidence: `dashboard/components/ScoreExplorer.tsx`)
- Dashboard data export → Interactive dashboard: provides artifacts
