# kamalesh-k05/sih-bis-portal architecture

> Architecture diagram of the GitHub repository kamalesh-k05/sih-bis-portal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kamalesh-k05/sih-bis-portal
- Repository: https://github.com/kamalesh-k05/sih-bis-portal

## Overview

BIS Smart Portal guides businesses from product descriptions to applicable standards and certification preparation, and helps consumers check BIS product details. Its offline-first browser experience also provides standards browsing, a multilingual assistant, document search, and a judge demo; an optional FastAPI backend exposes a parallel RAG pipeline. The graph reflects documented routes and sampled calls; some feature links are based on README descriptions because their implementation was not sampled, and verification uses prototype data rather than the official BIS database.

Main entry points: [`src/App.tsx`](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/App.tsx) (Web app routes), [`src/pages/StandardsPage.tsx`](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/StandardsPage.tsx) (Standards browser), [`src/components/AssistantChat.tsx`](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/components/AssistantChat.tsx) (Chat widget), [`src/pages/BusinessJourney.tsx`](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/BusinessJourney.tsx) (Business journey)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_journeys["User journeys"]
  node_app["Web app routes<br/>[App.tsx]"]
  node_home["Portal home<br/>[Home.tsx]"]
  node_business["Business journey"]
  node_consumer["Consumer journey"]
  node_checklist["Document checklist"]
  node_judge["Judge demo<br/>[JudgeDemo.tsx]"]
end

subgraph group_knowledge["Standards and assistant"]
  node_standards_page["Standards browser<br/>[StandardsPage.tsx]"]
  node_assistant["Assistant page<br/>[Assistant.tsx]"]
  node_chat["Chat widget<br/>[AssistantChat.tsx]"]
  node_standards[("Verified standards<br/>[standards.ts]")]
  node_search["Hybrid search<br/>[searchEngine.ts]"]
  node_guard["Standards whitelist"]
  node_responses["Response generation"]
  node_translations["Translations<br/>[translations.ts]"]
end

subgraph group_verification["Verification and documents"]
  node_verification_engine["Product verification"]
  node_scanner["Product scanner<br/>[ProductScanner.tsx]"]
  node_doc_search["Document search<br/>[documentSearch.ts]"]
  node_pdf_parser["BIS PDF parser<br/>[pdfParser.ts]"]
  node_bis_live["Live standard lookup<br/>[bisLive.ts]"]
end

subgraph group_services["State and backend"]
  node_app_state[("Shared app state<br/>[appStore.ts]")]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_api_search["Backend search<br/>[search_engine.py]"]
  node_api_guard["Backend whitelist"]
  node_api_responses["Backend responses"]
  node_api_standards[("Backend standards<br/>[standards_data.py]")]
end

node_visitor(("Portal user"))
node_bis["Official BIS services"]

node_visitor -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_business
node_app -->|"routes to"| node_consumer
node_app -->|"routes to"| node_standards_page
node_app -->|"routes to"| node_assistant
node_app -->|"routes to"| node_judge
node_app -->|"renders"| node_chat
node_home -->|"links to"| node_business
node_home -->|"links to"| node_consumer
node_business -->|"searches"| node_search
node_search -->|"ranks"| node_standards
node_business -->|"renders"| node_checklist
node_business -->|"updates"| node_app_state
node_consumer -->|"offers scanning"| node_scanner
node_consumer -->|"verifies with"| node_verification_engine
node_consumer -->|"stores result"| node_app_state
node_chat -->|"searches"| node_search
node_chat -->|"validates codes"| node_guard
node_chat -->|"generates reply"| node_responses
node_chat -->|"stores messages"| node_app_state
node_assistant -->|"searches"| node_search
node_assistant -->|"validates codes"| node_guard
node_assistant -->|"generates reply"| node_responses
node_standards_page -->|"searches documents"| node_doc_search
node_standards_page -->|"parses uploads"| node_pdf_parser
node_standards_page -->|"looks up standards"| node_bis_live
node_standards_page -->|"browses"| node_standards
node_judge -->|"measures retrieval"| node_search
node_judge -->|"checks whitelist"| node_guard
node_bis_live -.->|"fetches details"| node_bis
node_api -->|"calls"| node_api_search
node_api -->|"validates with"| node_api_guard
node_api -->|"generates with"| node_api_responses
node_api_search -->|"ranks"| node_api_standards
node_api_responses -->|"uses results"| node_api_search
node_api_responses -->|"uses data"| node_api_standards
node_api_guard -->|"checks codes"| node_api_standards

