# senthilthangaiah/bns-search-app architecture

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

- Interactive diagram: https://gitdiagram.com/senthilthangaiah/bns-search-app
- Repository: https://github.com/senthilthangaiah/bns-search-app

## Overview

This is a small Streamlit app for semantic search over Bharatiya Nyaya Sanhita text. The user enters a query; the app loads the CSV corpus and embedding model, ranks corpus entries by similarity, and displays the selected details and scores. The sampled app.py shows the runtime flow; the README documents the search and result-count controls. The pretrained model is represented as an external dependency; no separate service or storage system is evident.

Main entry points: [`app.py`](https://github.com/senthilthangaiah/bns-search-app/blob/master/app.py) (Streamlit app), [`bns.csv`](https://github.com/senthilthangaiah/bns-search-app/blob/master/bns.csv) (BNS corpus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Search interface"]
  node_app["Streamlit app<br/>[app.py]"]
  node_corpus[("BNS corpus<br/>[bns.csv]")]
  node_loader["Corpus loader<br/>[app.py]"]
  node_results["Displayed results<br/>[app.py]"]
end

subgraph group_search["Semantic search"]
  node_model_loader["Model loader<br/>[app.py]"]
  node_embedding_model["Embedding model"]
  node_ranker["Similarity ranker<br/>[app.py]"]
end

node_user(("Researcher"))

node_user -->|"enters query"| node_app
node_app -->|"loads corpus"| node_loader
node_loader -->|"reads CSV"| node_corpus
node_app -->|"loads model"| node_model_loader
node_model_loader -->|"instantiates"| node_embedding_model
node_app -->|"calls search"| node_ranker
node_ranker -->|"encodes text"| node_embedding_model
node_ranker -->|"reads details"| node_corpus
node_app -->|"renders matches"| node_results

click node_app "https://github.com/senthilthangaiah/bns-search-app/blob/master/app.py"
click node_corpus "https://github.com/senthilthangaiah/bns-search-app/blob/master/bns.csv"
click node_loader "https://github.com/senthilthangaiah/bns-search-app/blob/master/app.py"
click node_model_loader "https://github.com/senthilthangaiah/bns-search-app/blob/master/app.py"
click node_ranker "https://github.com/senthilthangaiah/bns-search-app/blob/master/app.py"
click node_results "https://github.com/senthilthangaiah/bns-search-app/blob/master/app.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_corpus,node_loader,node_results toneBlue
class node_model_loader,node_embedding_model,node_ranker toneAmber
class node_user toneIndigo
```

## Components

### Search interface

- [Streamlit app](https://github.com/senthilthangaiah/bns-search-app/blob/master/app.py): `app.py`
- [BNS corpus](https://github.com/senthilthangaiah/bns-search-app/blob/master/bns.csv): `bns.csv`
- [Corpus loader](https://github.com/senthilthangaiah/bns-search-app/blob/master/app.py): `app.py`
- [Displayed results](https://github.com/senthilthangaiah/bns-search-app/blob/master/app.py): `app.py`

### Semantic search

- [Model loader](https://github.com/senthilthangaiah/bns-search-app/blob/master/app.py): `app.py`
- **Embedding model**
- [Similarity ranker](https://github.com/senthilthangaiah/bns-search-app/blob/master/app.py): `app.py`

### Other components

- **Researcher**

## Connections

- Researcher → Streamlit app: enters query (evidence: `README.md`)
- Streamlit app → Corpus loader: loads corpus (evidence: `app.py`)
- Corpus loader → BNS corpus: reads CSV (evidence: `app.py`)
- Streamlit app → Model loader: loads model (evidence: `app.py`)
- Model loader → Embedding model: instantiates (evidence: `app.py`)
- Streamlit app → Similarity ranker: calls search (evidence: `app.py`)
- Similarity ranker → Embedding model: encodes text (evidence: `app.py`)
- Similarity ranker → BNS corpus: reads details (evidence: `app.py`)
- Streamlit app → Displayed results: renders matches (evidence: `app.py`)
