# mirzayasirabdullahbaig07/credit-card-fraud-detection architecture

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

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

## Overview

This repository provides a Streamlit fraud-scoring app and a Colab notebook for producing its model artifacts. The principal workflow is entering one transaction or uploading a CSV, then receiving threshold-based fraud scores; batch mode also supports evaluation and downloadable results. The graph separates the app, inference artifacts, and training. Some app implementation is omitted from the excerpts, so relationships not shown in source are included only where the README documents them.

Main entry points: [`app.py`](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py) (Feature preprocessing), [`Credit_Card_Fraud_Detection_Colab.ipynb`](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/Credit_Card_Fraud_Detection_Colab.ipynb) (Colab training), [`fraud_detection_model.pkl`](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/fraud_detection_model.pkl) (Trained classifier), [`scaler_amount.pkl`](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/scaler_amount.pkl) (Amount scaler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Streamlit app"]
  node_interface["Fraud Radar UI<br/>[app.py]"]
  node_preprocess["Feature preprocessing<br/>[app.py]"]
  node_scoring["Fraud scoring<br/>[app.py]"]
  node_single["Single transaction<br/>[app.py]"]
  node_batch["CSV batch scoring<br/>[app.py]"]
  node_evaluation["Batch evaluation<br/>[app.py]"]
end

subgraph group_inference["Inference artifacts"]
  node_model["Trained classifier"]
  node_amount_scaler["Amount scaler<br/>[scaler_amount.pkl]"]
  node_time_scaler["Time scaler<br/>[scaler_time.pkl]"]
  node_features["Feature order"]
end

subgraph group_training["Model training"]
  node_training["Colab training"]
end

node_user(("App user"))

node_user -->|"uses"| node_interface
node_interface -->|"offers"| node_single
node_interface -->|"offers"| node_batch
node_interface -->|"prepares inputs"| node_preprocess
node_preprocess -->|"scales amount"| node_amount_scaler
node_preprocess -->|"scales time"| node_time_scaler
node_preprocess -->|"orders columns"| node_features
node_scoring -->|"preprocesses"| node_preprocess
node_scoring -->|"scores with"| node_model
node_single -.->|"requests score"| node_scoring
node_batch -.->|"scores rows"| node_scoring
node_batch -->|"supports evaluation"| node_evaluation
node_training -->|"saves model"| node_model
node_training -->|"saves scaler"| node_amount_scaler
node_training -->|"saves scaler"| node_time_scaler
node_training -->|"saves column order"| node_features

click node_interface "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py"
click node_preprocess "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py"
click node_scoring "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py"
click node_single "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py"
click node_batch "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py"
click node_evaluation "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py"
click node_model "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/fraud_detection_model.pkl"
click node_amount_scaler "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/scaler_amount.pkl"
click node_time_scaler "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/scaler_time.pkl"
click node_features "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/feature_columns.pkl"
click node_training "https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/Credit_Card_Fraud_Detection_Colab.ipynb"

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_interface,node_preprocess,node_scoring,node_single,node_batch,node_evaluation,node_user toneBlue
class node_model,node_amount_scaler,node_time_scaler,node_features toneAmber
class node_training toneMint
```

## Components

### Streamlit app

- [Fraud Radar UI](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Feature preprocessing](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Fraud scoring](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Single transaction](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [CSV batch scoring](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py): `app.py`
- [Batch evaluation](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/app.py): `app.py`

### Inference artifacts

- [Trained classifier](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/fraud_detection_model.pkl): `fraud_detection_model.pkl`
- [Amount scaler](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/scaler_amount.pkl): `scaler_amount.pkl`
- [Time scaler](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/scaler_time.pkl): `scaler_time.pkl`
- [Feature order](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/feature_columns.pkl): `feature_columns.pkl`

### Model training

- [Colab training](https://github.com/mirzayasirabdullahbaig07/credit-card-fraud-detection/blob/main/Credit_Card_Fraud_Detection_Colab.ipynb): `Credit_Card_Fraud_Detection_Colab.ipynb`

### Other components

- **App user**

## Connections

- App user → Fraud Radar UI: uses (evidence: `README.md`)
- Fraud Radar UI → Single transaction: offers (evidence: `app.py`)
- Fraud Radar UI → CSV batch scoring: offers (evidence: `app.py`)
- Fraud Radar UI → Feature preprocessing: prepares inputs (evidence: `app.py`)
- Feature preprocessing → Amount scaler: scales amount (evidence: `app.py`)
- Feature preprocessing → Time scaler: scales time (evidence: `app.py`)
- Feature preprocessing → Feature order: orders columns (evidence: `app.py`)
- Fraud scoring → Feature preprocessing: preprocesses (evidence: `app.py`)
- Fraud scoring → Trained classifier: scores with (evidence: `app.py`)
- Single transaction → Fraud scoring: requests score (evidence: `app.py`)
- CSV batch scoring → Fraud scoring: scores rows (evidence: `app.py`)
- CSV batch scoring → Batch evaluation: supports evaluation (evidence: `README.md`)
- Colab training → Trained classifier: saves model (evidence: `README.md`)
- Colab training → Amount scaler: saves scaler (evidence: `README.md`)
- Colab training → Time scaler: saves scaler (evidence: `README.md`)
- Colab training → Feature order: saves column order (evidence: `README.md`)
