# soham-lodh/weather-analytics architecture

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

- Interactive diagram: https://gitdiagram.com/soham-lodh/weather-analytics
- Repository: https://github.com/soham-lodh/weather-analytics

## Overview

Aapda Drishti is a disaster-intelligence platform for India. People use the web app to inspect verified current alerts and nearby risks, research historical events, search across evidence, and submit incident reports; administrators also manage platform operations. The backend combines external and citizen evidence, maintains canonical events, supports lexical and semantic retrieval, and dispatches location-aware notifications. The README documents major capabilities whose individual handlers were not sampled; those links are attributed to the README rather than inferred from module names.

Main entry points: [`backend/server/db/supabase.ts`](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/db/supabase.ts) (Supabase data), [`frontend/src/lib/api.ts`](https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/lib/api.ts) (API client), [`frontend/src/App.tsx`](https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/App.tsx) (Application shell), [`backend/server/routes.ts`](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/routes.ts) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Application shell<br/>[App.tsx]"]
  node_present["Present workspace"]
  node_past["Past workspace<br/>[PastWorkspace.tsx]"]
  node_report["Incident reporting"]
  node_admin["Admin console<br/>[AdminPage.tsx]"]
end

subgraph group_api["API and identity"]
  node_client["API client<br/>[api.ts]"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_routes["API routes<br/>[routes.ts]"]
end

subgraph group_evidence["Evidence processing"]
  node_canonical["Canonical events<br/>[canonicalEvents.ts]"]
  node_ingest["Ingestion job<br/>[ingestionJob.ts]"]
  node_adapters["Source adapters<br/>[sourceAdapters.ts]"]
  node_normalize["Observation normalization"]
  node_source["Source registry<br/>[sourceRegistry.ts]"]
  node_verify["Report verification"]
end

subgraph group_research["Search and research"]
  node_research["Research orchestrator"]
  node_retrieval["Search retrieval<br/>[searchRetrieval.ts]"]
  node_ai["AI gateway<br/>[aiGateway.ts]"]
end

subgraph group_operations["Jobs and alerts"]
  node_scheduler["Job scheduler<br/>[scheduler.ts]"]
  node_notifications["Notification job<br/>[notificationJob.ts]"]
  node_providers["Delivery providers<br/>[notifications.ts]"]
end

node_people(("People"))
node_supabase[("Supabase data<br/>[supabase.ts]")]
node_external["Evidence providers"]
node_recipients(("Alert recipients"))

node_people -->|"uses"| node_app
node_app -->|"shows"| node_present
node_app -->|"shows"| node_past
node_app -->|"shows"| node_report
node_app -->|"shows"| node_admin
node_present -->|"requests data"| node_client
node_past -->|"requests research"| node_client
node_report -->|"submits reports"| node_client
node_admin -->|"calls API"| node_client
node_client -->|"calls"| node_routes
node_auth -->|"uses"| node_client
node_routes -->|"lists events"| node_canonical
node_routes -->|"delegates research"| node_research
node_routes -->|"calls AI"| node_ai
node_routes -->|"reads and writes"| node_supabase
node_ingest -->|"fetches observations"| node_adapters
node_ingest -->|"normalizes"| node_normalize
node_ingest -->|"resolves sources"| node_source
node_ingest -->|"updates events"| node_canonical
node_adapters -->|"fetches evidence"| node_external
node_source -->|"resolves IDs"| node_supabase
node_canonical -->|"persists events"| node_supabase
node_verify -->|"updates verification"| node_supabase
node_research -->|"searches evidence"| node_retrieval
node_research -->|"researches externally"| node_external
node_research -->|"persists findings"| node_supabase
node_retrieval -->|"queries and embeds"| node_supabase
node_scheduler -->|"runs"| node_ingest
node_scheduler -->|"runs"| node_notifications
node_scheduler -->|"records job runs"| node_supabase
node_notifications -->|"dispatches"| node_providers
node_notifications -->|"tracks delivery"| node_supabase
node_providers -->|"delivers alerts"| node_recipients

click node_app "https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/App.tsx"
click node_present "https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/components/present/PresentWorkspace.tsx"
click node_past "https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/components/past/PastWorkspace.tsx"
click node_report "https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/components/reports/ReportIncidentPage.tsx"
click node_admin "https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/components/admin/AdminPage.tsx"
click node_client "https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/lib/api.ts"
click node_auth "https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/lib/AuthContext.tsx"
click node_routes "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/routes.ts"
click node_canonical "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/repositories/canonicalEvents.ts"
click node_ingest "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/jobs/ingestionJob.ts"
click node_adapters "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/ingestion/sourceAdapters.ts"
click node_normalize "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/jobs/normalizationEngine.ts"
click node_source "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/lib/sourceRegistry.ts"
click node_verify "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/jobs/citizenVerificationJob.ts"
click node_research "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/lib/researchOrchestrator.ts"
click node_retrieval "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/lib/searchRetrieval.ts"
click node_ai "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/aiGateway.ts"
click node_scheduler "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/jobs/scheduler.ts"
click node_notifications "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/jobs/notificationJob.ts"
click node_providers "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/providers/notifications.ts"
click node_supabase "https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/db/supabase.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_app,node_present,node_past,node_report,node_admin toneBlue
class node_client,node_auth,node_routes,node_supabase toneAmber
class node_canonical,node_ingest,node_adapters,node_normalize,node_source,node_verify toneMint
class node_research,node_retrieval,node_ai toneRose
class node_scheduler,node_notifications,node_providers,node_people,node_external,node_recipients toneIndigo
```

## Components

### Web experience

- [Application shell](https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Present workspace](https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/components/present/PresentWorkspace.tsx): `frontend/src/components/present/PresentWorkspace.tsx`
- [Past workspace](https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/components/past/PastWorkspace.tsx): `frontend/src/components/past/PastWorkspace.tsx`
- [Incident reporting](https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/components/reports/ReportIncidentPage.tsx): `frontend/src/components/reports/ReportIncidentPage.tsx`
- [Admin console](https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/components/admin/AdminPage.tsx): `frontend/src/components/admin/AdminPage.tsx`

### API and identity

- [API client](https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Authentication](https://github.com/soham-lodh/weather-analytics/blob/master/frontend/src/lib/AuthContext.tsx): `frontend/src/lib/AuthContext.tsx`
- [API routes](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/routes.ts): `backend/server/routes.ts`

### Evidence processing

- [Canonical events](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/repositories/canonicalEvents.ts): `backend/server/repositories/canonicalEvents.ts`
- [Ingestion job](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/jobs/ingestionJob.ts): `backend/server/jobs/ingestionJob.ts`
- [Source adapters](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/ingestion/sourceAdapters.ts): `backend/server/ingestion/sourceAdapters.ts`
- [Observation normalization](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/jobs/normalizationEngine.ts): `backend/server/jobs/normalizationEngine.ts`
- [Source registry](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/lib/sourceRegistry.ts): `backend/server/lib/sourceRegistry.ts`
- [Report verification](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/jobs/citizenVerificationJob.ts): `backend/server/jobs/citizenVerificationJob.ts`

### Search and research

- [Research orchestrator](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/lib/researchOrchestrator.ts): `backend/server/lib/researchOrchestrator.ts`
- [Search retrieval](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/lib/searchRetrieval.ts): `backend/server/lib/searchRetrieval.ts`
- [AI gateway](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/aiGateway.ts): `backend/server/aiGateway.ts`

### Jobs and alerts

- [Job scheduler](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/jobs/scheduler.ts): `backend/server/jobs/scheduler.ts`
- [Notification job](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/jobs/notificationJob.ts): `backend/server/jobs/notificationJob.ts`
- [Delivery providers](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/providers/notifications.ts): `backend/server/providers/notifications.ts`

### Other components

- **People**
- [Supabase data](https://github.com/soham-lodh/weather-analytics/blob/master/backend/server/db/supabase.ts): `backend/server/db/supabase.ts`
- **Evidence providers**
- **Alert recipients**

## Connections

- People → Application shell: uses (evidence: `frontend/src/App.tsx`)
- Application shell → Present workspace: shows (evidence: `frontend/src/App.tsx`)
- Application shell → Past workspace: shows (evidence: `frontend/src/App.tsx`)
- Application shell → Incident reporting: shows (evidence: `frontend/src/App.tsx`)
- Application shell → Admin console: shows (evidence: `frontend/src/App.tsx`)
- Present workspace → API client: requests data (evidence: `README.md`)
- Past workspace → API client: requests research (evidence: `README.md`)
- Incident reporting → API client: submits reports (evidence: `README.md`)
- Admin console → API client: calls API (evidence: `frontend/src/components/admin/AdminPage.tsx`)
- API client → API routes: calls (evidence: `README.md`)
- Authentication → API client: uses (evidence: `frontend/src/lib/AuthContext.tsx`)
- API routes → Canonical events: lists events (evidence: `backend/server/routes.ts`)
- API routes → Research orchestrator: delegates research (evidence: `backend/server/routes.ts`)
- API routes → AI gateway: calls AI (evidence: `backend/server/routes.ts`)
- API routes → Supabase data: reads and writes (evidence: `backend/server/routes.ts`)
- Ingestion job → Source adapters: fetches observations (evidence: `backend/server/jobs/ingestionJob.ts`)
- Ingestion job → Observation normalization: normalizes (evidence: `backend/server/jobs/normalizationEngine.ts`)
- Ingestion job → Source registry: resolves sources (evidence: `backend/server/jobs/ingestionJob.ts`)
- Ingestion job → Canonical events: updates events (evidence: `README.md`)
- Source adapters → Evidence providers: fetches evidence (evidence: `README.md`)
- Source registry → Supabase data: resolves IDs (evidence: `backend/server/lib/sourceRegistry.ts`)
- Canonical events → Supabase data: persists events (evidence: `backend/server/repositories/canonicalEvents.ts`)
- Report verification → Supabase data: updates verification (evidence: `README.md`)
- Research orchestrator → Search retrieval: searches evidence (evidence: `backend/server/lib/researchOrchestrator.ts`)
- Research orchestrator → Evidence providers: researches externally (evidence: `README.md`)
- Research orchestrator → Supabase data: persists findings (evidence: `backend/server/lib/researchOrchestrator.ts`)
- Search retrieval → Supabase data: queries and embeds (evidence: `backend/server/lib/searchRetrieval.ts`)
- Job scheduler → Ingestion job: runs (evidence: `backend/server/jobs/scheduler.ts`)
- Job scheduler → Notification job: runs (evidence: `backend/server/jobs/scheduler.ts`)
- Job scheduler → Supabase data: records job runs (evidence: `backend/server/jobs/scheduler.ts`)
- Notification job → Delivery providers: dispatches (evidence: `README.md`)
- Notification job → Supabase data: tracks delivery (evidence: `README.md`)
- Delivery providers → Alert recipients: delivers alerts (evidence: `README.md`)
