# nikunjbhutada184-sketch/msme-analyzer architecture

> Architecture diagram of the GitHub repository nikunjbhutada184-sketch/msme-analyzer, 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/nikunjbhutada184-sketch/msme-analyzer
- Repository: https://github.com/nikunjbhutada184-sketch/msme-analyzer

## Overview

MSME Analyzer turns a business idea into Maharashtra district-level competition results. A user submits a query in the React dashboard; the FastAPI endpoint delegates matching to a TF-IDF matcher, which aggregates matching registrations by district and returns summaries and descriptions for display. A separate preprocessing step extracts business descriptions from CSV data and caches them as Parquet for the matcher. The repository also contains a Leaflet map component, but the sampled dashboard does not import it, so its integration is not shown. Edges reflect sampled calls or documented data handling.

Main entry points: [`backend/matcher.py`](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/matcher.py) (MSME matcher), [`frontend/src/components/Dashboard.tsx`](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/frontend/src/components/Dashboard.tsx) (Search dashboard), [`backend/main.py`](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/main.py) (Analysis API), [`backend/data_processor.py`](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/data_processor.py) (Dataset preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Analysis interface"]
  node_dashboard["Search dashboard<br/>[Dashboard.tsx]"]
  node_app["App shell<br/>[App.tsx]"]
  node_map_chart["Competition map<br/>[MapChart.tsx]"]
end

subgraph group_api["API layer"]
  node_api_service["Analysis API<br/>[main.py]"]
end

subgraph group_analysis["Matching and analysis"]
  node_matcher["MSME matcher<br/>[matcher.py]"]
  node_similarity["TF-IDF matching<br/>[matcher.py]"]
  node_district_analysis["District aggregation<br/>[matcher.py]"]
end

subgraph group_data["Data preparation"]
  node_data_processor["Dataset preprocessing<br/>[data_processor.py]"]
  node_parquet_cache[("Processed data cache<br/>[matcher.py]")]
end

node_business_user(("Business user"))
node_csv_dataset["MSME CSV dataset"]
node_map_tiles["CARTO map tiles"]

node_business_user -->|"enters query"| node_dashboard
node_app -->|"renders"| node_dashboard
node_dashboard -->|"requests analysis"| node_api_service
node_api_service -->|"calls match"| node_matcher
node_api_service -->|"loads data"| node_matcher
node_matcher -->|"computes similarity"| node_similarity
node_matcher -->|"aggregates matches"| node_district_analysis
node_dashboard -->|"receives results"| node_api_service
node_csv_dataset -->|"provides source data"| node_data_processor
node_data_processor -->|"writes cache"| node_parquet_cache
node_parquet_cache -->|"loads cached data"| node_matcher
node_map_chart -->|"loads tiles"| node_map_tiles

click node_dashboard "https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/frontend/src/components/Dashboard.tsx"
click node_app "https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/frontend/src/App.tsx"
click node_api_service "https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/main.py"
click node_matcher "https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/matcher.py"
click node_similarity "https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/matcher.py"
click node_district_analysis "https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/matcher.py"
click node_data_processor "https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/data_processor.py"
click node_parquet_cache "https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/matcher.py"
click node_map_chart "https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/frontend/src/components/MapChart.tsx"

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_dashboard,node_app,node_map_chart,node_business_user toneBlue
class node_api_service toneAmber
class node_matcher,node_similarity,node_district_analysis toneMint
class node_data_processor,node_parquet_cache toneRose
class node_csv_dataset,node_map_tiles toneIndigo
```

## Components

### Analysis interface

- [Search dashboard](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/frontend/src/components/Dashboard.tsx): `frontend/src/components/Dashboard.tsx`
- [App shell](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Competition map](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/frontend/src/components/MapChart.tsx): `frontend/src/components/MapChart.tsx`

### API layer

- [Analysis API](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/main.py): `backend/main.py`

### Matching and analysis

- [MSME matcher](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/matcher.py): `backend/matcher.py`
- [TF-IDF matching](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/matcher.py): `backend/matcher.py`
- [District aggregation](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/matcher.py): `backend/matcher.py`

### Data preparation

- [Dataset preprocessing](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/data_processor.py): `backend/data_processor.py`
- [Processed data cache](https://github.com/nikunjbhutada184-sketch/msme-analyzer/blob/main/backend/matcher.py): `backend/matcher.py`

### Other components

- **Business user**
- **MSME CSV dataset**
- **CARTO map tiles**

## Connections

- Business user → Search dashboard: enters query (evidence: `frontend/src/components/Dashboard.tsx`)
- App shell → Search dashboard: renders (evidence: `frontend/src/App.tsx`)
- Search dashboard → Analysis API: requests analysis (evidence: `frontend/src/components/Dashboard.tsx`)
- Analysis API → MSME matcher: calls match (evidence: `backend/main.py`)
- Analysis API → MSME matcher: loads data (evidence: `backend/main.py`)
- MSME matcher → TF-IDF matching: computes similarity (evidence: `backend/matcher.py`)
- MSME matcher → District aggregation: aggregates matches (evidence: `backend/matcher.py`)
- Search dashboard → Analysis API: receives results (evidence: `frontend/src/components/Dashboard.tsx`)
- MSME CSV dataset → Dataset preprocessing: provides source data (evidence: `README.md`)
- Dataset preprocessing → Processed data cache: writes cache (evidence: `backend/data_processor.py`)
- Processed data cache → MSME matcher: loads cached data (evidence: `backend/matcher.py`)
- Competition map → CARTO map tiles: loads tiles (evidence: `frontend/src/components/MapChart.tsx`)
