# shreya1111/university-query-system architecture

> Architecture diagram of the GitHub repository shreya1111/university-query-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shreya1111/university-query-system
- Repository: https://github.com/shreya1111/university-query-system

## Overview

1. **Overall shape**
UniQuery is a single Python/Streamlit application organized as a feature-based monolith. `app.py` is the entrypoint, and `pages/` contains the main user-facing screens for student, faculty, and admin workflows.

2. **Presentation layer**
The UI is split into reusable building blocks in `components/` and shared look-and-feel in `styles/`. This layer assembles page headers, sidebar navigation, metric cards, ticket cards, notification cards, and other dashboard widgets used across the Streamlit pages.

3. **Page routing and user workflows**
`pages/` maps directly to the product workflows: login/registration, ticket creation and tracking, AI chatbot, knowledge base search, notifications, dashboards, analytics, and admin/faculty panels. These pages are the main orchestration layer that calls into feature modules rather than embedding business logic directly.

4. **Core application services**
`core/` holds shared infrastructure concerns such as configuration and database access. This is the boundary between UI/feature code and persistent storage, and is likely where environment settings and SQLite connections are centralized.

5. **Authentication subsystem**
`features/auth/` provides login, registration, password handling, OTP/email support, session management, and the repository/service abstraction for user data. This subsystem is responsible for identity and access flow before a user can enter the role-specific pages.

6. **Ticket management subsystem**
`features/ticket_management/` contains the ticket domain model, persistence layer, and service layer. It is the main transactional workflow: students create tickets, faculty update status and assignment, and admins monitor ticket lifecycle and throughput.

7. **AI assistance subsystem**
`features/ai/` is a separate intelligence layer for query handling. It includes intent classification, priority prediction, sentiment analysis, department routing, auto-reply generation, summarization, and a chatbot wrapper. These models are backed by serialized artifacts in `models/` and training data in `data/training/`.

8. **RAG / knowledge base subsystem**
`features/ai/rag/` implements retrieval-augmented generation over university policy documents in `data/rag/`. Documents are loaded, chunked, embedded, stored in ChromaDB under `vectorstore/`, and retrieved to answer student questions from the knowledge base pages and chatbot flow. This is the main document-grounded answer path.

9. **Analytics and reporting subsystem**
`features/analytics/` computes operational metrics such as department performance, ticket resolution, satisfaction, sentiment, and notification analytics. `features/reports/` and `features/analytics/reports/` generate downloadable outputs, with existing report artifacts stored in `reports/` as text exports and CSV/PDF support in code.

10. **Notifications and communication**
`features/notifications/` and `features/analytics/notifications/` manage notification creation, storage, and delivery logic. This is the feedback loop that informs students and staff about ticket changes, automated responses, and system updates.

11. **Persistent data stores**
The application uses SQLite as the primary structured store in `database/university.db` with schema defined in `database/schema.sql`. Separate from that, the RAG subsystem persists embeddings in ChromaDB under `vectorstore/chroma_db`, and model artifacts are stored locally in `models/`.

12. **Data preparation and machine learning assets**
`data/generate_datasets.py` and the CSVs in `data/training/` support model training for intent, priority, sentiment, and department routing. `train_models.py` appears to build the serialized classifiers used at runtime, making training an offline pipeline distinct from the Streamlit runtime.

13. **Infrastructure and deployment boundaries**
`.devcontainer/`, `requirements.txt`, and `runtime.txt` indicate a containerized Python deployment path, likely for consistent local development and hosting. The system is otherwise self-contained, with optional external LLM providers noted in the README (SambaNova, Gemini) as pluggable dependencies rather than core infrastructure.

