# srikeerthi05/researchiq architecture

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

- Interactive diagram: https://gitdiagram.com/srikeerthi05/researchiq
- Repository: https://github.com/srikeerthi05/researchiq

## Overview

ResearchIQ is a research-paper question-answering application. Its workflow accepts a question through a REST API, loads a document’s saved index, retrieves and filters relevant passages, builds a grounded prompt, and returns an answer with page-level sources. Index creation extracts PDF pages, chunks their text, embeds the chunks, and persists a FAISS index with metadata. The README also describes Swagger UI and persistent storage. Evaluation modules are represented as a separate capability; their internal relationships are omitted where source was not sampled.

Main entry points: [`backend/app/paper_search.py`](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/paper_search.py) (Paper Search), [`backend/app/rag.py`](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/rag.py) (RAG Orchestrator), [`backend/app/evaluation`](https://github.com/srikeerthi05/researchiq/tree/main/backend/app/evaluation) (Retrieval Evaluation), [`backend/app/main.py`](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/main.py) (REST API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api_qa["Question Answering"]
  node_rest_api["REST API<br/>[main.py]"]
  node_rag["RAG Orchestrator<br/>[rag.py]"]
  node_paper_search["Paper Search<br/>[paper_search.py]"]
  node_llm["Answer Generation<br/>[llm.py]"]
end

subgraph group_ingestion["Document Ingestion"]
  node_pdf_processor["PDF Extraction<br/>[pdf_processor.py]"]
  node_chunker["Text Chunking<br/>[chunker.py]"]
  node_embeddings["Embedding Generation<br/>[embeddings.py]"]
end

subgraph group_storage["Index Storage"]
  node_vector_store[("Vector Persistence<br/>[vector_store.py]")]
  node_faiss[("FAISS Index")]
end

subgraph group_evaluation["Retrieval Evaluation"]
  node_evaluation["Retrieval Evaluation"]
  node_evaluation_dataset["Evaluation Dataset"]
  node_retrieval_metrics["Retrieval Metrics"]
  node_chunk_inspection["Chunk Inspection<br/>[inspect_chunks.py]"]
end

node_researcher(("Researcher"))
node_ollama["Ollama Runtime"]
node_sentence_transformers["Sentence Transformers"]
node_paper_pdf["Research Paper PDF"]

node_researcher -->|"asks via"| node_rest_api
node_rest_api -.->|"routes questions"| node_rag
node_rag -->|"loads and searches"| node_paper_search
node_rag -->|"requests generation"| node_llm
node_llm -->|"sends prompt"| node_ollama
node_paper_search -->|"extracts pages"| node_pdf_processor
node_paper_search -->|"chunks text"| node_chunker
node_paper_search -->|"embeds chunks and queries"| node_embeddings
node_embeddings -->|"encodes text"| node_sentence_transformers
node_paper_search -->|"builds and searches index"| node_faiss
node_paper_search -->|"saves and loads"| node_vector_store
node_vector_store -->|"persists index"| node_faiss
node_paper_pdf -->|"provides input"| node_pdf_processor
node_chunk_inspection -->|"loads document index"| node_paper_search
node_evaluation -.->|"uses dataset"| node_evaluation_dataset
node_evaluation -.->|"evaluates retrieval"| node_retrieval_metrics

click node_rest_api "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/main.py"
click node_rag "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/rag.py"
click node_paper_search "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/paper_search.py"
click node_llm "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/llm.py"
click node_pdf_processor "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/pdf_processor.py"
click node_chunker "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/chunker.py"
click node_embeddings "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/embeddings.py"
click node_vector_store "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/vector_store.py"
click node_paper_pdf "https://github.com/srikeerthi05/researchiq/blob/main/data/papers/AttentionIsAllYouNeed.pdf"
click node_evaluation "https://github.com/srikeerthi05/researchiq/tree/main/backend/app/evaluation"
click node_evaluation_dataset "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/evaluation/evaluation_dataset.json"
click node_retrieval_metrics "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/evaluation/retrieval_metrics.py"
click node_chunk_inspection "https://github.com/srikeerthi05/researchiq/blob/main/backend/app/evaluation/inspect_chunks.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_rest_api,node_rag,node_paper_search,node_llm toneBlue
class node_pdf_processor,node_chunker,node_embeddings toneAmber
class node_vector_store,node_faiss toneMint
class node_evaluation,node_evaluation_dataset,node_retrieval_metrics,node_chunk_inspection toneRose
class node_researcher,node_ollama,node_sentence_transformers toneIndigo
class node_paper_pdf toneTeal
```

## Components

### Question Answering

- [REST API](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/main.py): `backend/app/main.py`
- [RAG Orchestrator](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/rag.py): `backend/app/rag.py`
- [Paper Search](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/paper_search.py): `backend/app/paper_search.py`
- [Answer Generation](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/llm.py): `backend/app/llm.py`

### Document Ingestion

- [PDF Extraction](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/pdf_processor.py): `backend/app/pdf_processor.py`
- [Text Chunking](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/chunker.py): `backend/app/chunker.py`
- [Embedding Generation](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/embeddings.py): `backend/app/embeddings.py`

### Index Storage

- [Vector Persistence](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/vector_store.py): `backend/app/vector_store.py`
- **FAISS Index**

### Retrieval Evaluation

- [Retrieval Evaluation](https://github.com/srikeerthi05/researchiq/tree/main/backend/app/evaluation): `backend/app/evaluation`
- [Evaluation Dataset](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/evaluation/evaluation_dataset.json): `backend/app/evaluation/evaluation_dataset.json`
- [Retrieval Metrics](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/evaluation/retrieval_metrics.py): `backend/app/evaluation/retrieval_metrics.py`
- [Chunk Inspection](https://github.com/srikeerthi05/researchiq/blob/main/backend/app/evaluation/inspect_chunks.py): `backend/app/evaluation/inspect_chunks.py`

### Other components

- **Researcher**
- **Ollama Runtime**
- **Sentence Transformers**
- [Research Paper PDF](https://github.com/srikeerthi05/researchiq/blob/main/data/papers/AttentionIsAllYouNeed.pdf): `data/papers/AttentionIsAllYouNeed.pdf`

## Connections

- Researcher → REST API: asks via (evidence: `README.md`)
- REST API → RAG Orchestrator: routes questions
- RAG Orchestrator → Paper Search: loads and searches (evidence: `backend/app/rag.py`)
- RAG Orchestrator → Answer Generation: requests generation (evidence: `backend/app/rag.py`)
- Answer Generation → Ollama Runtime: sends prompt (evidence: `backend/app/llm.py`)
- Paper Search → PDF Extraction: extracts pages (evidence: `backend/app/paper_search.py`)
- Paper Search → Text Chunking: chunks text (evidence: `backend/app/paper_search.py`)
- Paper Search → Embedding Generation: embeds chunks and queries (evidence: `backend/app/paper_search.py`)
- Embedding Generation → Sentence Transformers: encodes text (evidence: `backend/app/embeddings.py`)
- Paper Search → FAISS Index: builds and searches index (evidence: `backend/app/paper_search.py`)
- Paper Search → Vector Persistence: saves and loads (evidence: `backend/app/paper_search.py`)
- Vector Persistence → FAISS Index: persists index (evidence: `backend/app/vector_store.py`)
- Research Paper PDF → PDF Extraction: provides input (evidence: `README.md`)
- Chunk Inspection → Paper Search: loads document index (evidence: `backend/app/evaluation/inspect_chunks.py`)
- Retrieval Evaluation → Evaluation Dataset: uses dataset
- Retrieval Evaluation → Retrieval Metrics: evaluates retrieval
