# mihirr-source/trial architecture

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

- Interactive diagram: https://gitdiagram.com/mihirr-source/trial
- Repository: https://github.com/mihirr-source/trial

## Overview

BIS is a decision-support web application that maps procurement language to Indian Standards and helps users check tender specifications. The main workflow is query or document intake, standard retrieval, allied-reference and compliance analysis, then a report or specification clauses. The graph also includes catalogue browsing, certification alerts, the multilingual assistant, and the documented offline catalogue-import capability. Some endpoint wiring and clause-generation details are not present in the sampled source, so those links are limited to documented relationships.

Main entry points: [`bis_engine/main.py`](https://github.com/mihirr-source/trial/blob/master/bis_engine/main.py) (FastAPI application), [`bis_engine/engine/retriever.py`](https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/retriever.py) (Standards retriever), [`bis_engine/static/index.html`](https://github.com/mihirr-source/trial/blob/master/bis_engine/static/index.html) (BIS web UI), [`bis_engine/data/catalog.py`](https://github.com/mihirr-source/trial/blob/master/bis_engine/data/catalog.py) (Seed standards catalogue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_webui["BIS web UI<br/>[index.html]"]
  node_analyzer_ui["Tender analyzer UI<br/>[analyzer.js]"]
  node_assistant_ui["Assistant UI<br/>[chat.js]"]
  node_language_ui["Language switcher<br/>[i18n.js]"]
end

subgraph group_api["API workflows"]
  node_api["FastAPI application<br/>[main.py]"]
  node_extract["Document text extraction<br/>[extract.py]"]
  node_analyzer["Tender analyzer<br/>[analyzer.py]"]
  node_clauses["Clause generator<br/>[clauses.py]"]
  node_assistant["Standards assistant<br/>[assistant.py]"]
end

subgraph group_engine["Recommendation engine"]
  node_normalizer["Query normalization<br/>[normalize.py]"]
  node_retriever["Standards retriever<br/>[retriever.py]"]
  node_embeddings["Optional embeddings<br/>[embeddings.py]"]
end

subgraph group_catalogue["Catalogue data"]
  node_catalog["Seed standards catalogue<br/>[catalog.py]"]
  node_importer["Snapshot importer<br/>[bis_snapshot.py]"]
end

node_user(("Procurement user"))
node_llm{{"Optional LLM service"}}

node_user -->|"enters query"| node_webui
node_webui -->|"requests standards"| node_api
node_analyzer_ui -->|"submits analysis"| node_api
node_assistant_ui -->|"sends question"| node_api
node_api -->|"serves pages"| node_webui
node_api -->|"extracts upload"| node_extract
node_api -->|"analyzes text"| node_analyzer
node_api -->|"generates clauses"| node_clauses
node_api -->|"answers question"| node_assistant
node_api -->|"lists standards"| node_catalog
node_analyzer -->|"retrieves candidates"| node_retriever
node_analyzer -->|"checks references"| node_catalog
node_assistant -->|"searches standards"| node_retriever
node_retriever -->|"normalizes query"| node_normalizer
node_retriever -->|"reads standards"| node_catalog
node_retriever -.->|"encodes documents"| node_embeddings
node_assistant -.->|"refines response"| node_llm
node_importer -->|"checks existing codes"| node_catalog
node_language_ui -->|"translates interface"| node_webui

click node_webui "https://github.com/mihirr-source/trial/blob/master/bis_engine/static/index.html"
click node_analyzer_ui "https://github.com/mihirr-source/trial/blob/master/bis_engine/static/js/analyzer.js"
click node_assistant_ui "https://github.com/mihirr-source/trial/blob/master/bis_engine/static/js/chat.js"
click node_language_ui "https://github.com/mihirr-source/trial/blob/master/bis_engine/static/js/i18n.js"
click node_api "https://github.com/mihirr-source/trial/blob/master/bis_engine/main.py"
click node_extract "https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/extract.py"
click node_analyzer "https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/analyzer.py"
click node_clauses "https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/clauses.py"
click node_assistant "https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/assistant.py"
click node_normalizer "https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/normalize.py"
click node_retriever "https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/retriever.py"
click node_embeddings "https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/embeddings.py"
click node_catalog "https://github.com/mihirr-source/trial/blob/master/bis_engine/data/catalog.py"
click node_importer "https://github.com/mihirr-source/trial/blob/master/bis_engine/data/importers/bis_snapshot.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_webui,node_analyzer_ui,node_assistant_ui,node_language_ui,node_user toneBlue
class node_api,node_extract,node_analyzer,node_clauses,node_assistant toneAmber
class node_normalizer,node_retriever,node_embeddings toneMint
class node_catalog,node_importer toneRose
class node_llm toneIndigo
```

## Components

### Web interface

- [BIS web UI](https://github.com/mihirr-source/trial/blob/master/bis_engine/static/index.html): `bis_engine/static/index.html`
- [Tender analyzer UI](https://github.com/mihirr-source/trial/blob/master/bis_engine/static/js/analyzer.js): `bis_engine/static/js/analyzer.js`
- [Assistant UI](https://github.com/mihirr-source/trial/blob/master/bis_engine/static/js/chat.js): `bis_engine/static/js/chat.js`
- [Language switcher](https://github.com/mihirr-source/trial/blob/master/bis_engine/static/js/i18n.js): `bis_engine/static/js/i18n.js`

### API workflows

- [FastAPI application](https://github.com/mihirr-source/trial/blob/master/bis_engine/main.py): `bis_engine/main.py`
- [Document text extraction](https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/extract.py): `bis_engine/engine/extract.py`
- [Tender analyzer](https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/analyzer.py): `bis_engine/engine/analyzer.py`
- [Clause generator](https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/clauses.py): `bis_engine/engine/clauses.py`
- [Standards assistant](https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/assistant.py): `bis_engine/engine/assistant.py`

### Recommendation engine

- [Query normalization](https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/normalize.py): `bis_engine/engine/normalize.py`
- [Standards retriever](https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/retriever.py): `bis_engine/engine/retriever.py`
- [Optional embeddings](https://github.com/mihirr-source/trial/blob/master/bis_engine/engine/embeddings.py): `bis_engine/engine/embeddings.py`

### Catalogue data

- [Seed standards catalogue](https://github.com/mihirr-source/trial/blob/master/bis_engine/data/catalog.py): `bis_engine/data/catalog.py`
- [Snapshot importer](https://github.com/mihirr-source/trial/blob/master/bis_engine/data/importers/bis_snapshot.py): `bis_engine/data/importers/bis_snapshot.py`

### Other components

- **Procurement user**
- **Optional LLM service**

## Connections

- Procurement user → BIS web UI: enters query
- BIS web UI → FastAPI application: requests standards
- Tender analyzer UI → FastAPI application: submits analysis
- Assistant UI → FastAPI application: sends question
- FastAPI application → BIS web UI: serves pages
- FastAPI application → Document text extraction: extracts upload
- FastAPI application → Tender analyzer: analyzes text
- FastAPI application → Clause generator: generates clauses
- FastAPI application → Standards assistant: answers question
- FastAPI application → Seed standards catalogue: lists standards
- Tender analyzer → Standards retriever: retrieves candidates
- Tender analyzer → Seed standards catalogue: checks references
- Standards assistant → Standards retriever: searches standards
- Standards retriever → Query normalization: normalizes query
- Standards retriever → Seed standards catalogue: reads standards
- Standards retriever → Optional embeddings: encodes documents
- Standards assistant → Optional LLM service: refines response
- Snapshot importer → Seed standards catalogue: checks existing codes
- Language switcher → BIS web UI: translates interface
