# pratiksubedar/schemeprojectgroq architecture

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

- Interactive diagram: https://gitdiagram.com/pratiksubedar/schemeprojectgroq
- Repository: https://github.com/pratiksubedar/schemeprojectgroq

## Overview

Yojana Saathi is a multilingual assistant for discovering Indian government schemes. A citizen chooses a language, provides profile details or asks a voice/text question, then browses scheme matches, eligibility outcomes, details, and document checklists. The React frontend maintains session state and calls a FastAPI backend; the backend includes scheme, eligibility, document, and chat APIs, with SQLite-backed scheme and retrieval data. Voice input/output and offline awareness support the user journey. Backend endpoint implementations were not sampled, so connections from API routes into domain services are left unasserted.

Main entry points: [`src/App.tsx`](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/App.tsx) (App routing), [`backend/app/api/router.py`](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/router.py) (Versioned API routes), [`src/services/schemeApi.ts`](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/services/schemeApi.ts) (Scheme API client), [`src/pages/AssistantChat.tsx`](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/pages/AssistantChat.tsx) (Assistant chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Citizen experience"]
  node_app["App routing<br/>[App.tsx]"]
  node_home["Discover schemes<br/>[Home.tsx]"]
  node_chat["Assistant chat<br/>[AssistantChat.tsx]"]
  node_profile["Profile and eligibility"]
  node_scheme_views["Scheme journeys"]
  node_app_state["Session state<br/>[AppContext.tsx]"]
end

subgraph group_voice["Language and voice"]
  node_voice_input["Speech recognition"]
  node_voice_output["Speech synthesis"]
  node_translations["Translations<br/>[translations.ts]"]
end

subgraph group_api["Backend API"]
  node_chat_client["Chat API client<br/>[chatApi.ts]"]
  node_scheme_client["Scheme API client<br/>[schemeApi.ts]"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_api_router["Versioned API routes<br/>[router.py]"]
  node_api_chat["Chat endpoint<br/>[chat.py]"]
  node_api_eligibility["Eligibility endpoint<br/>[eligibility.py]"]
  node_api_schemes["Scheme endpoint<br/>[schemes.py]"]
  node_api_documents["Document endpoint<br/>[documents.py]"]
end

subgraph group_domain["Scheme intelligence"]
  node_orchestrator["Conversation orchestration<br/>[orchestrator.py]"]
  node_eligibility_engine["Eligibility rules<br/>[rule_engine.py]"]
  node_retrieval["Scheme retrieval"]
  node_document_service["Document checklists"]
end

subgraph group_storage["Persistence and retrieval"]
  node_db_init["Database initialization<br/>[init_db.py]"]
  node_db_models["Scheme data model<br/>[models.py]"]
  node_db_session[("SQLite sessions<br/>[session.py]")]
end

node_citizen(("Citizen"))
node_browser_speech["Browser speech APIs"]
node_sqlite[("SQLite database")]

node_citizen -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_chat
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_scheme_views
node_app -->|"provides state"| node_app_state
node_chat -->|"sends messages"| node_chat_client
node_chat -->|"captures speech"| node_voice_input
node_chat -->|"speaks replies"| node_voice_output
node_home -.->|"fetches schemes"| node_scheme_client
node_scheme_views -.->|"loads scheme data"| node_scheme_client
node_browser_speech -.->|"recognizes speech"| node_voice_input
node_voice_output -.->|"uses synthesis"| node_browser_speech
node_chat_client -.->|"requests chat"| node_api_chat
node_scheme_client -.->|"requests catalog"| node_api_schemes
node_scheme_client -.->|"requests eligibility"| node_api_eligibility
node_scheme_client -.->|"requests checklists"| node_api_documents
node_api_app -->|"registers routes"| node_api_router
node_api_router -->|"routes to"| node_api_chat
node_api_router -->|"routes to"| node_api_eligibility
node_api_router -->|"routes to"| node_api_schemes
node_api_router -->|"routes to"| node_api_documents
node_api_chat -.->|"delegates to"| node_orchestrator
node_api_eligibility -.->|"evaluates rules"| node_eligibility_engine
node_api_schemes -.->|"retrieves matches"| node_retrieval
node_api_documents -.->|"loads checklist"| node_document_service
node_api_app -->|"initializes database"| node_db_init
node_api_app -->|"cleans sessions"| node_document_service
node_retrieval -->|"queries chunks"| node_db_session
node_document_service -->|"uses records"| node_db_models
node_db_init -->|"initializes tables"| node_db_models
node_db_session -->|"opens sessions"| node_sqlite

click node_app "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/App.tsx"
click node_home "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/pages/Home.tsx"
click node_chat "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/pages/AssistantChat.tsx"
click node_profile "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/pages/ProfileConfirmation.tsx"
click node_scheme_views "https://github.com/pratiksubedar/schemeprojectgroq/tree/main/src/pages"
click node_app_state "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/context/AppContext.tsx"
click node_voice_input "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/hooks/useSpeechRecognition.ts"
click node_voice_output "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/hooks/useSpeechSynthesis.ts"
click node_translations "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/data/translations.ts"
click node_chat_client "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/services/chatApi.ts"
click node_scheme_client "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/services/schemeApi.ts"
click node_api_app "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/main.py"
click node_api_router "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/router.py"
click node_api_chat "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/v1/chat.py"
click node_api_eligibility "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/v1/eligibility.py"
click node_api_schemes "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/v1/schemes.py"
click node_api_documents "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/v1/documents.py"
click node_orchestrator "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/services/orchestration/orchestrator.py"
click node_eligibility_engine "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/services/rule_engine.py"
click node_retrieval "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/services/rag_retriever_service.py"
click node_document_service "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/services/document_service.py"
click node_db_init "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/db/init_db.py"
click node_db_models "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/db/models.py"
click node_db_session "https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/db/session.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_chat,node_profile,node_scheme_views,node_app_state,node_browser_speech toneBlue
class node_voice_input,node_voice_output,node_translations,node_sqlite toneAmber
class node_chat_client,node_scheme_client,node_api_app,node_api_router,node_api_chat,node_api_eligibility,node_api_schemes,node_api_documents toneMint
class node_orchestrator,node_eligibility_engine,node_retrieval,node_document_service toneRose
class node_db_init,node_db_models,node_db_session,node_citizen toneIndigo
```

## Components

### Citizen experience

- [App routing](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/App.tsx): `src/App.tsx`
- [Discover schemes](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/pages/Home.tsx): `src/pages/Home.tsx`
- [Assistant chat](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/pages/AssistantChat.tsx): `src/pages/AssistantChat.tsx`
- [Profile and eligibility](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/pages/ProfileConfirmation.tsx): `src/pages/ProfileConfirmation.tsx`
- [Scheme journeys](https://github.com/pratiksubedar/schemeprojectgroq/tree/main/src/pages): `src/pages`
- [Session state](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/context/AppContext.tsx): `src/context/AppContext.tsx`

### Language and voice

- [Speech recognition](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/hooks/useSpeechRecognition.ts): `src/hooks/useSpeechRecognition.ts`
- [Speech synthesis](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/hooks/useSpeechSynthesis.ts): `src/hooks/useSpeechSynthesis.ts`
- [Translations](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/data/translations.ts): `src/data/translations.ts`

### Backend API

- [Chat API client](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/services/chatApi.ts): `src/services/chatApi.ts`
- [Scheme API client](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/src/services/schemeApi.ts): `src/services/schemeApi.ts`
- [FastAPI application](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/main.py): `backend/app/main.py`
- [Versioned API routes](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Chat endpoint](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/v1/chat.py): `backend/app/api/v1/chat.py`
- [Eligibility endpoint](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/v1/eligibility.py): `backend/app/api/v1/eligibility.py`
- [Scheme endpoint](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/v1/schemes.py): `backend/app/api/v1/schemes.py`
- [Document endpoint](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/api/v1/documents.py): `backend/app/api/v1/documents.py`

### Scheme intelligence

- [Conversation orchestration](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/services/orchestration/orchestrator.py): `backend/app/services/orchestration/orchestrator.py`
- [Eligibility rules](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/services/rule_engine.py): `backend/app/services/rule_engine.py`
- [Scheme retrieval](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/services/rag_retriever_service.py): `backend/app/services/rag_retriever_service.py`
- [Document checklists](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/services/document_service.py): `backend/app/services/document_service.py`

### Persistence and retrieval

- [Database initialization](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/db/init_db.py): `backend/app/db/init_db.py`
- [Scheme data model](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/db/models.py): `backend/app/db/models.py`
- [SQLite sessions](https://github.com/pratiksubedar/schemeprojectgroq/blob/main/backend/app/db/session.py): `backend/app/db/session.py`

### Other components

- **Citizen**
- **Browser speech APIs**
- **SQLite database**

## Connections

- Citizen → App routing: opens (evidence: `src/App.tsx`)
- App routing → Discover schemes: routes to (evidence: `src/App.tsx`)
- App routing → Assistant chat: routes to (evidence: `src/App.tsx`)
- App routing → Profile and eligibility: routes to (evidence: `src/App.tsx`)
- App routing → Scheme journeys: routes to (evidence: `src/App.tsx`)
- App routing → Session state: provides state (evidence: `src/App.tsx`)
- Assistant chat → Chat API client: sends messages (evidence: `src/pages/AssistantChat.tsx`)
- Assistant chat → Speech recognition: captures speech (evidence: `src/pages/AssistantChat.tsx`)
- Assistant chat → Speech synthesis: speaks replies (evidence: `src/pages/AssistantChat.tsx`)
- Discover schemes → Scheme API client: fetches schemes (evidence: `src/pages/Home.tsx`)
- Scheme journeys → Scheme API client: loads scheme data (evidence: `src/pages/AssistantChat.tsx`)
- Browser speech APIs → Speech recognition: recognizes speech
- Speech synthesis → Browser speech APIs: uses synthesis
- Chat API client → Chat endpoint: requests chat
- Scheme API client → Scheme endpoint: requests catalog
- Scheme API client → Eligibility endpoint: requests eligibility
- Scheme API client → Document endpoint: requests checklists
- FastAPI application → Versioned API routes: registers routes (evidence: `backend/app/main.py`)
- Versioned API routes → Chat endpoint: routes to (evidence: `backend/app/api/router.py`)
- Versioned API routes → Eligibility endpoint: routes to (evidence: `backend/app/api/router.py`)
- Versioned API routes → Scheme endpoint: routes to (evidence: `backend/app/api/router.py`)
- Versioned API routes → Document endpoint: routes to (evidence: `backend/app/api/router.py`)
- Chat endpoint → Conversation orchestration: delegates to
- Eligibility endpoint → Eligibility rules: evaluates rules
- Scheme endpoint → Scheme retrieval: retrieves matches
- Document endpoint → Document checklists: loads checklist
- FastAPI application → Database initialization: initializes database (evidence: `backend/app/main.py`)
- FastAPI application → Document checklists: cleans sessions (evidence: `backend/app/main.py`)
- Scheme retrieval → SQLite sessions: queries chunks (evidence: `backend/app/services/rag_retriever_service.py`)
- Document checklists → Scheme data model: uses records (evidence: `backend/app/services/document_service.py`)
- Database initialization → Scheme data model: initializes tables (evidence: `backend/app/db/init_db.py`)
- SQLite sessions → SQLite database: opens sessions (evidence: `backend/app/db/session.py`)
