# srujan111-max/sih26076-mausam architecture

> Architecture diagram of the GitHub repository srujan111-max/sih26076-mausam, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srujan111-max/sih26076-mausam
- Repository: https://github.com/srujan111-max/sih26076-mausam

## Overview

Mausam turns a selected persona and location into weather guidance: the frontend gathers preferences, the Flask endpoint validates and stores them, the weather service fetches and normalizes provider data, then applies persona-specific recommendations and returns a homepage response. The README documents forecasts, air quality, traveller destinations, alerts and insights as product capabilities. Source evidence is strongest for the API boundary and SSR error handling; some weather-service internals and frontend routes were not sampled, so those relationships are documented or left unconnected rather than inferred.

Main entry points: [`weather_service.py`](https://github.com/srujan111-max/sih26076-mausam/blob/main/weather_service.py) (Weather service), [`app.py`](https://github.com/srujan111-max/sih26076-mausam/blob/main/app.py) (Personalization API), [`mausam-persona-builder-main/mausam-persona-builder-main/src/lib/mausam/data.ts`](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/lib/mausam/data.ts) (Persona and mock data), [`mausam-persona-builder-main/mausam-persona-builder-main/src/server.ts`](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/server.ts) (SSR request handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Personalized frontend"]
  node_dashboard["Weather dashboard<br/>[dashboard.tsx]"]
  node_preferences["Persona preferences"]
  node_frontend_api["Backend client<br/>[api.ts]"]
  node_alerts["Weather alerts<br/>[alerts.tsx]"]
  node_insights["Weather insights<br/>[insights.tsx]"]
  node_mockdata["Persona and mock data<br/>[data.ts]"]
end

subgraph group_api["Backend API"]
  node_flask["Personalization API<br/>[app.py]"]
end

subgraph group_weather["Weather processing"]
  node_weather_service["Weather service<br/>[weather_service.py]"]
  node_geocoding["Location geocoding<br/>[weather_service.py]"]
  node_weather_fetch["Forecast and air quality<br/>[weather_service.py]"]
  node_persona_logic["Persona guidance<br/>[weather_service.py]"]
end

subgraph group_state["Preference storage"]
  node_sqlite[("SQLite preferences<br/>[database.py]")]
end

subgraph group_ssr["SSR error handling"]
  node_ssr_server["SSR request handler<br/>[server.ts]"]
  node_error_capture["Error capture<br/>[error-capture.ts]"]
  node_error_page["Fallback error page<br/>[error-page.ts]"]
end

node_user(("Weather user"))
node_openmeteo["Open-Meteo APIs"]

node_user -.->|"sets preferences"| node_preferences
node_user -.->|"views guidance"| node_dashboard
node_dashboard -->|"requests data"| node_frontend_api
node_frontend_api -.->|"POST personalization"| node_flask
node_flask -->|"saves selection"| node_sqlite
node_flask -->|"requests homepage"| node_weather_service
node_weather_service -.->|"resolves locations"| node_geocoding
node_weather_service -.->|"fetches conditions"| node_weather_fetch
node_weather_service -.->|"builds guidance"| node_persona_logic
node_geocoding -.->|"queries geocoding"| node_openmeteo
node_weather_fetch -.->|"fetches weather"| node_openmeteo
node_persona_logic -.->|"returns homepage data"| node_flask
node_preferences -.->|"uses role definitions"| node_mockdata
node_alerts -.->|"presents alert content"| node_mockdata
node_insights -.->|"presents insight content"| node_mockdata
node_ssr_server -->|"captures errors"| node_error_capture
node_ssr_server -->|"renders fallback"| node_error_page

click node_dashboard "https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/routes/dashboard.tsx"
click node_preferences "https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/routes/preferences.%24role.tsx"
click node_frontend_api "https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/lib/mausam/api.ts"
click node_alerts "https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/routes/alerts.tsx"
click node_insights "https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/routes/insights.tsx"
click node_mockdata "https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/lib/mausam/data.ts"
click node_flask "https://github.com/srujan111-max/sih26076-mausam/blob/main/app.py"
click node_weather_service "https://github.com/srujan111-max/sih26076-mausam/blob/main/weather_service.py"
click node_geocoding "https://github.com/srujan111-max/sih26076-mausam/blob/main/weather_service.py"
click node_weather_fetch "https://github.com/srujan111-max/sih26076-mausam/blob/main/weather_service.py"
click node_persona_logic "https://github.com/srujan111-max/sih26076-mausam/blob/main/weather_service.py"
click node_sqlite "https://github.com/srujan111-max/sih26076-mausam/blob/main/database.py"
click node_ssr_server "https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/server.ts"
click node_error_capture "https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/lib/error-capture.ts"
click node_error_page "https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/lib/error-page.ts"

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_preferences,node_frontend_api,node_alerts,node_insights,node_mockdata,node_user toneBlue
class node_flask toneAmber
class node_weather_service,node_geocoding,node_weather_fetch,node_persona_logic,node_openmeteo toneMint
class node_sqlite toneRose
class node_ssr_server,node_error_capture,node_error_page toneIndigo
```

## Components

### Personalized frontend

- [Weather dashboard](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/routes/dashboard.tsx): `mausam-persona-builder-main/mausam-persona-builder-main/src/routes/dashboard.tsx`
- [Persona preferences](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/routes/preferences.%24role.tsx): `mausam-persona-builder-main/mausam-persona-builder-main/src/routes/preferences.$role.tsx`
- [Backend client](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/lib/mausam/api.ts): `mausam-persona-builder-main/mausam-persona-builder-main/src/lib/mausam/api.ts`
- [Weather alerts](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/routes/alerts.tsx): `mausam-persona-builder-main/mausam-persona-builder-main/src/routes/alerts.tsx`
- [Weather insights](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/routes/insights.tsx): `mausam-persona-builder-main/mausam-persona-builder-main/src/routes/insights.tsx`
- [Persona and mock data](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/lib/mausam/data.ts): `mausam-persona-builder-main/mausam-persona-builder-main/src/lib/mausam/data.ts`

### Backend API

- [Personalization API](https://github.com/srujan111-max/sih26076-mausam/blob/main/app.py): `app.py`

### Weather processing

- [Weather service](https://github.com/srujan111-max/sih26076-mausam/blob/main/weather_service.py): `weather_service.py`
- [Location geocoding](https://github.com/srujan111-max/sih26076-mausam/blob/main/weather_service.py): `weather_service.py`
- [Forecast and air quality](https://github.com/srujan111-max/sih26076-mausam/blob/main/weather_service.py): `weather_service.py`
- [Persona guidance](https://github.com/srujan111-max/sih26076-mausam/blob/main/weather_service.py): `weather_service.py`

### Preference storage

- [SQLite preferences](https://github.com/srujan111-max/sih26076-mausam/blob/main/database.py): `database.py`

### SSR error handling

- [SSR request handler](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/server.ts): `mausam-persona-builder-main/mausam-persona-builder-main/src/server.ts`
- [Error capture](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/lib/error-capture.ts): `mausam-persona-builder-main/mausam-persona-builder-main/src/lib/error-capture.ts`
- [Fallback error page](https://github.com/srujan111-max/sih26076-mausam/blob/main/mausam-persona-builder-main/mausam-persona-builder-main/src/lib/error-page.ts): `mausam-persona-builder-main/mausam-persona-builder-main/src/lib/error-page.ts`

### Other components

- **Weather user**
- **Open-Meteo APIs**

## Connections

- Weather user → Persona preferences: sets preferences (evidence: `README.md`)
- Weather user → Weather dashboard: views guidance (evidence: `README.md`)
- Weather dashboard → Backend client: requests data (evidence: `mausam-persona-builder-main/mausam-persona-builder-main/src/routes/dashboard.tsx`)
- Backend client → Personalization API: POST personalization (evidence: `README.md`)
- Personalization API → SQLite preferences: saves selection (evidence: `app.py`)
- Personalization API → Weather service: requests homepage (evidence: `app.py`)
- Weather service → Location geocoding: resolves locations (evidence: `README.md`)
- Weather service → Forecast and air quality: fetches conditions (evidence: `README.md`)
- Weather service → Persona guidance: builds guidance (evidence: `README.md`)
- Location geocoding → Open-Meteo APIs: queries geocoding (evidence: `README.md`)
- Forecast and air quality → Open-Meteo APIs: fetches weather (evidence: `README.md`)
- Persona guidance → Personalization API: returns homepage data (evidence: `app.py`)
- Persona preferences → Persona and mock data: uses role definitions
- Weather alerts → Persona and mock data: presents alert content
- Weather insights → Persona and mock data: presents insight content
- SSR request handler → Error capture: captures errors (evidence: `mausam-persona-builder-main/mausam-persona-builder-main/src/server.ts`)
- SSR request handler → Fallback error page: renders fallback (evidence: `mausam-persona-builder-main/mausam-persona-builder-main/src/server.ts`)
