# ragunath77/fraud_detection architecture

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

- Interactive diagram: https://gitdiagram.com/ragunath77/fraud_detection
- Repository: https://github.com/ragunath77/fraud_detection

## Overview

This repository provides a small fraud-detection API. A client uploads a CSV to the prediction endpoint; the handler reads it, aligns its columns to the loaded model’s features, runs predictions, and returns a downloadable CSV. The model artifact is loaded when the application starts. These stages are conceptual components implemented in main.py, not separate modules. The source excerpt shows the endpoint and model-loading behavior; no frontend or other integrations are present in the supplied evidence.

Main entry points: [`main.py`](https://github.com/ragunath77/fraud_detection/blob/main/main.py) (Prediction endpoint), [`final_model.pkl`](https://github.com/ragunath77/fraud_detection/blob/main/final_model.pkl) (Trained model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Prediction API"]
  node_endpoint["Prediction endpoint<br/>[main.py]"]
  node_preparation["CSV preparation<br/>[main.py]"]
  node_response["CSV response<br/>[main.py]"]
end

subgraph group_model["Model"]
  node_artifact["Trained model<br/>[final_model.pkl]"]
end

node_client(("API client"))

node_client -->|"uploads CSV"| node_endpoint
node_endpoint -->|"reads and aligns"| node_preparation
node_endpoint -->|"predicts with"| node_artifact
node_endpoint -->|"returns predictions"| node_response
node_endpoint -->|"loads at startup"| node_artifact

click node_endpoint "https://github.com/ragunath77/fraud_detection/blob/main/main.py"
click node_preparation "https://github.com/ragunath77/fraud_detection/blob/main/main.py"
click node_artifact "https://github.com/ragunath77/fraud_detection/blob/main/final_model.pkl"
click node_response "https://github.com/ragunath77/fraud_detection/blob/main/main.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_endpoint,node_preparation,node_response,node_client toneBlue
class node_artifact toneAmber
```

## Components

### Prediction API

- [Prediction endpoint](https://github.com/ragunath77/fraud_detection/blob/main/main.py): `main.py`
- [CSV preparation](https://github.com/ragunath77/fraud_detection/blob/main/main.py): `main.py`
- [CSV response](https://github.com/ragunath77/fraud_detection/blob/main/main.py): `main.py`

### Model

- [Trained model](https://github.com/ragunath77/fraud_detection/blob/main/final_model.pkl): `final_model.pkl`

### Other components

- **API client**

## Connections

- API client → Prediction endpoint: uploads CSV (evidence: `main.py`)
- Prediction endpoint → CSV preparation: reads and aligns (evidence: `main.py`)
- Prediction endpoint → Trained model: predicts with (evidence: `main.py`)
- Prediction endpoint → CSV response: returns predictions (evidence: `main.py`)
- Prediction endpoint → Trained model: loads at startup (evidence: `main.py`)
