# dharun-cohere/rag_for_complex_data architecture

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

- Interactive diagram: https://gitdiagram.com/dharun-cohere/rag_for_complex_data
- Repository: https://github.com/dharun-cohere/rag_for_complex_data

## Overview

This is a single-script financial-document RAG prototype. Its implemented workflow parses the NVIDIA PDF into Markdown, chunks and indexes the content, retrieves and reranks relevant passages, then generates and prints an answer to a hard-coded question. The README describes broader analysis use cases, but the shown runtime does not implement separate forecasting, risk, or investment workflows. Edges reflect calls and data transfers visible in app.py; the vector store is configured as a local Qdrant database.

Main entry points: [`app.py`](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py) (RAG workflow), [`NVIDIAAn.pdf`](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/NVIDIAAn.pdf) (NVIDIA PDF), [`data/parsed_document.md`](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/data/parsed_document.md) (Parsed Markdown)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Document ingestion"]
  node_workflow["RAG workflow<br/>[app.py]"]
  node_source_pdf["NVIDIA PDF<br/>[NVIDIAAn.pdf]"]
  node_parser["PDF parser<br/>[app.py]"]
  node_markdown_doc["Parsed Markdown<br/>[parsed_document.md]"]
  node_loader["Markdown loader<br/>[app.py]"]
  node_splitter["Text splitter<br/>[app.py]"]
  node_embeddings["Embedding encoder<br/>[app.py]"]
end

subgraph group_retrieval["Search and retrieval"]
  node_vector_store[("Qdrant index<br/>[app.py]")]
  node_retriever["Top-k retriever<br/>[app.py]"]
  node_reranker["Passage reranker<br/>[app.py]"]
end

subgraph group_generation["Answer generation"]
  node_qa_chain["Retrieval QA<br/>[app.py]"]
  node_groq_model["Groq language model"]
  node_sample_query["Sample question<br/>[app.py]"]
  node_console["Printed answer<br/>[app.py]"]
end

node_workflow -->|"parses"| node_source_pdf
node_workflow -->|"calls"| node_parser
node_parser -->|"reads"| node_source_pdf
node_workflow -->|"writes"| node_markdown_doc
node_workflow -->|"loads"| node_loader
node_loader -->|"reads"| node_markdown_doc
node_workflow -->|"chunks"| node_splitter
node_workflow -->|"creates"| node_embeddings
node_workflow -->|"indexes"| node_vector_store
node_workflow -->|"configures"| node_retriever
node_workflow -->|"configures"| node_reranker
node_workflow -->|"builds and invokes"| node_qa_chain
node_qa_chain -->|"retrieves passages"| node_retriever
node_retriever -->|"searches"| node_vector_store
node_qa_chain -->|"reranks passages"| node_reranker
node_workflow -->|"configures"| node_groq_model
node_qa_chain -->|"generates answer"| node_groq_model
node_workflow -->|"submits"| node_sample_query
node_workflow -->|"prints response"| node_console

click node_workflow "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py"
click node_source_pdf "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/NVIDIAAn.pdf"
click node_parser "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py"
click node_markdown_doc "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/data/parsed_document.md"
click node_loader "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py"
click node_splitter "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py"
click node_embeddings "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py"
click node_vector_store "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py"
click node_retriever "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py"
click node_reranker "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py"
click node_qa_chain "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py"
click node_sample_query "https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py"
click node_console "https://github.com/dharun-cohere/rag_for_complex_data/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_workflow,node_source_pdf,node_parser,node_markdown_doc,node_loader,node_splitter,node_embeddings toneBlue
class node_vector_store,node_retriever,node_reranker toneAmber
class node_qa_chain,node_groq_model,node_sample_query,node_console toneMint
```

## Components

### Document ingestion

- [RAG workflow](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`
- [NVIDIA PDF](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/NVIDIAAn.pdf): `NVIDIAAn.pdf`
- [PDF parser](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`
- [Parsed Markdown](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/data/parsed_document.md): `data/parsed_document.md`
- [Markdown loader](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`
- [Text splitter](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`
- [Embedding encoder](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`

### Search and retrieval

- [Qdrant index](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`
- [Top-k retriever](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`
- [Passage reranker](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`

### Answer generation

- [Retrieval QA](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`
- **Groq language model**
- [Sample question](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`
- [Printed answer](https://github.com/dharun-cohere/rag_for_complex_data/blob/main/app.py): `app.py`

## Connections

- RAG workflow → NVIDIA PDF: parses (evidence: `app.py`)
- RAG workflow → PDF parser: calls (evidence: `app.py`)
- PDF parser → NVIDIA PDF: reads (evidence: `app.py`)
- RAG workflow → Parsed Markdown: writes (evidence: `app.py`)
- RAG workflow → Markdown loader: loads (evidence: `app.py`)
- Markdown loader → Parsed Markdown: reads (evidence: `app.py`)
- RAG workflow → Text splitter: chunks (evidence: `app.py`)
- RAG workflow → Embedding encoder: creates (evidence: `app.py`)
- RAG workflow → Qdrant index: indexes (evidence: `app.py`)
- RAG workflow → Top-k retriever: configures (evidence: `app.py`)
- RAG workflow → Passage reranker: configures (evidence: `app.py`)
- RAG workflow → Retrieval QA: builds and invokes (evidence: `app.py`)
- Retrieval QA → Top-k retriever: retrieves passages (evidence: `app.py`)
- Top-k retriever → Qdrant index: searches (evidence: `app.py`)
- Retrieval QA → Passage reranker: reranks passages (evidence: `app.py`)
- RAG workflow → Groq language model: configures (evidence: `app.py`)
- Retrieval QA → Groq language model: generates answer (evidence: `app.py`)
- RAG workflow → Sample question: submits (evidence: `app.py`)
- RAG workflow → Printed answer: prints response (evidence: `app.py`)
