# vishalla/6th-sem-project architecture

> Architecture diagram of the GitHub repository vishalla/6th-sem-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vishalla/6th-sem-project
- Repository: https://github.com/vishalla/6th-sem-project

## Overview

#### Purpose and Entrypoints
This is a full-stack analytics/chatbot system: a Python backend exposes authentication, user, and chatbot APIs; a Vue frontend provides chat, graph, metrics, transaction, summary, and file-upload views. Backend startup is centered on `backend/main.py` (with `backend/start.sh`); frontend bootstraps from `frontend/src/main.js` into `frontend/src/App.vue`.

#### API and Application Boundary
HTTP routes are organized by domain and delegated into services rather than directly coupling UI to chatbot or persistence logic:
- Route aggregation and API surface: `backend/api/routes.py`, `backend/api/chatbot_route.py`
- Authentication/user endpoints: `backend/api/auth.py`, `backend/api/user.py`
- Service orchestration: `backend/service/chatbot_service.py`, `backend/service/user_service.py`

The frontend calls this boundary through `frontend/src/services/api.js`; router-selected screens live in `frontend/src/router/index.js`.

#### Identity, Security, and Persistence
Authentication concerns are separated into API handlers, dependency injection, and security primitives:
- `backend/auth/auth.py`
- `backend/auth/deps.py`
- `backend/core/security.py`

Database infrastructure is centralized in `backend/database/session.py`, with ORM/base definitions in `backend/database/base.py` and persisted models in `backend/database/model.py`. API/schema contracts are represented under `backend/schema/user.py` and `backend/schema/chatbout.py`.

#### Chatbot Query-to-Answer Pipeline
The chatbot is a staged natural-language processing pipeline, coordinated by `backend/chatbot/main_chatbot.py`. It analyzes and normalizes a question, derives domain intent/keywords, retrieves or executes relevant data, then constructs an answer or fallback:
- Query analysis: `backend/chatbot/query_analysis.py`, `backend/chatbot/enhanced_query_analyzer.py`
- Text/domain processing: `backend/chatbot/text_processor.py`, `backend/chatbot/domain_vocabulary.py`
- Retrieval/execution and response: `backend/chatbot/vector_retriever.py`, `backend/chatbot/data_executor.py`, `backend/chatbot/answer_construction.py`
- Conversation state and degraded handling: `backend/chatbot/conversation_memory_manager.py`, `backend/chatbot/fallback.py`

#### Ingestion and Vector Retrieval
Uploaded or downloaded source material enters a service-layer pipeline, likely producing embeddings/vector indexes used by chatbot retrieval:
- Ingestion/pipeline coordination: `backend/service/ingestion.py`, `backend/service/run_pipeline.py`
- Vector database creation and similarity calculation: `backend/service/embeddings/create_vector_db.py`, `backend/service/embeddings/fiass_calculate.py`
- File/download-facing contracts and service: `backend/schema/files.py`, `backend/service/download.py`

This is the key boundary between raw external data and queryable semantic context.

#### Graph Analytics
A distinct graph subsystem builds and validates graph structures, then runs algorithms through an execution engine:
- `backend/graphs/build_graph.py`
- `backend/graphs/validation.py`
- `backend/graphs/engine.py`

Its algorithm intent is documented in `backend/graphs/graph_algo.md`. The frontend renders graph-oriented results via `frontend/src/components/GraphView.vue` and `frontend/src/views/GraphView.vue`.

#### Frontend State and Presentation
The Vue/Vite client is organized around route-level analytical views and shared state:
- Authentication/session state: `frontend/src/stores/auth.js`, `frontend/src/views/AuthView.vue`
- Result state: `frontend/src/stores/results.js`
- Chat interaction: `frontend/src/views/ChatView.vue`, `frontend/src/components/ChatSidebar.vue`
- Data intake and analytical displays: `frontend/src/components/FileUpload.vue`, `frontend/src/views/MetricsView.vue`, `frontend/src/views/SummaryView.vue`

Material runtimes are Python backend dependencies (`backend/requirements.txt`) and a Node/Vue/Vite frontend (`frontend/package.json`, `frontend/vite.config.js`). No specific third-party database, model provider, or hosted vector service is identifiable from the supplied tree.

