# hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models architecture

> Architecture diagram of the GitHub repository hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models
- Repository: https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models

## Overview

This is an end-to-end e-commerce transaction fraud detection project: transaction data is prepared and engineered, supervised models are compared, and a trained pipeline supports interactive predictions. The primary user workflow is entering transaction details in the Flask app, which derives features, scores the transaction, and displays a verdict and probability. A separate command-line assistant also collects transactions and prints a prediction with rule-based risk factors. The README documents modeling and dataset work, but notebook internals were not sampled; the supplied model-loading paths also differ from the tree.

Main entry points: [`web_app.py`](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/web_app.py) (Flask prediction), [`fraud_chatbot.py`](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/fraud_chatbot.py) (Chat interaction), [`fraud_model.pkl`](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/fraud_model.pkl) (Trained pipeline), [`final_submission_1.ipynb`](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/final_submission_1.ipynb) (Model experiments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_modeling["Data and modeling"]
  node_prep["Dataset preparation"]
  node_experiments["Model experiments"]
  node_artifact[("Trained pipeline<br/>[fraud_model.pkl]")]
end

subgraph group_web["Web predictions"]
  node_form["Transaction form<br/>[index.html]"]
  node_flask["Flask prediction<br/>[web_app.py]"]
  node_webfeatures["Feature engineering<br/>[web_app.py]"]
  node_webresult["Prediction result<br/>[index.html]"]
end

subgraph group_assistant["CLI assistant"]
  node_chat["Chat interaction<br/>[fraud_chatbot.py]"]
  node_clifeatures["Feature engineering<br/>[fraud_chatbot.py]"]
  node_explanation["Risk explanation<br/>[fraud_chatbot.py]"]
end

node_analyst(("Data scientist"))
node_dataset["Fraud datasets"]
node_webuser(("Web user"))
node_cliuser(("CLI user"))

node_dataset -.->|"provides data"| node_prep
node_analyst -.->|"prepares data"| node_prep
node_prep -.->|"prepares features"| node_experiments
node_experiments -.->|"trains pipeline"| node_artifact
node_webuser -->|"enters details"| node_form
node_form -->|"submits form"| node_flask
node_flask -->|"builds features"| node_webfeatures
node_flask -.->|"scores transaction"| node_artifact
node_flask -->|"renders result"| node_webresult
node_cliuser -->|"provides details"| node_chat
node_chat -->|"builds transaction"| node_clifeatures
node_chat -.->|"predicts transaction"| node_artifact
node_chat -->|"requests explanation"| node_explanation
node_clifeatures -->|"supplies factors"| node_explanation

click node_experiments "https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/final_submission_1.ipynb"
click node_artifact "https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/fraud_model.pkl"
click node_form "https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/index.html"
click node_flask "https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/web_app.py"
click node_webfeatures "https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/web_app.py"
click node_webresult "https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/index.html"
click node_chat "https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/fraud_chatbot.py"
click node_clifeatures "https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/fraud_chatbot.py"
click node_explanation "https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/fraud_chatbot.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_prep,node_experiments,node_artifact,node_webuser,node_cliuser toneBlue
class node_form,node_flask,node_webfeatures,node_webresult toneAmber
class node_chat,node_clifeatures,node_explanation toneMint
class node_analyst,node_dataset toneIndigo
```

## Components

### Data and modeling

- **Dataset preparation**
- [Model experiments](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/final_submission_1.ipynb): `final_submission_1.ipynb`
- [Trained pipeline](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/fraud_model.pkl): `fraud_model.pkl`

### Web predictions

- [Transaction form](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/index.html): `index.html`
- [Flask prediction](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/web_app.py): `web_app.py`
- [Feature engineering](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/web_app.py): `web_app.py`
- [Prediction result](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/index.html): `index.html`

### CLI assistant

- [Chat interaction](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/fraud_chatbot.py): `fraud_chatbot.py`
- [Feature engineering](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/fraud_chatbot.py): `fraud_chatbot.py`
- [Risk explanation](https://github.com/hamida-paiman/fraud-detection-system-using-ensemble-machine-learning-models/blob/main/fraud_chatbot.py): `fraud_chatbot.py`

### Other components

- **Data scientist**
- **Fraud datasets**
- **Web user**
- **CLI user**

## Connections

- Fraud datasets → Dataset preparation: provides data
- Data scientist → Dataset preparation: prepares data
- Dataset preparation → Model experiments: prepares features
- Model experiments → Trained pipeline: trains pipeline
- Web user → Transaction form: enters details
- Transaction form → Flask prediction: submits form
- Flask prediction → Feature engineering: builds features
- Flask prediction → Trained pipeline: scores transaction
- Flask prediction → Prediction result: renders result
- CLI user → Chat interaction: provides details
- Chat interaction → Feature engineering: builds transaction
- Chat interaction → Trained pipeline: predicts transaction
- Chat interaction → Risk explanation: requests explanation
- Feature engineering → Risk explanation: supplies factors
