# koverthanan-git/credit_card_ct_project architecture

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

- Interactive diagram: https://gitdiagram.com/koverthanan-git/credit_card_ct_project
- Repository: https://github.com/koverthanan-git/credit_card_ct_project

## Overview

This repository implements a credit-card fraud ML workflow: an operator can train and register a model, while a Prefect flow checks for data drift and conditionally retrains it. A FastAPI inference gateway loads the latest registered model and returns fraud predictions. The README also describes CI/CD and evaluation, but the excerpts do not show a CI/CD implementation; the sampled evaluation is model accuracy during initial training. The graph reflects the visible calls and data transfers; configuration files are not connected because their runtime wiring is not shown.

Main entry points: [`train.py`](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/train.py) (Initial training), [`pipline.py`](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/pipline.py) (Training flow), [`monitor.py`](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/monitor.py) (Drift evaluation), [`app.py`](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/app.py) (Inference gateway)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model_lifecycle["Model lifecycle"]
  node_initial_training["Initial training<br/>[train.py]"]
  node_reference_data["Reference data<br/>[train.py]"]
  node_model_registry[("MLflow registry")]
end

subgraph group_drift_loop["Drift and retraining"]
  node_training_flow["Training flow<br/>[pipline.py]"]
  node_drift_check["Drift check<br/>[pipline.py]"]
  node_drift_evaluation["Drift evaluation<br/>[monitor.py]"]
  node_retraining["Conditional retraining<br/>[pipline.py]"]
  node_drift_dashboard["Drift dashboard<br/>[monitor.py]"]
end

subgraph group_serving["Inference serving"]
  node_inference_gateway["Inference gateway<br/>[app.py]"]
end

node_operator(("Operator"))
node_client(("Inference client"))

node_operator -.->|"starts training"| node_initial_training
node_initial_training -->|"writes baseline"| node_reference_data
node_initial_training -->|"registers model"| node_model_registry
node_operator -.->|"starts flow"| node_training_flow
node_training_flow -->|"runs task"| node_drift_check
node_drift_check -->|"calls evaluator"| node_drift_evaluation
node_drift_evaluation -->|"reads baseline"| node_reference_data
node_drift_evaluation -->|"saves report"| node_drift_dashboard
node_training_flow -->|"dispatches on drift"| node_retraining
node_retraining -->|"registers model"| node_model_registry
node_client -.->|"submits transaction"| node_inference_gateway
node_inference_gateway -->|"loads latest model"| node_model_registry
node_inference_gateway -->|"returns prediction"| node_client

click node_initial_training "https://github.com/koverthanan-git/credit_card_ct_project/blob/main/train.py"
click node_reference_data "https://github.com/koverthanan-git/credit_card_ct_project/blob/main/train.py"
click node_training_flow "https://github.com/koverthanan-git/credit_card_ct_project/blob/main/pipline.py"
click node_drift_check "https://github.com/koverthanan-git/credit_card_ct_project/blob/main/pipline.py"
click node_drift_evaluation "https://github.com/koverthanan-git/credit_card_ct_project/blob/main/monitor.py"
click node_retraining "https://github.com/koverthanan-git/credit_card_ct_project/blob/main/pipline.py"
click node_drift_dashboard "https://github.com/koverthanan-git/credit_card_ct_project/blob/main/monitor.py"
click node_inference_gateway "https://github.com/koverthanan-git/credit_card_ct_project/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_initial_training,node_reference_data,node_model_registry,node_client toneBlue
class node_training_flow,node_drift_check,node_drift_evaluation,node_retraining,node_drift_dashboard toneAmber
class node_inference_gateway toneMint
class node_operator toneIndigo
```

## Components

### Model lifecycle

- [Initial training](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/train.py): `train.py`
- [Reference data](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/train.py): `train.py`
- **MLflow registry**

### Drift and retraining

- [Training flow](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/pipline.py): `pipline.py`
- [Drift check](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/pipline.py): `pipline.py`
- [Drift evaluation](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/monitor.py): `monitor.py`
- [Conditional retraining](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/pipline.py): `pipline.py`
- [Drift dashboard](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/monitor.py): `monitor.py`

### Inference serving

- [Inference gateway](https://github.com/koverthanan-git/credit_card_ct_project/blob/main/app.py): `app.py`

### Other components

- **Operator**
- **Inference client**

## Connections

- Operator → Initial training: starts training
- Initial training → Reference data: writes baseline (evidence: `train.py`)
- Initial training → MLflow registry: registers model (evidence: `train.py`)
- Operator → Training flow: starts flow
- Training flow → Drift check: runs task (evidence: `pipline.py`)
- Drift check → Drift evaluation: calls evaluator (evidence: `pipline.py`)
- Drift evaluation → Reference data: reads baseline (evidence: `monitor.py`)
- Drift evaluation → Drift dashboard: saves report (evidence: `monitor.py`)
- Training flow → Conditional retraining: dispatches on drift (evidence: `pipline.py`)
- Conditional retraining → MLflow registry: registers model (evidence: `pipline.py`)
- Inference client → Inference gateway: submits transaction
- Inference gateway → MLflow registry: loads latest model (evidence: `app.py`)
- Inference gateway → Inference client: returns prediction (evidence: `app.py`)
