# bipinmaurya146/campus_assistant_bot architecture

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

- Interactive diagram: https://gitdiagram.com/bipinmaurya146/campus_assistant_bot
- Repository: https://github.com/bipinmaurya146/campus_assistant_bot

## Overview

This is a Streamlit university student-support chatbot. A student submits a question through the chat UI; the classifier embeds it, checks intent confidence against saved prototypes, searches dataset questions within the predicted intent, and returns the matching stored response or a fallback. The UI also displays classifier metadata in a debug panel. The README documents startup embedding caching and dataset grounding; source shows resource loading and caching, though its question-similarity threshold is 0.60, not the README’s 0.80.

Main entry points: [`backend/app/classifier.py`](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py) (Classifier), [`streamlit_app.py`](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/streamlit_app.py) (Chat UI), [`data/AI-Powered Chatbot.xlsx - Chatbot_Student_Support.csv`](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/data/AI-Powered%20Chatbot.xlsx%20-%20Chatbot_Student_Support.csv) (Support Dataset), [`model/intent_prototypes.pkl`](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/model/intent_prototypes.pkl) (Intent Prototypes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Chat Interface"]
  node_chat_ui["Chat UI<br/>[streamlit_app.py]"]
  node_debug_panel["Debug Panel<br/>[streamlit_app.py]"]
end

subgraph group_classification["Question Classification"]
  node_classifier["Classifier<br/>[classifier.py]"]
  node_resource_cache["Resource Cache<br/>[streamlit_app.py]"]
  node_question_embedding["Question Embedding<br/>[classifier.py]"]
  node_sentence_transformer["SentenceTransformer"]
  node_intent_matching["Intent Matching<br/>[classifier.py]"]
  node_intent_gate["Intent Threshold<br/>[classifier.py]"]
end

subgraph group_knowledge["Grounded Knowledge"]
  node_question_search["Question Search<br/>[classifier.py]"]
  node_answer_gate["Similarity Threshold<br/>[classifier.py]"]
  node_response_retrieval["Response Retrieval<br/>[classifier.py]"]
  node_prototypes["Intent Prototypes"]
  node_support_dataset[("Support Dataset")]
end

node_student(("Student"))

node_student -->|"asks question"| node_chat_ui
node_chat_ui -->|"loads classifier"| node_resource_cache
node_resource_cache -->|"loads resources"| node_classifier
node_chat_ui -->|"submits question"| node_classifier
node_classifier -->|"encodes question"| node_question_embedding
node_question_embedding -->|"encodes text"| node_sentence_transformer
node_classifier -->|"loads prototypes"| node_prototypes
node_classifier -->|"loads dataset"| node_support_dataset
node_intent_matching -->|"compares vectors"| node_prototypes
node_classifier -->|"scores intents"| node_intent_matching
node_intent_matching -->|"checks confidence"| node_intent_gate
node_classifier -->|"searches intent rows"| node_question_search
node_question_search -->|"reads questions"| node_support_dataset
node_question_search -->|"checks similarity"| node_answer_gate
node_classifier -->|"selects response"| node_response_retrieval
node_response_retrieval -->|"retrieves exact answer"| node_support_dataset
node_classifier -->|"returns result"| node_chat_ui
node_chat_ui -->|"shows metadata"| node_debug_panel

click node_chat_ui "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/streamlit_app.py"
click node_debug_panel "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/streamlit_app.py"
click node_classifier "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py"
click node_resource_cache "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/streamlit_app.py"
click node_question_embedding "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py"
click node_intent_matching "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py"
click node_intent_gate "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py"
click node_question_search "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py"
click node_answer_gate "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py"
click node_response_retrieval "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py"
click node_prototypes "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/model/intent_prototypes.pkl"
click node_support_dataset "https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/data/AI-Powered%20Chatbot.xlsx%20-%20Chatbot_Student_Support.csv"

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_chat_ui,node_debug_panel toneBlue
class node_classifier,node_resource_cache,node_question_embedding,node_sentence_transformer,node_intent_matching,node_intent_gate toneAmber
class node_question_search,node_answer_gate,node_response_retrieval,node_prototypes,node_support_dataset toneMint
class node_student toneIndigo
```

## Components

### Chat Interface

- [Chat UI](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/streamlit_app.py): `streamlit_app.py`
- [Debug Panel](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/streamlit_app.py): `streamlit_app.py`

### Question Classification

- [Classifier](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py): `backend/app/classifier.py`
- [Resource Cache](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/streamlit_app.py): `streamlit_app.py`
- [Question Embedding](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py): `backend/app/classifier.py`
- **SentenceTransformer**
- [Intent Matching](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py): `backend/app/classifier.py`
- [Intent Threshold](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py): `backend/app/classifier.py`

### Grounded Knowledge

- [Question Search](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py): `backend/app/classifier.py`
- [Similarity Threshold](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py): `backend/app/classifier.py`
- [Response Retrieval](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/backend/app/classifier.py): `backend/app/classifier.py`
- [Intent Prototypes](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/model/intent_prototypes.pkl): `model/intent_prototypes.pkl`
- [Support Dataset](https://github.com/bipinmaurya146/campus_assistant_bot/blob/main/data/AI-Powered%20Chatbot.xlsx%20-%20Chatbot_Student_Support.csv): `data/AI-Powered Chatbot.xlsx - Chatbot_Student_Support.csv`

### Other components

- **Student**

## Connections

- Student → Chat UI: asks question (evidence: `streamlit_app.py`)
- Chat UI → Resource Cache: loads classifier (evidence: `streamlit_app.py`)
- Resource Cache → Classifier: loads resources (evidence: `streamlit_app.py`)
- Chat UI → Classifier: submits question (evidence: `streamlit_app.py`)
- Classifier → Question Embedding: encodes question (evidence: `backend/app/classifier.py`)
- Question Embedding → SentenceTransformer: encodes text (evidence: `backend/app/classifier.py`)
- Classifier → Intent Prototypes: loads prototypes (evidence: `backend/app/classifier.py`)
- Classifier → Support Dataset: loads dataset (evidence: `backend/app/classifier.py`)
- Intent Matching → Intent Prototypes: compares vectors (evidence: `backend/app/classifier.py`)
- Classifier → Intent Matching: scores intents (evidence: `backend/app/classifier.py`)
- Intent Matching → Intent Threshold: checks confidence (evidence: `backend/app/classifier.py`)
- Classifier → Question Search: searches intent rows (evidence: `backend/app/classifier.py`)
- Question Search → Support Dataset: reads questions (evidence: `backend/app/classifier.py`)
- Question Search → Similarity Threshold: checks similarity (evidence: `backend/app/classifier.py`)
- Classifier → Response Retrieval: selects response (evidence: `backend/app/classifier.py`)
- Response Retrieval → Support Dataset: retrieves exact answer (evidence: `backend/app/classifier.py`)
- Classifier → Chat UI: returns result (evidence: `streamlit_app.py`)
- Chat UI → Debug Panel: shows metadata (evidence: `streamlit_app.py`)
