# andrewsselvaraj/neet_chat architecture

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

- Interactive diagram: https://gitdiagram.com/andrewsselvaraj/neet_chat
- Repository: https://github.com/andrewsselvaraj/neet_chat

## Overview

NEET Paper Coach accepts a student's question, retrieves relevant passages from locally indexed past-paper PDFs, asks an OpenAI-compatible chat model to explain them, and returns an answer with paper and page citations. The graph distinguishes PDF loading/search, answer generation, and the web interface. The README documents startup indexing and local retrieval; the excerpts show the principal calls. The template and PDF corpus are represented from the tree and README, not inspected source excerpts.

Main entry points: [`src/main/java/com/neetchat/chat/ChatService.java`](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/chat/ChatService.java) (Answer orchestration), [`src/main/java/com/neetchat/web/ChatController.java`](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/web/ChatController.java) (Chat controller), [`src/main/java/com/neetchat/search/QuestionPaperIndex.java`](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/search/QuestionPaperIndex.java) (PDF index and search), [`src/main/java/com/neetchat/chat/ChatAnswer.java`](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/chat/ChatAnswer.java) (Answer and citations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interaction"]
  node_controller["Chat controller"]
  node_template["Chat page<br/>[index.html]"]
end

subgraph group_retrieval["Paper retrieval"]
  node_papers["Past-paper PDFs"]
  node_index["PDF index and search"]
  node_passage["Paper passages<br/>[PaperPassage.java]"]
end

subgraph group_answering["Answer generation"]
  node_chatservice["Answer orchestration<br/>[ChatService.java]"]
  node_answer["Answer and citations<br/>[ChatAnswer.java]"]
  node_citation["Paper citation<br/>[PaperCitation.java]"]
end

subgraph group_integration["Model integration"]
  node_configuration["Model configuration"]
  node_model{{"Chat model API"}}
end

node_student(("Student"))

node_student -->|"submits question"| node_controller
node_controller -->|"requests answer"| node_chatservice
node_controller -->|"renders page"| node_template
node_papers -->|"indexes PDFs"| node_index
node_index -->|"creates passages"| node_passage
node_chatservice -->|"searches passages"| node_index
node_chatservice -->|"creates citations"| node_citation
node_chatservice -->|"sends prompt"| node_model
node_configuration -->|"configures client"| node_model
node_chatservice -->|"returns result"| node_answer
node_controller -->|"displays result"| node_answer

click node_controller "https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/web/ChatController.java"
click node_template "https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/resources/templates/index.html"
click node_papers "https://github.com/andrewsselvaraj/neet_chat/tree/main/Questions"
click node_index "https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/search/QuestionPaperIndex.java"
click node_passage "https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/search/PaperPassage.java"
click node_chatservice "https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/chat/ChatService.java"
click node_answer "https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/chat/ChatAnswer.java"
click node_citation "https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/chat/PaperCitation.java"
click node_configuration "https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/config/LanguageModelConfiguration.java"

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_controller,node_template toneBlue
class node_papers,node_index,node_passage toneAmber
class node_chatservice,node_answer,node_citation toneMint
class node_configuration,node_model toneRose
class node_student toneIndigo
```

## Components

### Web interaction

- [Chat controller](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/web/ChatController.java): `src/main/java/com/neetchat/web/ChatController.java`
- [Chat page](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/resources/templates/index.html): `src/main/resources/templates/index.html`

### Paper retrieval

- [Past-paper PDFs](https://github.com/andrewsselvaraj/neet_chat/tree/main/Questions): `Questions`
- [PDF index and search](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/search/QuestionPaperIndex.java): `src/main/java/com/neetchat/search/QuestionPaperIndex.java`
- [Paper passages](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/search/PaperPassage.java): `src/main/java/com/neetchat/search/PaperPassage.java`

### Answer generation

- [Answer orchestration](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/chat/ChatService.java): `src/main/java/com/neetchat/chat/ChatService.java`
- [Answer and citations](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/chat/ChatAnswer.java): `src/main/java/com/neetchat/chat/ChatAnswer.java`
- [Paper citation](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/chat/PaperCitation.java): `src/main/java/com/neetchat/chat/PaperCitation.java`

### Model integration

- [Model configuration](https://github.com/andrewsselvaraj/neet_chat/blob/main/src/main/java/com/neetchat/config/LanguageModelConfiguration.java): `src/main/java/com/neetchat/config/LanguageModelConfiguration.java`
- **Chat model API**

### Other components

- **Student**

## Connections

- Student → Chat controller: submits question (evidence: `src/main/java/com/neetchat/web/ChatController.java`)
- Chat controller → Answer orchestration: requests answer (evidence: `src/main/java/com/neetchat/web/ChatController.java`)
- Chat controller → Chat page: renders page (evidence: `src/main/java/com/neetchat/web/ChatController.java`)
- Past-paper PDFs → PDF index and search: indexes PDFs (evidence: `README.md`)
- PDF index and search → Paper passages: creates passages (evidence: `src/main/java/com/neetchat/search/QuestionPaperIndex.java`)
- Answer orchestration → PDF index and search: searches passages (evidence: `src/main/java/com/neetchat/chat/ChatService.java`)
- Answer orchestration → Paper citation: creates citations (evidence: `src/main/java/com/neetchat/chat/ChatService.java`)
- Answer orchestration → Chat model API: sends prompt (evidence: `src/main/java/com/neetchat/chat/ChatService.java`)
- Model configuration → Chat model API: configures client (evidence: `src/main/java/com/neetchat/config/LanguageModelConfiguration.java`)
- Answer orchestration → Answer and citations: returns result (evidence: `src/main/java/com/neetchat/chat/ChatService.java`)
- Chat controller → Answer and citations: displays result (evidence: `src/main/java/com/neetchat/web/ChatController.java`)