Main entry points: [`backend/service/chatbot_service.py`](https://github.com/vishalla/6th-sem-project/blob/main/backend/service/chatbot_service.py) (Application services), [`frontend/src/views/ChatView.vue`](https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/views/ChatView.vue) (Chat and analytics views), [`backend/api/routes.py`](https://github.com/vishalla/6th-sem-project/blob/main/backend/api/routes.py) (Route layer), [`backend/api/auth.py`](https://github.com/vishalla/6th-sem-project/blob/main/backend/api/auth.py) (Auth and user API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Vue Client"]
  node_vue_bootstrap["Vue bootstrap<br/>Vue entrypoint<br/>[main.js]"]
  node_app_router["App and router<br/>Vue navigation<br/>[App.vue]"]
  node_api_client["API client<br/>frontend service<br/>[api.js]"]
  node_frontend_state["Session and results state<br/>Vue stores<br/>[auth.js]"]
  node_analytics_views["Chat and analytics views<br/>Vue views<br/>[ChatView.vue]"]
end

subgraph group_api["Backend API"]
  node_route_layer["Route layer<br/>FastAPI routes<br/>[routes.py]"]
  node_auth_user_api["Auth and user API<br/>API handlers<br/>[auth.py]"]
  node_chatbot_api["Chatbot API<br/>API handler<br/>[chatbot_route.py]"]
  node_identity_security["Identity and security<br/>auth dependencies<br/>[deps.py]"]
  node_app_services["Application services<br/>service orchestration<br/>[chatbot_service.py]"]
  node_database[("ORM persistence<br/>database infrastructure<br/>[session.py]")]
end

subgraph group_chatbot["Chatbot Pipeline"]
  node_chatbot_orchestrator["Chatbot coordinator<br/>query pipeline<br/>[main_chatbot.py]"]
  node_query_understanding["Query understanding<br/>NLP analysis<br/>[query_analysis.py]"]
  node_semantic_retrieval["Semantic retrieval<br/>vector retrieval"]
  node_answer_handling["Answer and fallback<br/>response construction"]
end

subgraph group_data["Data &amp; Analytics"]
  node_ingestion_pipeline["Ingestion pipeline<br/>data pipeline<br/>[ingestion.py]"]
  node_vector_index["Vector index creation<br/>embeddings pipeline"]
  node_graph_engine{{"Graph analytics engine<br/>graph execution<br/>[engine.py]"}}
end

node_vue_bootstrap -->|"mounts"| node_app_router
node_app_router -->|"selects"| node_analytics_views
node_analytics_views -->|"reads and updates"| node_frontend_state
node_analytics_views -->|"requests data"| node_api_client
node_api_client -->|"HTTP"| node_route_layer
node_route_layer -->|"auth/user routes"| node_auth_user_api
node_route_layer -->|"chat routes"| node_chatbot_api
node_auth_user_api -->|"authenticates"| node_identity_security
node_auth_user_api -->|"delegates"| node_app_services
node_chatbot_api -->|"delegates"| node_app_services
node_app_services -->|"persists users and data"| node_database
node_app_services -->|"runs queries"| node_chatbot_orchestrator
node_chatbot_orchestrator -->|"analyzes question"| node_query_understanding
node_query_understanding -->|"supplies intent"| node_semantic_retrieval
node_semantic_retrieval -->|"returns context"| node_answer_handling
node_answer_handling -->|"produces answer"| node_chatbot_orchestrator
node_ingestion_pipeline -->|"creates embeddings"| node_vector_index
node_vector_index -->|"queryable context"| node_semantic_retrieval
node_ingestion_pipeline -->|"stores processed data"| node_database
node_app_services -->|"runs graph analysis"| node_graph_engine
node_graph_engine -.->|"graph results"| node_analytics_views

click node_vue_bootstrap "https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/main.js"
click node_app_router "https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/App.vue"
click node_api_client "https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/services/api.js"
click node_frontend_state "https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/stores/auth.js"
click node_analytics_views "https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/views/ChatView.vue"
click node_route_layer "https://github.com/vishalla/6th-sem-project/blob/main/backend/api/routes.py"
click node_auth_user_api "https://github.com/vishalla/6th-sem-project/blob/main/backend/api/auth.py"
click node_chatbot_api "https://github.com/vishalla/6th-sem-project/blob/main/backend/api/chatbot_route.py"
click node_identity_security "https://github.com/vishalla/6th-sem-project/blob/main/backend/auth/deps.py"
click node_app_services "https://github.com/vishalla/6th-sem-project/blob/main/backend/service/chatbot_service.py"
click node_database "https://github.com/vishalla/6th-sem-project/blob/main/backend/database/session.py"
click node_chatbot_orchestrator "https://github.com/vishalla/6th-sem-project/blob/main/backend/chatbot/main_chatbot.py"
click node_query_understanding "https://github.com/vishalla/6th-sem-project/blob/main/backend/chatbot/query_analysis.py"
click node_semantic_retrieval "https://github.com/vishalla/6th-sem-project/blob/main/backend/chatbot/vector_retriever.py"
click node_answer_handling "https://github.com/vishalla/6th-sem-project/blob/main/backend/chatbot/answer_construction.py"
click node_ingestion_pipeline "https://github.com/vishalla/6th-sem-project/blob/main/backend/service/ingestion.py"
click node_vector_index "https://github.com/vishalla/6th-sem-project/blob/main/backend/service/embeddings/create_vector_db.py"
click node_graph_engine "https://github.com/vishalla/6th-sem-project/blob/main/backend/graphs/engine.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_vue_bootstrap,node_app_router,node_api_client,node_frontend_state,node_analytics_views toneBlue
class node_route_layer,node_auth_user_api,node_chatbot_api,node_identity_security,node_app_services,node_database toneAmber
class node_chatbot_orchestrator,node_query_understanding,node_semantic_retrieval,node_answer_handling toneMint
class node_ingestion_pipeline,node_vector_index,node_graph_engine toneRose
```

## Components

### Vue Client

- [Vue bootstrap](https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/main.js): Vue entrypoint · `frontend/src/main.js`
- [App and router](https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/App.vue): Vue navigation · Selects route-level application screens. · `frontend/src/App.vue`
- [API client](https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/services/api.js): frontend service · `frontend/src/services/api.js`
- [Session and results state](https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/stores/auth.js): Vue stores · `frontend/src/stores/auth.js`
- [Chat and analytics views](https://github.com/vishalla/6th-sem-project/blob/main/frontend/src/views/ChatView.vue): Vue views · Includes chat, metrics, summary, graph, and file-upload interfaces. · `frontend/src/views/ChatView.vue`

### Backend API

- [Route layer](https://github.com/vishalla/6th-sem-project/blob/main/backend/api/routes.py): FastAPI routes · Aggregates domain HTTP endpoints. · `backend/api/routes.py`
- [Auth and user API](https://github.com/vishalla/6th-sem-project/blob/main/backend/api/auth.py): API handlers · `backend/api/auth.py`
- [Chatbot API](https://github.com/vishalla/6th-sem-project/blob/main/backend/api/chatbot_route.py): API handler · `backend/api/chatbot_route.py`
- [Identity and security](https://github.com/vishalla/6th-sem-project/blob/main/backend/auth/deps.py): auth dependencies · Provides authentication dependencies and security primitives. · `backend/auth/deps.py`
- [Application services](https://github.com/vishalla/6th-sem-project/blob/main/backend/service/chatbot_service.py): service orchestration · Coordinates chatbot and user use cases. · `backend/service/chatbot_service.py`
- [ORM persistence](https://github.com/vishalla/6th-sem-project/blob/main/backend/database/session.py): database infrastructure · Central session, base, and persisted models. · `backend/database/session.py`

### Chatbot Pipeline

- [Chatbot coordinator](https://github.com/vishalla/6th-sem-project/blob/main/backend/chatbot/main_chatbot.py): query pipeline · Coordinates query-to-answer processing. · `backend/chatbot/main_chatbot.py`
- [Query understanding](https://github.com/vishalla/6th-sem-project/blob/main/backend/chatbot/query_analysis.py): NLP analysis · Analyzes, normalizes, and derives domain intent. · `backend/chatbot/query_analysis.py`
- [Semantic retrieval](https://github.com/vishalla/6th-sem-project/blob/main/backend/chatbot/vector_retriever.py): vector retrieval · `backend/chatbot/vector_retriever.py`
- [Answer and fallback](https://github.com/vishalla/6th-sem-project/blob/main/backend/chatbot/answer_construction.py): response construction · Builds responses and handles degraded cases. · `backend/chatbot/answer_construction.py`

### Data & Analytics

- [Ingestion pipeline](https://github.com/vishalla/6th-sem-project/blob/main/backend/service/ingestion.py): data pipeline · Coordinates uploaded or downloaded source processing. · `backend/service/ingestion.py`
- [Vector index creation](https://github.com/vishalla/6th-sem-project/blob/main/backend/service/embeddings/create_vector_db.py): embeddings pipeline · Creates vector data used for semantic retrieval. · `backend/service/embeddings/create_vector_db.py`
- [Graph analytics engine](https://github.com/vishalla/6th-sem-project/blob/main/backend/graphs/engine.py): graph execution · Builds, validates, and executes graph algorithms. · `backend/graphs/engine.py`

## Connections

- Vue bootstrap → App and router: mounts
- App and router → Chat and analytics views: selects
- Chat and analytics views → Session and results state: reads and updates
- Chat and analytics views → API client: requests data
- API client → Route layer: HTTP
- Route layer → Auth and user API: auth/user routes
- Route layer → Chatbot API: chat routes
- Auth and user API → Identity and security: authenticates
- Auth and user API → Application services: delegates
- Chatbot API → Application services: delegates
- Application services → ORM persistence: persists users and data
- Application services → Chatbot coordinator: runs queries
- Chatbot coordinator → Query understanding: analyzes question
- Query understanding → Semantic retrieval: supplies intent
- Semantic retrieval → Answer and fallback: returns context
- Answer and fallback → Chatbot coordinator: produces answer
- Ingestion pipeline → Vector index creation: creates embeddings
- Vector index creation → Semantic retrieval: queryable context
- Ingestion pipeline → ORM persistence: stores processed data
- Application services → Graph analytics engine: runs graph analysis
- Graph analytics engine → Chat and analytics views: graph results
