# veeresh-math/janmitra-ai-scheme-assistant architecture

> Architecture diagram of the GitHub repository veeresh-math/janmitra-ai-scheme-assistant, 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/veeresh-math/janmitra-ai-scheme-assistant
- Repository: https://github.com/veeresh-math/janmitra-ai-scheme-assistant

## Overview

JanMitra is a Streamlit assistant for finding government welfare schemes and answering scheme questions in six languages. The main journey is citizen profile entry, eligibility scoring and scheme recommendation, then ranked scheme cards with application details. A separate Q&A journey classifies a natural-language query and presents a structured answer with follow-up prompts. The excerpts show page-level behavior and state handoff, but not the full app setup or model-loading code; unshown runtime links are omitted or marked unverified.

Main entry points: [`app_pages/citizen_input.py`](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/citizen_input.py) (Profile input), [`app_pages/ask_language.py`](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/ask_language.py) (Ask JanMitra), [`app.py`](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app.py) (Streamlit app), [`app_pages/eligible_schemes.py`](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/eligible_schemes.py) (Eligible schemes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Citizen experience"]
  node_app["Streamlit app<br/>[app.py]"]
  node_profile["Profile input<br/>[citizen_input.py]"]
end

subgraph group_matching["Scheme matching"]
  node_score["Eligibility score<br/>[citizen_input.py]"]
  node_recommender["Scheme recommender"]
  node_results["Eligible schemes"]
  node_scheme_data[("Processed schemes")]
end

subgraph group_qa["Multilingual Q&amp;A"]
  node_ask["Ask JanMitra<br/>[ask_language.py]"]
  node_intent_model["Intent classifier"]
  node_responses["Intent responses<br/>[ask_language.py]"]
end

node_citizen(("Citizen"))
node_apply_portal(("Government portal"))

node_citizen -->|"uses"| node_app
node_app -->|"offers profile"| node_profile
node_profile -->|"calculates score"| node_score
node_profile -->|"recommends schemes"| node_recommender
node_profile -->|"routes to"| node_results
node_results -.->|"displays scheme details"| node_scheme_data
node_results -->|"links to apply"| node_apply_portal
node_app -->|"offers Q&amp;A"| node_ask
node_citizen -->|"asks query"| node_ask
node_ask -->|"classifies query"| node_intent_model
node_ask -->|"renders answer"| node_responses

click node_app "https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app.py"
click node_profile "https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/citizen_input.py"
click node_score "https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/citizen_input.py"
click node_recommender "https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/models/scheme_recommender.pkl"
click node_results "https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/eligible_schemes.py"
click node_scheme_data "https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/data/processed/schemes_processed.csv"
click node_ask "https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/ask_language.py"
click node_intent_model "https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/models/intent_classifier.pkl"
click node_responses "https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/ask_language.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_profile toneBlue
class node_score,node_recommender,node_results,node_scheme_data toneAmber
class node_ask,node_intent_model,node_responses toneMint
class node_citizen,node_apply_portal toneIndigo
```

## Components

### Citizen experience

- [Streamlit app](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app.py): `app.py`
- [Profile input](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/citizen_input.py): `app_pages/citizen_input.py`

### Scheme matching

- [Eligibility score](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/citizen_input.py): `app_pages/citizen_input.py`
- [Scheme recommender](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/models/scheme_recommender.pkl): `models/scheme_recommender.pkl`
- [Eligible schemes](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/eligible_schemes.py): `app_pages/eligible_schemes.py`
- [Processed schemes](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/data/processed/schemes_processed.csv): `data/processed/schemes_processed.csv`

### Multilingual Q&A

- [Ask JanMitra](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/ask_language.py): `app_pages/ask_language.py`
- [Intent classifier](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/models/intent_classifier.pkl): `models/intent_classifier.pkl`
- [Intent responses](https://github.com/veeresh-math/janmitra-ai-scheme-assistant/blob/master/app_pages/ask_language.py): `app_pages/ask_language.py`

### Other components

- **Citizen**
- **Government portal**

## Connections

- Citizen → Streamlit app: uses (evidence: `README.md`)
- Streamlit app → Profile input: offers profile (evidence: `README.md`)
- Profile input → Eligibility score: calculates score (evidence: `app_pages/citizen_input.py`)
- Profile input → Scheme recommender: recommends schemes (evidence: `README.md`)
- Profile input → Eligible schemes: routes to (evidence: `app_pages/citizen_input.py`)
- Eligible schemes → Processed schemes: displays scheme details
- Eligible schemes → Government portal: links to apply (evidence: `README.md`)
- Streamlit app → Ask JanMitra: offers Q&A (evidence: `README.md`)
- Citizen → Ask JanMitra: asks query (evidence: `README.md`)
- Ask JanMitra → Intent classifier: classifies query (evidence: `app_pages/ask_language.py`)
- Ask JanMitra → Intent responses: renders answer (evidence: `app_pages/ask_language.py`)
