# a-dinesh-kumar/semantic-similarity-search-system architecture

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

- Interactive diagram: https://gitdiagram.com/a-dinesh-kumar/semantic-similarity-search-system
- Repository: https://github.com/a-dinesh-kumar/semantic-similarity-search-system

## Overview

This is a FastAPI semantic-search application with a browser interface. Users enter a query, choose an embedding model and optional category, and receive ranked knowledge-base documents with similarity scores and token-status details; a compare view runs the query across all models. The API loads the knowledge base and embedding models, while search code vectorizes documents and queries, preprocesses query text, filters categories, and ranks by cosine similarity. The tree does not include the processed CSV or model artifacts referenced by the server. The upload UI endpoint is not implemented in the shown API excerpt.

Main entry points: [`app/main.py`](https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/main.py) (HTTP API), [`static/js/app.js`](https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/static/js/app.js) (Search interface), [`app/search.py`](https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/search.py) (Semantic search), [`app/data_loader.py`](https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/data_loader.py) (Knowledge-base loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Browser interface"]
  node_browser["Search interface<br/>[app.js]"]
end

subgraph group_service["API service"]
  node_api["HTTP API<br/>[main.py]"]
  node_models["Embedding models<br/>[main.py]"]
  node_loader["Knowledge-base loader<br/>[data_loader.py]"]
end

subgraph group_search["Search and language"]
  node_search_engine["Semantic search<br/>[search.py]"]
  node_preprocessing["Query preprocessing<br/>[preprocessing.py]"]
end

node_user(("Search user"))

node_user -->|"enters query"| node_browser
node_browser -->|"requests stats and search"| node_api
node_api -->|"loads knowledge base"| node_loader
node_api -->|"vectors and ranks"| node_search_engine
node_search_engine -->|"preprocesses query"| node_preprocessing

click node_browser "https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/static/js/app.js"
click node_api "https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/main.py"
click node_models "https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/main.py"
click node_loader "https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/data_loader.py"
click node_search_engine "https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/search.py"
click node_preprocessing "https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/preprocessing.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_browser,node_user toneBlue
class node_api,node_models,node_loader toneAmber
class node_search_engine,node_preprocessing toneMint
```

## Components

### Browser interface

- [Search interface](https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/static/js/app.js): `static/js/app.js`

### API service

- [HTTP API](https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/main.py): `app/main.py`
- [Embedding models](https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/main.py): `app/main.py`
- [Knowledge-base loader](https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/data_loader.py): `app/data_loader.py`

### Search and language

- [Semantic search](https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/search.py): `app/search.py`
- [Query preprocessing](https://github.com/a-dinesh-kumar/semantic-similarity-search-system/blob/main/app/preprocessing.py): `app/preprocessing.py`

### Other components

- **Search user**

## Connections

- Search user → Search interface: enters query (evidence: `static/js/app.js`)
- Search interface → HTTP API: requests stats and search (evidence: `static/js/app.js`)
- HTTP API → Knowledge-base loader: loads knowledge base (evidence: `app/main.py`)
- HTTP API → Semantic search: vectors and ranks (evidence: `app/main.py`)
- Semantic search → Query preprocessing: preprocesses query (evidence: `app/search.py`)
