# faizns/final-project-fraud-transaction-pipeline architecture

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

- Interactive diagram: https://gitdiagram.com/faizns/final-project-fraud-transaction-pipeline
- Repository: https://github.com/faizns/final-project-fraud-transaction-pipeline

## Overview

This repository implements batch and streaming fraud-transaction pipelines, with BigQuery warehouse models and a documented Looker dashboard. The batch DAG invokes download, Spark transformation, GCS upload, external-table creation, and dbt runs; the streaming producer publishes Avro records that the consumer stores and checks for fraud. The graph preserves the documented warehouse, provisioning, notification, and dashboard capabilities. Edges reflect the DAG excerpt or explicit README statements; dbt model internals and Terraform configuration were not sampled, so their internal links are omitted.

Main entry points: [`dags/batch_dag.py`](https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/dags/batch_dag.py) (Batch Orchestrator), [`kafka/consumer.py`](https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/kafka/consumer.py) (Fraud Consumer), [`kafka/producer.py`](https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/kafka/producer.py) (Avro Producer), [`terraform/main.tf`](https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/terraform/main.tf) (Cloud Provisioning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_batch["Batch Pipeline"]
  node_batch_dag["Batch Orchestrator<br/>[batch_dag.py]"]
  node_download["Dataset Download<br/>[download.sh]"]
  node_spark["Batch Transform<br/>[spark_transform.py]"]
end

subgraph group_stream["Streaming Pipeline"]
  node_stream_producer["Avro Producer<br/>[producer.py]"]
  node_kafka["Kafka Topic"]
  node_registry["Schema Registry"]
  node_stream_consumer["Fraud Consumer<br/>[consumer.py]"]
  node_email["Email Service"]
end

subgraph group_warehouse["Warehouse Analytics"]
  node_external_table[("External Table")]
  node_dbt_staging["Staging Model"]
  node_dbt_core["Core Star Schema"]
  node_dbt_marts["Analytic Marts"]
  node_looker["Looker Dashboard"]
end

subgraph group_platform["Cloud Platform"]
  node_gcs[("Cloud Storage")]
  node_bigquery[("BigQuery")]
  node_terraform["Cloud Provisioning<br/>[main.tf]"]
end

node_operator(("Pipeline Operator"))
node_dataset["Transaction Dataset"]

node_operator -->|"runs batch"| node_batch_dag
node_dataset -->|"provides CSV"| node_download
node_batch_dag -->|"invokes"| node_download
node_batch_dag -->|"runs transform"| node_spark
node_batch_dag -->|"uploads output"| node_gcs
node_batch_dag -->|"creates table"| node_external_table
node_batch_dag -->|"runs staging"| node_dbt_staging
node_batch_dag -->|"runs transforms"| node_dbt_core
node_stream_producer -->|"publishes records"| node_kafka
node_stream_producer -->|"uses schemas"| node_registry
node_stream_consumer -->|"consumes records"| node_kafka
node_stream_consumer -->|"uses schemas"| node_registry
node_stream_consumer -->|"writes payments"| node_bigquery
node_stream_consumer -->|"sends fraud alert"| node_email
node_terraform -->|"provisions"| node_gcs
node_terraform -->|"provisions"| node_bigquery
node_dbt_core -.-> node_dbt_marts
node_dbt_marts -->|"supports reporting"| node_looker

click node_batch_dag "https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/dags/batch_dag.py"
click node_download "https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/dags/download.sh"
click node_spark "https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/spark/spark_transform.py"
click node_stream_producer "https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/kafka/producer.py"
click node_stream_consumer "https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/kafka/consumer.py"
click node_dbt_staging "https://github.com/faizns/final-project-fraud-transaction-pipeline/tree/main/dbt/models/staging"
click node_dbt_core "https://github.com/faizns/final-project-fraud-transaction-pipeline/tree/main/dbt/models/core"
click node_dbt_marts "https://github.com/faizns/final-project-fraud-transaction-pipeline/tree/main/dbt/models/mart"
click node_terraform "https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/terraform/main.tf"

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_batch_dag,node_download,node_spark toneBlue
class node_stream_producer,node_kafka,node_registry,node_stream_consumer,node_email toneAmber
class node_external_table,node_dbt_staging,node_dbt_core,node_dbt_marts,node_looker toneMint
class node_gcs,node_bigquery,node_terraform toneRose
class node_operator,node_dataset toneIndigo
```

## Components

### Batch Pipeline

- [Batch Orchestrator](https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/dags/batch_dag.py): `dags/batch_dag.py`
- [Dataset Download](https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/dags/download.sh): `dags/download.sh`
- [Batch Transform](https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/spark/spark_transform.py): `spark/spark_transform.py`

### Streaming Pipeline

- [Avro Producer](https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/kafka/producer.py): `kafka/producer.py`
- **Kafka Topic**
- **Schema Registry**
- [Fraud Consumer](https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/kafka/consumer.py): `kafka/consumer.py`
- **Email Service**

### Warehouse Analytics

- **External Table**
- [Staging Model](https://github.com/faizns/final-project-fraud-transaction-pipeline/tree/main/dbt/models/staging): `dbt/models/staging`
- [Core Star Schema](https://github.com/faizns/final-project-fraud-transaction-pipeline/tree/main/dbt/models/core): `dbt/models/core`
- [Analytic Marts](https://github.com/faizns/final-project-fraud-transaction-pipeline/tree/main/dbt/models/mart): `dbt/models/mart`
- **Looker Dashboard**

### Cloud Platform

- **Cloud Storage**
- **BigQuery**
- [Cloud Provisioning](https://github.com/faizns/final-project-fraud-transaction-pipeline/blob/main/terraform/main.tf): `terraform/main.tf`

### Other components

- **Pipeline Operator**
- **Transaction Dataset**

## Connections

- Pipeline Operator → Batch Orchestrator: runs batch (evidence: `readme.md`)
- Transaction Dataset → Dataset Download: provides CSV (evidence: `readme.md`)
- Batch Orchestrator → Dataset Download: invokes (evidence: `dags/batch_dag.py`)
- Batch Orchestrator → Batch Transform: runs transform (evidence: `dags/batch_dag.py`)
- Batch Orchestrator → Cloud Storage: uploads output (evidence: `dags/batch_dag.py`)
- Batch Orchestrator → External Table: creates table (evidence: `dags/batch_dag.py`)
- Batch Orchestrator → Staging Model: runs staging (evidence: `dags/batch_dag.py`)
- Batch Orchestrator → Core Star Schema: runs transforms (evidence: `dags/batch_dag.py`)
- Avro Producer → Kafka Topic: publishes records (evidence: `kafka/producer.py`)
- Avro Producer → Schema Registry: uses schemas (evidence: `kafka/producer.py`)
- Fraud Consumer → Kafka Topic: consumes records (evidence: `kafka/consumer.py`)
- Fraud Consumer → Schema Registry: uses schemas (evidence: `kafka/consumer.py`)
- Fraud Consumer → BigQuery: writes payments (evidence: `kafka/consumer.py`)
- Fraud Consumer → Email Service: sends fraud alert (evidence: `kafka/consumer.py`)
- Cloud Provisioning → Cloud Storage: provisions (evidence: `readme.md`)
- Cloud Provisioning → BigQuery: provisions (evidence: `readme.md`)
- Core Star Schema → Analytic Marts
- Analytic Marts → Looker Dashboard: supports reporting (evidence: `readme.md`)
