# anshikabangwal/rag-based architecture

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

- Interactive diagram: https://gitdiagram.com/anshikabangwal/rag-based
- Repository: https://github.com/anshikabangwal/rag-based

## Overview

This is a Streamlit study assistant: students upload PDFs, which the app extracts page text from, chunks and indexes, then uses retrieval-augmented generation to answer questions with source pages. The README also describes planned PYQ extraction, topic classification, frequency analysis, and a preparation dashboard; the corresponding files are empty in the excerpts, so these appear as planned components without asserted runtime connections. The main workflow is evidenced by app.py and core modules; unsampled feature behavior is not inferred.

Main entry points: [`app.py`](https://github.com/anshikabangwal/rag-based/blob/main/app.py) (Streamlit app), [`config.py`](https://github.com/anshikabangwal/rag-based/blob/main/config.py) (Runtime settings), [`core/rag_chain.py`](https://github.com/anshikabangwal/rag-based/blob/main/core/rag_chain.py) (RAG answering), [`core/vector_store.py`](https://github.com/anshikabangwal/rag-based/blob/main/core/vector_store.py) (Chroma index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Student experience"]
  node_app["Streamlit app<br/>[app.py]"]
end

subgraph group_ingestion["Document ingestion"]
  node_pdf["PDF extraction<br/>[pdf_processor.py]"]
  node_chunk["Page chunking<br/>[chunker.py]"]
  node_store[("Chroma index<br/>[vector_store.py]")]
  node_embeddings["Text embeddings<br/>[embeddings.py]"]
end

subgraph group_qa["Grounded Q&amp;A"]
  node_rag["RAG answering<br/>[rag_chain.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

subgraph group_planning["Study planning"]
  node_extract["PYQ extraction"]
  node_classify["Topic classification"]
  node_frequency["Frequency analysis"]
  node_dashboard["Preparation dashboard<br/>[app.py]"]
end

node_student(("Student"))
node_groq["Groq LLM"]

node_student -->|"uploads and asks"| node_app
node_app -->|"extracts pages"| node_pdf
node_app -->|"chunks pages"| node_chunk
node_app -->|"adds chunks"| node_store
node_store -->|"embeds text"| node_embeddings
node_app -->|"requests answer"| node_rag
node_rag -->|"queries chunks"| node_store
node_rag -->|"invokes model"| node_groq
node_app -->|"reads upload path"| node_config
node_chunk -->|"reads chunk settings"| node_config
node_embeddings -->|"reads model setting"| node_config
node_store -->|"reads database path"| node_config
node_rag -->|"reads model settings"| node_config
node_extract -.->|"feeds questions"| node_classify
node_classify -.->|"maps topics"| node_frequency
node_frequency -.->|"informs priorities"| node_dashboard

click node_app "https://github.com/anshikabangwal/rag-based/blob/main/app.py"
click node_pdf "https://github.com/anshikabangwal/rag-based/blob/main/core/pdf_processor.py"
click node_chunk "https://github.com/anshikabangwal/rag-based/blob/main/core/chunker.py"
click node_store "https://github.com/anshikabangwal/rag-based/blob/main/core/vector_store.py"
click node_embeddings "https://github.com/anshikabangwal/rag-based/blob/main/core/embeddings.py"
click node_rag "https://github.com/anshikabangwal/rag-based/blob/main/core/rag_chain.py"
click node_config "https://github.com/anshikabangwal/rag-based/blob/main/config.py"
click node_extract "https://github.com/anshikabangwal/rag-based/blob/main/core/pyq_analysis/question_extractor.py"
click node_classify "https://github.com/anshikabangwal/rag-based/blob/main/core/pyq_analysis/topic_classifier.py"
click node_frequency "https://github.com/anshikabangwal/rag-based/blob/main/core/pyq_analysis/frequency_analyzer.py"
click node_dashboard "https://github.com/anshikabangwal/rag-based/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_app toneBlue
class node_pdf,node_chunk,node_store,node_embeddings toneAmber
class node_rag,node_config toneMint
class node_extract,node_classify,node_frequency,node_dashboard toneRose
class node_student,node_groq toneIndigo
```

## Components

### Student experience

- [Streamlit app](https://github.com/anshikabangwal/rag-based/blob/main/app.py): `app.py`

### Document ingestion

- [PDF extraction](https://github.com/anshikabangwal/rag-based/blob/main/core/pdf_processor.py): `core/pdf_processor.py`
- [Page chunking](https://github.com/anshikabangwal/rag-based/blob/main/core/chunker.py): `core/chunker.py`
- [Chroma index](https://github.com/anshikabangwal/rag-based/blob/main/core/vector_store.py): `core/vector_store.py`
- [Text embeddings](https://github.com/anshikabangwal/rag-based/blob/main/core/embeddings.py): `core/embeddings.py`

### Grounded Q&A

- [RAG answering](https://github.com/anshikabangwal/rag-based/blob/main/core/rag_chain.py): `core/rag_chain.py`
- [Runtime settings](https://github.com/anshikabangwal/rag-based/blob/main/config.py): `config.py`

### Study planning

- [PYQ extraction](https://github.com/anshikabangwal/rag-based/blob/main/core/pyq_analysis/question_extractor.py): `core/pyq_analysis/question_extractor.py`
- [Topic classification](https://github.com/anshikabangwal/rag-based/blob/main/core/pyq_analysis/topic_classifier.py): `core/pyq_analysis/topic_classifier.py`
- [Frequency analysis](https://github.com/anshikabangwal/rag-based/blob/main/core/pyq_analysis/frequency_analyzer.py): `core/pyq_analysis/frequency_analyzer.py`
- [Preparation dashboard](https://github.com/anshikabangwal/rag-based/blob/main/app.py): `app.py`

### Other components

- **Student**
- **Groq LLM**

## Connections

- Student → Streamlit app: uploads and asks (evidence: `README.md`)
- Streamlit app → PDF extraction: extracts pages (evidence: `app.py`)
- Streamlit app → Page chunking: chunks pages (evidence: `app.py`)
- Streamlit app → Chroma index: adds chunks (evidence: `app.py`)
- Chroma index → Text embeddings: embeds text (evidence: `core/vector_store.py`)
- Streamlit app → RAG answering: requests answer (evidence: `app.py`)
- RAG answering → Chroma index: queries chunks (evidence: `core/rag_chain.py`)
- RAG answering → Groq LLM: invokes model (evidence: `core/rag_chain.py`)
- Streamlit app → Runtime settings: reads upload path (evidence: `app.py`)
- Page chunking → Runtime settings: reads chunk settings (evidence: `core/chunker.py`)
- Text embeddings → Runtime settings: reads model setting (evidence: `core/embeddings.py`)
- Chroma index → Runtime settings: reads database path (evidence: `core/vector_store.py`)
- RAG answering → Runtime settings: reads model settings (evidence: `core/rag_chain.py`)
- PYQ extraction → Topic classification: feeds questions (evidence: `README.md`)
- Topic classification → Frequency analysis: maps topics (evidence: `README.md`)
- Frequency analysis → Preparation dashboard: informs priorities (evidence: `README.md`)