click node_app "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/App.tsx"
click node_home "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/Home.tsx"
click node_business "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/BusinessJourney.tsx"
click node_consumer "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/ConsumerJourney.tsx"
click node_standards_page "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/StandardsPage.tsx"
click node_assistant "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/Assistant.tsx"
click node_chat "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/components/AssistantChat.tsx"
click node_standards "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/data/standards.ts"
click node_search "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/searchEngine.ts"
click node_guard "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/antiHallucination.ts"
click node_responses "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/responseGenerator.ts"
click node_translations "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/data/translations.ts"
click node_app_state "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/store/appStore.ts"
click node_checklist "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/components/DocumentChecklist.tsx"
click node_verification_engine "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/verificationEngine.ts"
click node_scanner "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/components/ProductScanner.tsx"
click node_doc_search "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/documentSearch.ts"
click node_pdf_parser "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/pdfParser.ts"
click node_bis_live "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/bisLive.ts"
click node_judge "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/components/JudgeDemo.tsx"
click node_api "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/backend/main.py"
click node_api_search "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/backend/search_engine.py"
click node_api_guard "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/backend/anti_hallucination.py"
click node_api_responses "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/backend/response_generator.py"
click node_api_standards "https://github.com/kamalesh-k05/sih-bis-portal/blob/main/backend/standards_data.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_home,node_business,node_consumer,node_checklist,node_judge,node_visitor toneBlue
class node_standards_page,node_assistant,node_chat,node_standards,node_search,node_guard,node_responses,node_translations toneAmber
class node_verification_engine,node_scanner,node_doc_search,node_pdf_parser,node_bis_live toneMint
class node_app_state,node_api,node_api_search,node_api_guard,node_api_responses,node_api_standards toneRose
class node_bis toneIndigo
```

## Components

### User journeys

- [Web app routes](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/App.tsx): `src/App.tsx`
- [Portal home](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/Home.tsx): `src/pages/Home.tsx`
- [Business journey](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/BusinessJourney.tsx): `src/pages/BusinessJourney.tsx`
- [Consumer journey](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/ConsumerJourney.tsx): `src/pages/ConsumerJourney.tsx`
- [Document checklist](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/components/DocumentChecklist.tsx): `src/components/DocumentChecklist.tsx`
- [Judge demo](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/components/JudgeDemo.tsx): `src/components/JudgeDemo.tsx`

### Standards and assistant

- [Standards browser](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/StandardsPage.tsx): `src/pages/StandardsPage.tsx`
- [Assistant page](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/pages/Assistant.tsx): `src/pages/Assistant.tsx`
- [Chat widget](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/components/AssistantChat.tsx): `src/components/AssistantChat.tsx`
- [Verified standards](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/data/standards.ts): `src/data/standards.ts`
- [Hybrid search](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/searchEngine.ts): `src/utils/searchEngine.ts`
- [Standards whitelist](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/antiHallucination.ts): `src/utils/antiHallucination.ts`
- [Response generation](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/responseGenerator.ts): `src/utils/responseGenerator.ts`
- [Translations](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/data/translations.ts): `src/data/translations.ts`

### Verification and documents

- [Product verification](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/verificationEngine.ts): `src/utils/verificationEngine.ts`
- [Product scanner](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/components/ProductScanner.tsx): `src/components/ProductScanner.tsx`
- [Document search](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/documentSearch.ts): `src/utils/documentSearch.ts`
- [BIS PDF parser](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/pdfParser.ts): `src/utils/pdfParser.ts`
- [Live standard lookup](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/utils/bisLive.ts): `src/utils/bisLive.ts`

### State and backend

- [Shared app state](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/src/store/appStore.ts): `src/store/appStore.ts`
- [FastAPI endpoints](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/backend/main.py): `backend/main.py`
- [Backend search](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/backend/search_engine.py): `backend/search_engine.py`
- [Backend whitelist](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/backend/anti_hallucination.py): `backend/anti_hallucination.py`
- [Backend responses](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/backend/response_generator.py): `backend/response_generator.py`
- [Backend standards](https://github.com/kamalesh-k05/sih-bis-portal/blob/main/backend/standards_data.py): `backend/standards_data.py`

### Other components

- **Portal user**
- **Official BIS services**

## Connections

- Portal user → Web app routes: uses
- Web app routes → Portal home: routes to (evidence: `src/App.tsx`)
- Web app routes → Business journey: routes to (evidence: `src/App.tsx`)
- Web app routes → Consumer journey: routes to (evidence: `src/App.tsx`)
- Web app routes → Standards browser: routes to (evidence: `src/App.tsx`)
- Web app routes → Assistant page: routes to (evidence: `src/App.tsx`)
- Web app routes → Judge demo: routes to (evidence: `src/App.tsx`)
- Web app routes → Chat widget: renders (evidence: `src/App.tsx`)
- Portal home → Business journey: links to (evidence: `src/pages/Home.tsx`)
- Portal home → Consumer journey: links to (evidence: `src/pages/Home.tsx`)
- Business journey → Hybrid search: searches (evidence: `src/pages/BusinessJourney.tsx`)
- Hybrid search → Verified standards: ranks (evidence: `src/utils/searchEngine.ts`)
- Business journey → Document checklist: renders (evidence: `src/pages/BusinessJourney.tsx`)
- Business journey → Shared app state: updates (evidence: `src/pages/BusinessJourney.tsx`)
- Consumer journey → Product scanner: offers scanning (evidence: `src/pages/ConsumerJourney.tsx`)
- Consumer journey → Product verification: verifies with (evidence: `src/pages/ConsumerJourney.tsx`)
- Consumer journey → Shared app state: stores result (evidence: `src/pages/ConsumerJourney.tsx`)
- Chat widget → Hybrid search: searches (evidence: `src/components/AssistantChat.tsx`)
- Chat widget → Standards whitelist: validates codes (evidence: `src/components/AssistantChat.tsx`)
- Chat widget → Response generation: generates reply (evidence: `src/components/AssistantChat.tsx`)
- Chat widget → Shared app state: stores messages (evidence: `src/components/AssistantChat.tsx`)
- Assistant page → Hybrid search: searches (evidence: `src/pages/Assistant.tsx`)
- Assistant page → Standards whitelist: validates codes (evidence: `src/pages/Assistant.tsx`)
- Assistant page → Response generation: generates reply (evidence: `src/pages/Assistant.tsx`)
- Standards browser → Document search: searches documents (evidence: `src/pages/StandardsPage.tsx`)
- Standards browser → BIS PDF parser: parses uploads (evidence: `src/pages/StandardsPage.tsx`)
- Standards browser → Live standard lookup: looks up standards (evidence: `src/pages/StandardsPage.tsx`)
- Standards browser → Verified standards: browses (evidence: `src/pages/StandardsPage.tsx`)
- Judge demo → Hybrid search: measures retrieval (evidence: `src/components/JudgeDemo.tsx`)
- Judge demo → Standards whitelist: checks whitelist (evidence: `src/components/JudgeDemo.tsx`)
- Live standard lookup → Official BIS services: fetches details
- FastAPI endpoints → Backend search: calls (evidence: `backend/main.py`)
- FastAPI endpoints → Backend whitelist: validates with (evidence: `backend/main.py`)
- FastAPI endpoints → Backend responses: generates with (evidence: `backend/main.py`)
- Backend search → Backend standards: ranks (evidence: `backend/search_engine.py`)
- Backend responses → Backend search: uses results (evidence: `backend/response_generator.py`)
- Backend responses → Backend standards: uses data (evidence: `backend/response_generator.py`)
- Backend whitelist → Backend standards: checks codes (evidence: `backend/anti_hallucination.py`)
