# srotriyosengupta/creditcardfrauddetectionpipeline architecture

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

- Interactive diagram: https://gitdiagram.com/srotriyosengupta/creditcardfrauddetectionpipeline
- Repository: https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline

## Overview

##### Project type and purpose
- This is a production-grade, automated machine-learning pipeline for credit-card fraud detection.
- It uses Airflow DAGs to orchestrate model training, shadow-model generation, and prediction validation.
- CI/CD is configured via GitHub Actions; the entire pipeline can be containerized with Docker.

##### File structure
- Top-level:
- dags/ — contains Airflow DAG definitions (fraudvalidation_dag.py)
- scripts/ — Python scripts for training (train_model.py), shadow-model generation, and validation
- models/ — serialized model artifacts (prod_model.pkl, shadow_model.pkl)
- tests/ — unit tests (test_validation_logic.py)
- .github/workflows/ci.yml — CI/CD pipeline definition
- dockerfile — container build instructions
- requirements.txt — Python dependencies
- Patterns:
- Orchestration layer (Airflow) triggers individual script components
- Clear separation: compute (scripts), storage (models/), orchestration (dags/), CI/CD (.github)

##### README for additional insights
- Confirms use of IBM’s synthetic dataset.
- Emphasizes end-to-end pipeline: training → shadow validation → testing → deployment checks.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Ingestion Layer
    subgraph "Data Ingestion"
        DS["IBM Synthetic Dataset"]:::storage
    end

    %% Orchestration Layer
    subgraph "Orchestration Layer"
        AF["Airflow DAG\nfraudvalidation_dag.py"]:::orchestration
    end

    %% Compute Layer
    subgraph "Compute Layer"
        TM["train_model.py"]:::compute
        SM["generate_shadowmodel.py"]:::compute
        VP["validate_predictions.py"]:::compute
    end

    %% Model Storage
    subgraph "Model Storage"
        PROD["prod_model.pkl"]:::storage
        SHADOW["shadow_model.pkl"]:::storage
    end

    %% Testing & Validation
    subgraph "Testing & Validation"
        TESTS["test_validation_logic.py"]:::testing
    end

    %% CI/CD & Containerization
    subgraph "CI/CD & Containerization"
        CI["GitHub Actions\nci.yml"]:::cicd
        DOCKER["Dockerfile"]:::cicd
        REQ["requirements.txt"]:::cicd
        README["README.md"]:::cicd
    end

    %% Data Flow
    DS --> AF
    AF --> TM
    AF --> SM
    TM --> PROD
    SM --> SHADOW
    PROD --> VP
    SHADOW --> VP
    VP --> TESTS

    %% CI/CD Flow
    CI --> TESTS
    CI --> DOCKER
    CI --> REQ

    %% Click Events
    click AF "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/blob/main/dags/fraudvalidation_dag.py"
    click TM "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/blob/main/scripts/train_model.py"
    click SM "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/blob/main/scripts/generate_shadowmodel.py"
    click VP "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/blob/main/scripts/validate_predictions.py"
    click PROD "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/blob/main/models/prod_model.pkl"
    click SHADOW "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/blob/main/models/shadow_model.pkl"
    click TESTS "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/blob/main/tests/test_validation_logic.py"
    click CI "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/blob/main/.github/workflows/ci.yml"
    click DOCKER "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/tree/main/dockerfile"
    click REQ "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/blob/main/requirements.txt"
    click README "https://github.com/srotriyosengupta/creditcardfrauddetectionpipeline/blob/main/README.md"

    %% Styles
    classDef orchestration fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef compute fill:#90EE90,stroke:#000,stroke-width:1px
    classDef storage fill:#FFFF99,stroke:#000,stroke-width:1px
    classDef testing fill:#DDA0DD,stroke:#000,stroke-width:1px
    classDef cicd fill:#FFA500,stroke:#000,stroke-width:1px
```
