# anilch963/research-intelligence-platform architecture

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

- Interactive diagram: https://gitdiagram.com/anilch963/research-intelligence-platform
- Repository: https://github.com/anilch963/research-intelligence-platform

## Overview

Research Intelligence is a document-grounded RAG platform: users submit a question, choose vector or hybrid retrieval, and receive an answer with inline citations and source snippets. Documents are loaded and chunked into a persistent Chroma collection; query handling checks index availability, retrieves context, and calls the chat model. The repository also includes a RAGAS evaluation workflow and draft-testset generation. The README documents these capabilities, but evaluation internals beyond the sampled runner and draft generator are not represented in detail.

Main entry points: [`backend/app/retrievers.py`](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py) (Retriever Selection), [`backend/app/rag.py`](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/rag.py) (RAG Answering), [`backend/eval/run_ragas.py`](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/eval/run_ragas.py) (RAGAS Runner), [`backend/app/ingest.py`](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/ingest.py) (Document Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Question Interface"]
  node_web_ui["Research UI<br/>[App.jsx]"]
  node_http_client["API Client<br/>[api.js]"]
end

subgraph group_query["Query Answering"]
  node_api["FastAPI API<br/>[main.py]"]
  node_rag["RAG Answering<br/>[rag.py]"]
  node_retriever["Retriever Selection<br/>[retrievers.py]"]
  node_bm25["BM25 Search<br/>[retrievers.py]"]
  node_vector["Vector Search<br/>[retrievers.py]"]
  node_chat_model["OpenAI Chat Model"]
  node_settings["Runtime Settings<br/>[config.py]"]
end

subgraph group_index["Document Indexing"]
  node_chunk_store[("Chroma Chunk Store<br/>[retrievers.py]")]
  node_embedding["OpenAI Embeddings<br/>[retrievers.py]"]
  node_ingest["Document Ingestion<br/>[ingest.py]"]
  node_source_docs["Source Documents"]
end

subgraph group_evaluation["RAG Evaluation"]
  node_eval_runner["RAGAS Runner<br/>[run_ragas.py]"]
  node_testset_drafter["Testset Drafter<br/>[draft_testset.py]"]
  node_testset["Evaluation Testset<br/>[testset.json]"]
  node_eval_results["Evaluation Results"]
  node_eval_compare["Results Comparison<br/>[compare.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"asks questions"| node_web_ui
node_web_ui -->|"calls"| node_http_client
node_http_client -->|"sends query"| node_api
node_api -->|"answers with"| node_rag
node_api -->|"checks chunks"| node_retriever
node_rag -->|"retrieves context"| node_retriever
node_retriever -->|"selects hybrid"| node_bm25
node_retriever -->|"selects mode"| node_vector
node_bm25 -->|"reads chunks"| node_chunk_store
node_vector -->|"searches vectors"| node_chunk_store
node_chunk_store -.->|"embeds queries"| node_embedding
node_rag -->|"generates answer"| node_chat_model
node_ingest -->|"loads files"| node_source_docs
node_ingest -->|"writes chunks"| node_chunk_store
node_ingest -->|"resets caches"| node_retriever
node_settings -->|"configures"| node_ingest
node_settings -->|"configures"| node_retriever
node_settings -->|"configures"| node_rag
node_eval_runner -.->|"reads cases"| node_testset
node_eval_runner -->|"runs questions"| node_rag
node_eval_runner -->|"checks index"| node_retriever
node_eval_runner -->|"writes report"| node_eval_results
node_testset_drafter -->|"loads chunks"| node_retriever
node_eval_compare -.->|"compares reports"| node_eval_results

click node_web_ui "https://github.com/anilch963/research-intelligence-platform/blob/main/frontend/src/App.jsx"
click node_http_client "https://github.com/anilch963/research-intelligence-platform/blob/main/frontend/src/api.js"
click node_api "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/main.py"
click node_rag "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/rag.py"
click node_retriever "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py"
click node_bm25 "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py"
click node_vector "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py"
click node_chunk_store "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py"
click node_embedding "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py"
click node_ingest "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/ingest.py"
click node_source_docs "https://github.com/anilch963/research-intelligence-platform/tree/main/backend/data/docs"
click node_settings "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/config.py"
click node_eval_runner "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/eval/run_ragas.py"
click node_testset_drafter "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/eval/draft_testset.py"
click node_testset "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/eval/testset.json"
click node_eval_results "https://github.com/anilch963/research-intelligence-platform/tree/main/backend/eval/results"
click node_eval_compare "https://github.com/anilch963/research-intelligence-platform/blob/main/backend/eval/compare.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_web_ui,node_http_client toneBlue
class node_api,node_rag,node_retriever,node_bm25,node_vector,node_chat_model,node_settings toneAmber
class node_chunk_store,node_embedding,node_ingest,node_source_docs toneMint
class node_eval_runner,node_testset_drafter,node_testset,node_eval_results,node_eval_compare toneRose
class node_researcher toneIndigo
```

## Components

### Question Interface

- [Research UI](https://github.com/anilch963/research-intelligence-platform/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API Client](https://github.com/anilch963/research-intelligence-platform/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Query Answering

- [FastAPI API](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/main.py): `backend/app/main.py`
- [RAG Answering](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/rag.py): `backend/app/rag.py`
- [Retriever Selection](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py): `backend/app/retrievers.py`
- [BM25 Search](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py): `backend/app/retrievers.py`
- [Vector Search](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py): `backend/app/retrievers.py`
- **OpenAI Chat Model**
- [Runtime Settings](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/config.py): `backend/app/config.py`

### Document Indexing

- [Chroma Chunk Store](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py): `backend/app/retrievers.py`
- [OpenAI Embeddings](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/retrievers.py): `backend/app/retrievers.py`
- [Document Ingestion](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/app/ingest.py): `backend/app/ingest.py`
- [Source Documents](https://github.com/anilch963/research-intelligence-platform/tree/main/backend/data/docs): `backend/data/docs`

### RAG Evaluation

- [RAGAS Runner](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/eval/run_ragas.py): `backend/eval/run_ragas.py`
- [Testset Drafter](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/eval/draft_testset.py): `backend/eval/draft_testset.py`
- [Evaluation Testset](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/eval/testset.json): `backend/eval/testset.json`
- [Evaluation Results](https://github.com/anilch963/research-intelligence-platform/tree/main/backend/eval/results): `backend/eval/results`
- [Results Comparison](https://github.com/anilch963/research-intelligence-platform/blob/main/backend/eval/compare.py): `backend/eval/compare.py`

### Other components

- **Researcher**

## Connections

- Researcher → Research UI: asks questions (evidence: `frontend/src/App.jsx`)
- Research UI → API Client: calls (evidence: `frontend/src/App.jsx`)
- API Client → FastAPI API: sends query (evidence: `README.md`)
- FastAPI API → RAG Answering: answers with (evidence: `backend/app/main.py`)
- FastAPI API → Retriever Selection: checks chunks (evidence: `backend/app/main.py`)
- RAG Answering → Retriever Selection: retrieves context (evidence: `backend/app/rag.py`)
- Retriever Selection → BM25 Search: selects hybrid (evidence: `backend/app/retrievers.py`)
- Retriever Selection → Vector Search: selects mode (evidence: `backend/app/retrievers.py`)
- BM25 Search → Chroma Chunk Store: reads chunks (evidence: `backend/app/retrievers.py`)
- Vector Search → Chroma Chunk Store: searches vectors (evidence: `README.md`)
- Chroma Chunk Store → OpenAI Embeddings: embeds queries (evidence: `backend/app/retrievers.py`)
- RAG Answering → OpenAI Chat Model: generates answer (evidence: `backend/app/rag.py`)
- Document Ingestion → Source Documents: loads files (evidence: `backend/app/ingest.py`)
- Document Ingestion → Chroma Chunk Store: writes chunks (evidence: `backend/app/ingest.py`)
- Document Ingestion → Retriever Selection: resets caches (evidence: `backend/app/ingest.py`)
- Runtime Settings → Document Ingestion: configures (evidence: `backend/app/ingest.py`)
- Runtime Settings → Retriever Selection: configures (evidence: `backend/app/retrievers.py`)
- Runtime Settings → RAG Answering: configures (evidence: `backend/app/rag.py`)
- RAGAS Runner → Evaluation Testset: reads cases
- RAGAS Runner → RAG Answering: runs questions (evidence: `backend/eval/run_ragas.py`)
- RAGAS Runner → Retriever Selection: checks index (evidence: `backend/eval/run_ragas.py`)
- RAGAS Runner → Evaluation Results: writes report (evidence: `backend/eval/run_ragas.py`)
- Testset Drafter → Retriever Selection: loads chunks (evidence: `backend/eval/draft_testset.py`)
- Results Comparison → Evaluation Results: compares reports
