# kaarthick6-tech/sih-is architecture

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

- Interactive diagram: https://gitdiagram.com/kaarthick6-tech/sih-is
- Repository: https://github.com/kaarthick6-tech/sih-is

## Overview

This is an Indian Standards recommendation engine: users submit procurement text or a PDF and receive matching standards, related standards, mandatory certifications, and a shared rationale. The frontend sends typed requests to a FastAPI API; PDF submissions are extracted before both input modes share embedding, database candidate search, and LLM reranking. The backend also includes database schema setup and standards seeding. The README is empty, so capability and relationship coverage here is based on the sampled source and SOURCE INDEX; unsampled modules are not inferred beyond those references.

Main entry points: [`backend/routers/analyze.py`](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/routers/analyze.py) (Shared analysis pipeline), [`backend/data_ingestion/seed_standards.py`](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/data_ingestion/seed_standards.py) (Standards seeding), [`frontend/app/page.tsx`](https://github.com/kaarthick6-tech/sih-is/blob/main/frontend/app/page.tsx) (Submission and results), [`backend/db/session.py`](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/db/session.py) (Database connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User interface"]
  node_web_ui["Submission and results<br/>[page.tsx]"]
  node_api_client["Typed API client<br/>[api.ts]"]
end

subgraph group_api["API intake"]
  node_fastapi_app["FastAPI app<br/>[main.py]"]
  node_analysis_routes["Analysis routes<br/>[analyze.py]"]
  node_pdf_text["PDF text extraction<br/>[analyze.py]"]
end

subgraph group_analysis["Recommendation analysis"]
  node_analysis_engine["Shared analysis pipeline<br/>[analyze.py]"]
  node_embedding_model["Text embeddings<br/>[analyze.py]"]
  node_reranker["LLM reranking<br/>[reranker.py]"]
end

subgraph group_data["Standards data"]
  node_standards_db[("Standards database<br/>[models.py]")]
  node_db_connection["Database connection<br/>[session.py]"]
  node_seed_data["Standards seeding<br/>[seed_standards.py]"]
end

node_user(("Procurement user"))
node_llm_provider["Groq or OpenAI"]

node_user -->|"submits input"| node_web_ui
node_web_ui -->|"calls analysis"| node_api_client
node_api_client -->|"POSTs requests"| node_fastapi_app
node_fastapi_app -->|"mounts routes"| node_analysis_routes
node_analysis_routes -->|"extracts PDF text"| node_pdf_text
node_analysis_routes -->|"analyzes text"| node_analysis_engine
node_pdf_text -->|"passes extracted text"| node_analysis_engine
node_analysis_engine -->|"encodes query"| node_embedding_model
node_analysis_engine -->|"opens connection"| node_db_connection
node_db_connection -->|"queries candidates"| node_standards_db
node_analysis_engine -->|"reranks candidates"| node_reranker
node_reranker -->|"requests selection"| node_llm_provider
node_analysis_engine -->|"reads relations and certifications"| node_standards_db
node_seed_data -->|"encodes scopes"| node_embedding_model
node_seed_data -->|"opens connection"| node_db_connection
node_seed_data -->|"inserts seed records"| node_standards_db
node_analysis_engine -.->|"returns recommendations"| node_web_ui

click node_web_ui "https://github.com/kaarthick6-tech/sih-is/blob/main/frontend/app/page.tsx"
click node_api_client "https://github.com/kaarthick6-tech/sih-is/blob/main/frontend/lib/api.ts"
click node_fastapi_app "https://github.com/kaarthick6-tech/sih-is/blob/main/backend/main.py"
click node_analysis_routes "https://github.com/kaarthick6-tech/sih-is/blob/main/backend/routers/analyze.py"
click node_pdf_text "https://github.com/kaarthick6-tech/sih-is/blob/main/backend/routers/analyze.py"
click node_analysis_engine "https://github.com/kaarthick6-tech/sih-is/blob/main/backend/routers/analyze.py"
click node_embedding_model "https://github.com/kaarthick6-tech/sih-is/blob/main/backend/routers/analyze.py"
click node_reranker "https://github.com/kaarthick6-tech/sih-is/blob/main/backend/services/reranker.py"
click node_standards_db "https://github.com/kaarthick6-tech/sih-is/blob/main/backend/db/models.py"
click node_db_connection "https://github.com/kaarthick6-tech/sih-is/blob/main/backend/db/session.py"
click node_seed_data "https://github.com/kaarthick6-tech/sih-is/blob/main/backend/data_ingestion/seed_standards.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_web_ui,node_api_client,node_user toneBlue
class node_fastapi_app,node_analysis_routes,node_pdf_text toneAmber
class node_analysis_engine,node_embedding_model,node_reranker toneMint
class node_standards_db,node_db_connection,node_seed_data toneRose
class node_llm_provider toneIndigo
```

## Components

### User interface

- [Submission and results](https://github.com/kaarthick6-tech/sih-is/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Typed API client](https://github.com/kaarthick6-tech/sih-is/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`

### API intake

- [FastAPI app](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/main.py): `backend/main.py`
- [Analysis routes](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/routers/analyze.py): `backend/routers/analyze.py`
- [PDF text extraction](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/routers/analyze.py): `backend/routers/analyze.py`

### Recommendation analysis

- [Shared analysis pipeline](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/routers/analyze.py): `backend/routers/analyze.py`
- [Text embeddings](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/routers/analyze.py): `backend/routers/analyze.py`
- [LLM reranking](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/services/reranker.py): `backend/services/reranker.py`

### Standards data

- [Standards database](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/db/models.py): `backend/db/models.py`
- [Database connection](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/db/session.py): `backend/db/session.py`
- [Standards seeding](https://github.com/kaarthick6-tech/sih-is/blob/main/backend/data_ingestion/seed_standards.py): `backend/data_ingestion/seed_standards.py`

### Other components

- **Procurement user**
- **Groq or OpenAI**

## Connections

- Procurement user → Submission and results: submits input (evidence: `frontend/app/page.tsx`)
- Submission and results → Typed API client: calls analysis (evidence: `frontend/app/page.tsx`)
- Typed API client → FastAPI app: POSTs requests (evidence: `frontend/lib/api.ts`)
- FastAPI app → Analysis routes: mounts routes (evidence: `backend/main.py`)
- Analysis routes → PDF text extraction: extracts PDF text (evidence: `backend/routers/analyze.py`)
- Analysis routes → Shared analysis pipeline: analyzes text (evidence: `backend/routers/analyze.py`)
- PDF text extraction → Shared analysis pipeline: passes extracted text (evidence: `backend/routers/analyze.py`)
- Shared analysis pipeline → Text embeddings: encodes query (evidence: `backend/routers/analyze.py`)
- Shared analysis pipeline → Database connection: opens connection (evidence: `backend/routers/analyze.py`)
- Database connection → Standards database: queries candidates (evidence: `backend/db/models.py`)
- Shared analysis pipeline → LLM reranking: reranks candidates (evidence: `backend/routers/analyze.py`)
- LLM reranking → Groq or OpenAI: requests selection (evidence: `backend/services/reranker.py`)
- Shared analysis pipeline → Standards database: reads relations and certifications (evidence: `backend/routers/analyze.py`)
- Standards seeding → Text embeddings: encodes scopes (evidence: `backend/data_ingestion/seed_standards.py`)
- Standards seeding → Database connection: opens connection (evidence: `backend/data_ingestion/seed_standards.py`)
- Standards seeding → Standards database: inserts seed records (evidence: `backend/data_ingestion/seed_standards.py`)
- Shared analysis pipeline → Submission and results: returns recommendations