Main entry points: [`pages`](https://github.com/shreya1111/university-query-system/tree/main/pages) (Pages), [`core`](https://github.com/shreya1111/university-query-system/tree/main/core) (Core), [`features/ai/service.py`](https://github.com/shreya1111/university-query-system/blob/main/features/ai/service.py) (AI Service), [`features/ai/rag`](https://github.com/shreya1111/university-query-system/tree/main/features/ai/rag) (RAG)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_app["App<br/>entrypoint<br/>[app.py]"]
  node_pages["Pages"]
  node_components["Components<br/>ui widgets"]
  node_styles["Styles<br/>theme assets"]
end

subgraph group_domain["Domain services"]
  node_core["Core<br/>infrastructure"]
  node_auth["Auth<br/>identity service"]
  node_tickets["Tickets<br/>ticket workflow"]
  node_ai_service["AI Service<br/>classification and reply<br/>[service.py]"]
  node_chatbot["Chatbot<br/>chat interface<br/>[chatbot.py]"]
  node_rag["RAG<br/>knowledge retrieval"]
  node_analytics["Analytics<br/>metrics engine"]
  node_reports["Reports<br/>export service"]
  node_notifications["Notifications<br/>delivery service"]
end

subgraph group_storage["Data and models"]
  node_db[("SQLite DB<br/>primary store<br/>[university.db]")]
  node_schema["Schema<br/>[schema.sql]"]
  node_rag_docs["RAG Docs<br/>policy corpus"]
  node_training_data["Training Data<br/>csv datasets"]
  node_models[("Models<br/>serialized artifacts")]
  node_vectorstore[("Vector Store<br/>chroma index")]
  node_reports_store["Report Files<br/>generated outputs"]
  node_training_pipeline["Training<br/>offline pipeline<br/>[train_models.py]"]
end

node_app -->|"routes to"| node_pages
node_app -->|"assembles"| node_components
node_app -->|"loads"| node_styles
node_pages -->|"uses"| node_auth
node_pages -->|"orchestrates"| node_tickets
node_pages -->|"invokes"| node_ai_service
node_pages -->|"answers with"| node_rag
node_pages -->|"shows"| node_analytics
node_pages -->|"exports"| node_reports
node_pages -->|"displays"| node_notifications
node_auth -->|"depends on"| node_core
node_tickets -->|"depends on"| node_core
node_ai_service -->|"wraps"| node_chatbot
node_ai_service -->|"routes to"| node_rag
node_ai_service -->|"loads"| node_models
node_rag -->|"indexes"| node_rag_docs
node_rag -->|"stores embeddings"| node_vectorstore
node_analytics -->|"analyzes"| node_tickets
node_analytics -->|"measures"| node_notifications
node_reports -->|"summarizes"| node_analytics
node_notifications -->|"depends on"| node_core
node_training_pipeline -->|"builds from"| node_training_data
node_training_pipeline -->|"produces"| node_models
node_core -->|"connects to"| node_db
node_core -->|"uses"| node_schema
node_reports -->|"writes"| node_reports_store

click node_app "https://github.com/shreya1111/university-query-system/blob/main/app.py"
click node_pages "https://github.com/shreya1111/university-query-system/tree/main/pages"
click node_components "https://github.com/shreya1111/university-query-system/tree/main/components"
click node_styles "https://github.com/shreya1111/university-query-system/tree/main/styles"
click node_core "https://github.com/shreya1111/university-query-system/tree/main/core"
click node_auth "https://github.com/shreya1111/university-query-system/tree/main/features/auth"
click node_tickets "https://github.com/shreya1111/university-query-system/tree/main/features/ticket_management"
click node_ai_service "https://github.com/shreya1111/university-query-system/blob/main/features/ai/service.py"
click node_chatbot "https://github.com/shreya1111/university-query-system/blob/main/features/ai/chatbot/chatbot.py"
click node_rag "https://github.com/shreya1111/university-query-system/tree/main/features/ai/rag"
click node_analytics "https://github.com/shreya1111/university-query-system/tree/main/features/analytics"
click node_reports "https://github.com/shreya1111/university-query-system/tree/main/features/reports"
click node_notifications "https://github.com/shreya1111/university-query-system/tree/main/features/notifications"
click node_db "https://github.com/shreya1111/university-query-system/blob/main/database/university.db"
click node_schema "https://github.com/shreya1111/university-query-system/blob/main/database/schema.sql"
click node_rag_docs "https://github.com/shreya1111/university-query-system/tree/main/data/rag"
click node_training_data "https://github.com/shreya1111/university-query-system/tree/main/data/training"
click node_models "https://github.com/shreya1111/university-query-system/tree/main/models"
click node_vectorstore "https://github.com/shreya1111/university-query-system/tree/main/vectorstore/chroma_db"
click node_reports_store "https://github.com/shreya1111/university-query-system/tree/main/reports"
click node_training_pipeline "https://github.com/shreya1111/university-query-system/blob/main/train_models.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,node_pages,node_components,node_styles toneBlue
class node_core,node_auth,node_tickets,node_ai_service,node_chatbot,node_rag,node_analytics,node_reports,node_notifications toneAmber
class node_db,node_schema,node_rag_docs,node_training_data,node_models,node_vectorstore,node_reports_store,node_training_pipeline toneMint
```

## Components

### Presentation

Streamlit entrypoint, pages, and shared UI building blocks.

- [App](https://github.com/shreya1111/university-query-system/blob/main/app.py): entrypoint · Streamlit application entrypoint. · `app.py`
- [Pages](https://github.com/shreya1111/university-query-system/tree/main/pages): streamlit pages · User-facing workflows and role-specific screens. · `pages`
- [Components](https://github.com/shreya1111/university-query-system/tree/main/components): ui widgets · Reusable page elements and dashboard cards. · `components`
- [Styles](https://github.com/shreya1111/university-query-system/tree/main/styles): theme assets · Shared CSS and theme definitions. · `styles`

### Domain services

Feature subsystems for authentication, tickets, AI, analytics, and notifications.

- [Core](https://github.com/shreya1111/university-query-system/tree/main/core): infrastructure · Shared configuration and database access boundary. · `core`
- [Auth](https://github.com/shreya1111/university-query-system/tree/main/features/auth): identity service · Login, registration, sessions, OTP, and password handling. · `features/auth`
- [Tickets](https://github.com/shreya1111/university-query-system/tree/main/features/ticket_management): ticket workflow · Ticket domain model, repository, and service layer. · `features/ticket_management`
- [AI Service](https://github.com/shreya1111/university-query-system/blob/main/features/ai/service.py): classification and reply · Main AI orchestration for intent, routing, sentiment, and summaries. · `features/ai/service.py`
- [Chatbot](https://github.com/shreya1111/university-query-system/blob/main/features/ai/chatbot/chatbot.py): chat interface · Chatbot wrapper used by the AI page flow. · `features/ai/chatbot/chatbot.py`
- [RAG](https://github.com/shreya1111/university-query-system/tree/main/features/ai/rag): knowledge retrieval · Retrieval-augmented generation pipeline over policy documents. · `features/ai/rag`
- [Analytics](https://github.com/shreya1111/university-query-system/tree/main/features/analytics): metrics engine · Operational metrics for tickets, satisfaction, sentiment, and departments. · `features/analytics`
- [Reports](https://github.com/shreya1111/university-query-system/tree/main/features/reports): export service · Report generation and export layer. · `features/reports`
- [Notifications](https://github.com/shreya1111/university-query-system/tree/main/features/notifications): delivery service · Notification storage and delivery logic. · `features/notifications`

### Data and models

Persistent stores, training data, and serialized artifacts.

- [SQLite DB](https://github.com/shreya1111/university-query-system/blob/main/database/university.db): primary store · Structured application database. · `database/university.db`
- [Schema](https://github.com/shreya1111/university-query-system/blob/main/database/schema.sql): sql schema · Database schema definition. · `database/schema.sql`
- [RAG Docs](https://github.com/shreya1111/university-query-system/tree/main/data/rag): policy corpus · Source PDFs for the knowledge base and RAG pipeline. · `data/rag`
- [Training Data](https://github.com/shreya1111/university-query-system/tree/main/data/training): csv datasets · Labeled datasets used to train runtime classifiers. · `data/training`
- [Models](https://github.com/shreya1111/university-query-system/tree/main/models): serialized artifacts · Saved intent, priority, and sentiment model artifacts. · `models`
- [Vector Store](https://github.com/shreya1111/university-query-system/tree/main/vectorstore/chroma_db): chroma index · Persisted embeddings and retrieval index. · `vectorstore/chroma_db`
- [Report Files](https://github.com/shreya1111/university-query-system/tree/main/reports): generated outputs · Generated text report artifacts. · `reports`
- [Training](https://github.com/shreya1111/university-query-system/blob/main/train_models.py): offline pipeline · Dataset generation and model training workflow. · `train_models.py`

## Connections

- App → Pages: routes to · Main UI navigation is organized through Streamlit pages.
- App → Components: assembles · Entry page uses reusable UI widgets.
- App → Styles: loads · Global styling is applied at startup.
- Pages → Auth: uses · Login, registration, and password flows delegate to auth services.
- Pages → Tickets: orchestrates · Ticket pages create, track, and update tickets.
- Pages → AI Service: invokes · AI and routing features are exposed in the chatbot and knowledge base pages.
- Pages → RAG: answers with · Knowledge base pages query the retrieval pipeline.
- Pages → Analytics: shows · Analytics dashboard pages render operational metrics.
- Pages → Reports: exports · Reports page generates downloadable outputs.
- Pages → Notifications: displays · Notifications page surfaces delivery and status updates.
- Auth → Core: depends on · Authentication relies on shared config and database access.
- Tickets → Core: depends on · Ticket workflow uses shared persistence infrastructure.
- AI Service → Chatbot: wraps · Top-level AI service includes chatbot interaction.
- AI Service → RAG: routes to · Document-grounded answers use retrieval when needed.
- AI Service → Models: loads · Runtime inference uses serialized classifiers.
- RAG → RAG Docs: indexes · Policy PDFs are ingested as source documents.
- RAG → Vector Store: stores embeddings · Chunks and embeddings are persisted for retrieval.
- Analytics → Tickets: analyzes · Operational metrics are derived from ticket data.
- Analytics → Notifications: measures · Notification analytics are computed from delivery data.
- Reports → Analytics: summarizes · Reports package analytics outputs for export.
- Notifications → Core: depends on · Notification persistence uses shared infrastructure.
- Training → Training Data: builds from · Model training consumes labeled CSV datasets.
- Training → Models: produces · Offline training writes serialized model artifacts.
- Core → SQLite DB: connects to · Database access is centralized in core infrastructure.
- Core → Schema: uses · Schema definition describes the structured store.
- Reports → Report Files: writes · Generated reports are stored as files.
