# astraldisaster11/credit-card-fraud-detection architecture

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

- Interactive diagram: https://gitdiagram.com/astraldisaster11/credit-card-fraud-detection
- Repository: https://github.com/astraldisaster11/credit-card-fraud-detection

## Overview

This is a Streamlit application for detecting credit-card fraud. Users upload training and test CSVs, explore the training data, preprocess and encode features, train selected classifiers, compare evaluation results, then use a trained model to predict on test data. The main workflow and capabilities are documented in the README and implemented in app.py. The excerpts show upload state, preprocessing, training, evaluation, and prediction; unsampled UI details are not expanded into additional components or links.

Main entry points: [`app.py`](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py) (Training Workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Data Input"]
  node_upload["CSV Upload<br/>[app.py]"]
  node_datasets["Session Datasets<br/>[app.py]"]
end

subgraph group_analysis["Exploration and Preparation"]
  node_exploration["Data Exploration<br/>[app.py]"]
  node_visualization["Data Visualization<br/>[app.py]"]
  node_cleaning["Data Cleaning<br/>[app.py]"]
  node_encoding["Feature Encoding<br/>[app.py]"]
end

subgraph group_training["Model Training"]
  node_split["Train Test Split<br/>[app.py]"]
  node_training_ui["Training Workflow<br/>[app.py]"]
  node_logistic["Logistic Regression<br/>[app.py]"]
  node_random_forest["Random Forest<br/>[app.py]"]
  node_decision_tree["Decision Tree<br/>[app.py]"]
  node_evaluation["Model Evaluation<br/>[app.py]"]
  node_comparison["Model Comparison<br/>[app.py]"]
end

subgraph group_prediction["Prediction and Results"]
  node_prediction["Test Predictions<br/>[app.py]"]
  node_prediction_results["Prediction Results<br/>[app.py]"]
end

node_user(("App User"))

node_user -->|"uploads CSVs"| node_upload
node_upload -->|"stores uploads"| node_datasets
node_datasets -->|"explores training data"| node_exploration
node_exploration -->|"renders charts"| node_visualization
node_exploration -->|"prepares correlations"| node_cleaning
node_cleaning -->|"cleans features"| node_encoding
node_datasets -->|"provides training data"| node_training_ui
node_training_ui -->|"cleans training data"| node_cleaning
node_training_ui -->|"encodes training data"| node_encoding
node_training_ui -->|"splits features"| node_split
node_training_ui -->|"trains selected model"| node_logistic
node_training_ui -->|"trains selected model"| node_random_forest
node_training_ui -->|"trains selected model"| node_decision_tree
node_training_ui -->|"evaluates predictions"| node_evaluation
node_evaluation -->|"compares accuracy"| node_comparison
node_datasets -->|"provides test data"| node_prediction
node_prediction -->|"prepares test data"| node_cleaning
node_prediction -->|"encodes test data"| node_encoding
node_prediction -->|"uses trained model"| node_random_forest
node_prediction -->|"shows predictions"| node_prediction_results

click node_upload "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_datasets "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_exploration "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_visualization "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_cleaning "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_encoding "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_split "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_training_ui "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_logistic "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_random_forest "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_decision_tree "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_evaluation "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_comparison "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_prediction "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py"
click node_prediction_results "https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/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_upload,node_datasets,node_user toneBlue
class node_exploration,node_visualization,node_cleaning,node_encoding toneAmber
class node_split,node_training_ui,node_logistic,node_random_forest,node_decision_tree,node_evaluation,node_comparison toneMint
class node_prediction,node_prediction_results toneRose
```

## Components

### Data Input

- [CSV Upload](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Session Datasets](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`

### Exploration and Preparation

- [Data Exploration](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Data Visualization](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Data Cleaning](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Feature Encoding](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`

### Model Training

- [Train Test Split](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Training Workflow](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Logistic Regression](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Random Forest](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Decision Tree](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Model Evaluation](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Model Comparison](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`

### Prediction and Results

- [Test Predictions](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Prediction Results](https://github.com/astraldisaster11/credit-card-fraud-detection/blob/main/app.py): `app.py`

### Other components

- **App User**

## Connections

- App User → CSV Upload: uploads CSVs (evidence: `app.py`)
- CSV Upload → Session Datasets: stores uploads (evidence: `app.py`)
- Session Datasets → Data Exploration: explores training data (evidence: `app.py`)
- Data Exploration → Data Visualization: renders charts (evidence: `app.py`)
- Data Exploration → Data Cleaning: prepares correlations (evidence: `app.py`)
- Data Cleaning → Feature Encoding: cleans features (evidence: `app.py`)
- Session Datasets → Training Workflow: provides training data (evidence: `app.py`)
- Training Workflow → Data Cleaning: cleans training data (evidence: `app.py`)
- Training Workflow → Feature Encoding: encodes training data (evidence: `app.py`)
- Training Workflow → Train Test Split: splits features (evidence: `app.py`)
- Training Workflow → Logistic Regression: trains selected model (evidence: `app.py`)
- Training Workflow → Random Forest: trains selected model (evidence: `app.py`)
- Training Workflow → Decision Tree: trains selected model (evidence: `app.py`)
- Training Workflow → Model Evaluation: evaluates predictions (evidence: `app.py`)
- Model Evaluation → Model Comparison: compares accuracy (evidence: `app.py`)
- Session Datasets → Test Predictions: provides test data (evidence: `app.py`)
- Test Predictions → Data Cleaning: prepares test data (evidence: `app.py`)
- Test Predictions → Feature Encoding: encodes test data (evidence: `app.py`)
- Test Predictions → Random Forest: uses trained model (evidence: `app.py`)
- Test Predictions → Prediction Results: shows predictions (evidence: `app.py`)
