# fakhahmed/modern-data-rag architecture

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

- Interactive diagram: https://gitdiagram.com/fakhahmed/modern-data-rag
- Repository: https://github.com/fakhahmed/modern-data-rag

## Overview

The repository combines a dbt/BigQuery ELT pipeline with a ticket-ingestion workflow and a Streamlit Advanced RAG application. Users ask questions in the app; it retrieves ticket context from Qdrant, generates an answer with Vertex AI, and displays faithfulness and relevance evaluations. The pipeline transforms ticket data, then embeds and indexes it. Several deployment and scheduling relationships are documented in the README but their implementations are not present in the sampled source.

Main entry points: [`app/main.py`](https://github.com/fakhahmed/modern-data-rag/blob/main/app/main.py) (Chat interface), [`scripts/build_vector_db.py`](https://github.com/fakhahmed/modern-data-rag/blob/main/scripts/build_vector_db.py) (Vector ingestion), [`run_pipeline.py`](https://github.com/fakhahmed/modern-data-rag/blob/main/run_pipeline.py) (Pipeline runner), [`dbt_transform`](https://github.com/fakhahmed/modern-data-rag/tree/main/dbt_transform) (dbt project)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Pipeline orchestration"]
  node_runner["Pipeline runner<br/>[run_pipeline.py]"]
end

subgraph group_transform["Data transformation"]
  node_dbt["dbt project"]
  node_clean["Ticket cleaning"]
  node_warehouse[("BigQuery")]
end

subgraph group_indexing["Ticket indexing"]
  node_ingest["Vector ingestion<br/>[build_vector_db.py]"]
  node_embed["Vertex embeddings"]
  node_vectorstore[("Qdrant index")]
end

subgraph group_rag["RAG application"]
  node_ui["Chat interface<br/>[main.py]"]
  node_query["RAG query engine<br/>[main.py]"]
  node_llm["Gemini generation"]
  node_sources["Source tickets<br/>[main.py]"]
  node_faithfulness["Faithfulness audit<br/>[main.py]"]
  node_relevance["Relevance audit<br/>[main.py]"]
end

node_scheduler(("Cloud Scheduler"))
node_job["Cloud Run Job"]
node_user(("Support user"))

node_scheduler -.->|"starts daily"| node_job
node_job -.->|"runs pipeline"| node_runner
node_runner -->|"runs dbt"| node_dbt
node_dbt -.->|"executes model"| node_clean
node_clean -.->|"cleans tickets"| node_warehouse
node_runner -->|"runs ingestion"| node_ingest
node_ingest -->|"queries tickets"| node_warehouse
node_ingest -->|"creates embeddings"| node_embed
node_ingest -->|"stores vectors"| node_vectorstore
node_user -->|"asks question"| node_ui
node_ui -->|"submits query"| node_query
node_query -->|"retrieves tickets"| node_vectorstore
node_query -.->|"generates answer"| node_llm
node_ui -->|"displays sources"| node_sources
node_ui -->|"evaluates response"| node_faithfulness
node_ui -->|"evaluates response"| node_relevance

click node_runner "https://github.com/fakhahmed/modern-data-rag/blob/main/run_pipeline.py"
click node_dbt "https://github.com/fakhahmed/modern-data-rag/tree/main/dbt_transform"
click node_clean "https://github.com/fakhahmed/modern-data-rag/blob/main/dbt_transform/models/clean_it_tickets.sql"
click node_ingest "https://github.com/fakhahmed/modern-data-rag/blob/main/scripts/build_vector_db.py"
click node_ui "https://github.com/fakhahmed/modern-data-rag/blob/main/app/main.py"
click node_query "https://github.com/fakhahmed/modern-data-rag/blob/main/app/main.py"
click node_sources "https://github.com/fakhahmed/modern-data-rag/blob/main/app/main.py"
click node_faithfulness "https://github.com/fakhahmed/modern-data-rag/blob/main/app/main.py"
click node_relevance "https://github.com/fakhahmed/modern-data-rag/blob/main/app/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_runner,node_user toneBlue
class node_dbt,node_clean,node_warehouse toneAmber
class node_ingest,node_embed,node_vectorstore toneMint
class node_ui,node_query,node_llm,node_sources,node_faithfulness,node_relevance,node_scheduler toneRose
class node_job toneIndigo
```

## Components

### Pipeline orchestration

- [Pipeline runner](https://github.com/fakhahmed/modern-data-rag/blob/main/run_pipeline.py): `run_pipeline.py`

### Data transformation

- [dbt project](https://github.com/fakhahmed/modern-data-rag/tree/main/dbt_transform): `dbt_transform`
- [Ticket cleaning](https://github.com/fakhahmed/modern-data-rag/blob/main/dbt_transform/models/clean_it_tickets.sql): `dbt_transform/models/clean_it_tickets.sql`
- **BigQuery**

### Ticket indexing

- [Vector ingestion](https://github.com/fakhahmed/modern-data-rag/blob/main/scripts/build_vector_db.py): `scripts/build_vector_db.py`
- **Vertex embeddings**
- **Qdrant index**

### RAG application

- [Chat interface](https://github.com/fakhahmed/modern-data-rag/blob/main/app/main.py): `app/main.py`
- [RAG query engine](https://github.com/fakhahmed/modern-data-rag/blob/main/app/main.py): `app/main.py`
- **Gemini generation**
- [Source tickets](https://github.com/fakhahmed/modern-data-rag/blob/main/app/main.py): `app/main.py`
- [Faithfulness audit](https://github.com/fakhahmed/modern-data-rag/blob/main/app/main.py): `app/main.py`
- [Relevance audit](https://github.com/fakhahmed/modern-data-rag/blob/main/app/main.py): `app/main.py`

### Other components

- **Cloud Scheduler**
- **Cloud Run Job**
- **Support user**

## Connections

- Cloud Scheduler → Cloud Run Job: starts daily (evidence: `README.md`)
- Cloud Run Job → Pipeline runner: runs pipeline (evidence: `README.md`)
- Pipeline runner → dbt project: runs dbt (evidence: `run_pipeline.py`)
- dbt project → Ticket cleaning: executes model (evidence: `README.md`)
- Ticket cleaning → BigQuery: cleans tickets (evidence: `README.md`)
- Pipeline runner → Vector ingestion: runs ingestion (evidence: `run_pipeline.py`)
- Vector ingestion → BigQuery: queries tickets (evidence: `scripts/build_vector_db.py`)
- Vector ingestion → Vertex embeddings: creates embeddings (evidence: `scripts/build_vector_db.py`)
- Vector ingestion → Qdrant index: stores vectors (evidence: `scripts/build_vector_db.py`)
- Support user → Chat interface: asks question (evidence: `app/main.py`)
- Chat interface → RAG query engine: submits query (evidence: `app/main.py`)
- RAG query engine → Qdrant index: retrieves tickets (evidence: `app/main.py`)
- RAG query engine → Gemini generation: generates answer
- Chat interface → Source tickets: displays sources (evidence: `app/main.py`)
- Chat interface → Faithfulness audit: evaluates response (evidence: `app/main.py`)
- Chat interface → Relevance audit: evaluates response (evidence: `app/main.py`)
