# ruthwikreddy14/sih26069-weather-analytics architecture

> Architecture diagram of the GitHub repository ruthwikreddy14/sih26069-weather-analytics, 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/ruthwikreddy14/sih26069-weather-analytics
- Repository: https://github.com/ruthwikreddy14/sih26069-weather-analytics

## Overview

This repository is a weather-event reporting and analytics platform: reports are submitted and stored, verification signals assess their credibility, and reports can be clustered into events for risk assessment and alerts. Its frontend includes public reporting, dashboard, and authority views. The backend route-registration and core report, clustering, risk, and verification relationships are supported by excerpts or the source index. Frontend-to-backend wiring and several unsampled capabilities are not visible in the supplied evidence, so those connections are omitted.

Main entry points: [`backend/app/api/__init__.py`](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/__init__.py) (API router), [`backend/app/ml/pipeline.py`](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/pipeline.py) (Verification pipeline), [`backend/app/api/events.py`](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/events.py) (Event clusters API), [`backend/app/core/database.py`](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/core/database.py) (Database sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_app["FastAPI application<br/>[main.py]"]
  node_api_router["API router<br/>[__init__.py]"]
  node_settings["Configuration<br/>[config.py]"]
  node_database["Database sessions<br/>[database.py]"]
  node_redis["Redis client<br/>[redis_client.py]"]
end

subgraph group_reporting["Reports and verification"]
  node_reports_api["Report submission and retrieval<br/>[reports.py]"]
  node_report_model[("Weather report records<br/>[weather_report.py]")]
  node_verification_pipeline["Verification pipeline<br/>[pipeline.py]"]
  node_weather_verifier["Weather verification<br/>[verifier.py]"]
  node_image_hash["Image deduplication<br/>[image_hash.py]"]
  node_text_dedup["Text deduplication<br/>[deduplicator.py]"]
  node_location_verifier["Location verification"]
  node_confidence["Confidence scoring<br/>[confidence.py]"]
end

subgraph group_analytics["Event analytics"]
  node_events_api["Event clusters API<br/>[events.py]"]
  node_clustering["Event clustering"]
  node_analytics_api["Analytics API<br/>[analytics.py]"]
  node_risk_api["Risk assessment API<br/>[risk.py]"]
  node_risk_engine["Risk detection<br/>[risk_detection.py]"]
end

subgraph group_operations["Alerts and operations"]
  node_alerts_api["Alerts API<br/>[alerts.py]"]
  node_alerts_service["Alert services<br/>[alerts.py]"]
  node_health_api["Health API<br/>[health.py]"]
end

subgraph group_frontend["Web interface"]
  node_submit_page["Submit report page<br/>[page.tsx]"]
  node_dashboard_page["Dashboard page<br/>[page.tsx]"]
  node_authority_page["Authority page<br/>[page.tsx]"]
  node_api_client["Frontend API client<br/>[api.ts]"]
  node_reports_list["Reports list<br/>[ReportsList.tsx]"]
  node_weather_map["Weather map<br/>[WeatherMap.tsx]"]
  node_alerts_view["Active alerts<br/>[ActiveAlerts.tsx]"]
  node_risk_view["High-risk events<br/>[HighRiskEvents.tsx]"]
  node_weather_events["Weather events<br/>[WeatherEvents.tsx]"]
  node_filter_panel["Filter panel<br/>[FilterPanel.tsx]"]
  node_stat_cards["Statistics cards<br/>[StatCards.tsx]"]
end

node_citizen(("Citizen"))
node_authority_user(("Authority user"))

node_app -->|"reads settings"| node_settings
node_app -->|"initializes database"| node_database
node_app -->|"connects Redis"| node_redis
node_app -->|"registers routes"| node_api_router
node_api_router -->|"registers"| node_reports_api
node_api_router -->|"registers"| node_events_api
node_api_router -->|"registers"| node_risk_api
node_api_router -->|"registers"| node_alerts_api
node_api_router -->|"registers"| node_analytics_api
node_api_router -->|"registers"| node_health_api
node_reports_api -->|"uses sessions"| node_database
node_reports_api -->|"queries and saves"| node_report_model
node_reports_api -->|"triggers verification"| node_verification_pipeline
node_database -->|"maps records"| node_report_model
node_verification_pipeline -->|"loads report"| node_report_model
node_verification_pipeline -->|"checks weather"| node_weather_verifier
node_verification_pipeline -->|"checks images"| node_image_hash
node_verification_pipeline -->|"checks duplicates"| node_text_dedup
node_verification_pipeline -->|"checks location"| node_location_verifier
node_verification_pipeline -->|"scores signals"| node_confidence
node_weather_verifier -->|"caches weather"| node_redis
node_weather_verifier -->|"reads API key"| node_settings
node_events_api -->|"queries reports"| node_database
node_events_api -->|"reads report fields"| node_report_model
node_events_api -->|"clusters reports"| node_clustering
node_risk_api -->|"gets clusters"| node_events_api
node_risk_api -->|"assesses events"| node_risk_engine
node_alerts_api -->|"uses sessions"| node_database
node_alerts_api -->|"uses alert service"| node_alerts_service
node_alerts_api -->|"references risk API"| node_risk_api
node_citizen -.->|"submits report"| node_submit_page
node_authority_user -.->|"reviews events"| node_authority_page
node_dashboard_page -.->|"loads data"| node_api_client

click node_app "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/main.py"
click node_api_router "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/__init__.py"
click node_settings "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/core/config.py"
click node_database "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/core/database.py"
click node_redis "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/core/redis_client.py"
click node_reports_api "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/reports.py"
click node_report_model "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/models/weather_report.py"
click node_verification_pipeline "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/pipeline.py"
click node_weather_verifier "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/verifier.py"
click node_image_hash "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/image_hash.py"
click node_text_dedup "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/deduplicator.py"
click node_location_verifier "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/location_verifier.py"
click node_confidence "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/confidence.py"
click node_events_api "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/events.py"
click node_clustering "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/event_clustering.py"
click node_analytics_api "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/analytics.py"
click node_risk_api "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/risk.py"
click node_risk_engine "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/risk_detection.py"
click node_alerts_api "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/alerts.py"
click node_alerts_service "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/services/alerts.py"
click node_health_api "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/health.py"
click node_submit_page "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/app/submit/page.tsx"
click node_dashboard_page "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/app/page.tsx"
click node_authority_page "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/app/authority/page.tsx"
click node_api_client "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/lib/api.ts"
click node_reports_list "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/ReportsList.tsx"
click node_weather_map "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/WeatherMap.tsx"
click node_alerts_view "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/ActiveAlerts.tsx"
click node_risk_view "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/HighRiskEvents.tsx"
click node_weather_events "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/WeatherEvents.tsx"
click node_filter_panel "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/FilterPanel.tsx"
click node_stat_cards "https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/StatCards.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_app,node_api_router,node_settings,node_database,node_redis,node_authority_user toneBlue
class node_reports_api,node_report_model,node_verification_pipeline,node_weather_verifier,node_image_hash,node_text_dedup,node_location_verifier,node_confidence toneAmber
class node_events_api,node_clustering,node_analytics_api,node_risk_api,node_risk_engine toneMint
class node_alerts_api,node_alerts_service,node_health_api toneRose
class node_submit_page,node_dashboard_page,node_authority_page,node_api_client,node_reports_list,node_weather_map,node_alerts_view,node_risk_view,node_weather_events,node_filter_panel,node_stat_cards,node_citizen toneIndigo
```

## Components

### Application entry

- [FastAPI application](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/main.py): `backend/app/main.py`
- [API router](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/__init__.py): `backend/app/api/__init__.py`
- [Configuration](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/core/config.py): `backend/app/core/config.py`
- [Database sessions](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Redis client](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/core/redis_client.py): `backend/app/core/redis_client.py`

### Reports and verification

- [Report submission and retrieval](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/reports.py): `backend/app/api/reports.py`
- [Weather report records](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/models/weather_report.py): `backend/app/models/weather_report.py`
- [Verification pipeline](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/pipeline.py): `backend/app/ml/pipeline.py`
- [Weather verification](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/verifier.py): `backend/app/ml/verifier.py`
- [Image deduplication](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/image_hash.py): `backend/app/ml/image_hash.py`
- [Text deduplication](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/deduplicator.py): `backend/app/ml/deduplicator.py`
- [Location verification](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/location_verifier.py): `backend/app/ml/location_verifier.py`
- [Confidence scoring](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/confidence.py): `backend/app/ml/confidence.py`

### Event analytics

- [Event clusters API](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/events.py): `backend/app/api/events.py`
- [Event clustering](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/event_clustering.py): `backend/app/ml/event_clustering.py`
- [Analytics API](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/analytics.py): `backend/app/api/analytics.py`
- [Risk assessment API](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/risk.py): `backend/app/api/risk.py`
- [Risk detection](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/ml/risk_detection.py): `backend/app/ml/risk_detection.py`

### Alerts and operations

- [Alerts API](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/alerts.py): `backend/app/api/alerts.py`
- [Alert services](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/services/alerts.py): `backend/app/services/alerts.py`
- [Health API](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/backend/app/api/health.py): `backend/app/api/health.py`

### Web interface

- [Submit report page](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/app/submit/page.tsx): `frontend/app/submit/page.tsx`
- [Dashboard page](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Authority page](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/app/authority/page.tsx): `frontend/app/authority/page.tsx`
- [Frontend API client](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`
- [Reports list](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/ReportsList.tsx): `frontend/components/ReportsList.tsx`
- [Weather map](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/WeatherMap.tsx): `frontend/components/WeatherMap.tsx`
- [Active alerts](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/ActiveAlerts.tsx): `frontend/components/ActiveAlerts.tsx`
- [High-risk events](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/HighRiskEvents.tsx): `frontend/components/HighRiskEvents.tsx`
- [Weather events](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/WeatherEvents.tsx): `frontend/components/WeatherEvents.tsx`
- [Filter panel](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/FilterPanel.tsx): `frontend/components/FilterPanel.tsx`
- [Statistics cards](https://github.com/ruthwikreddy14/sih26069-weather-analytics/blob/main/frontend/components/StatCards.tsx): `frontend/components/StatCards.tsx`

### Other components

- **Citizen**
- **Authority user**

## Connections

- FastAPI application → Configuration: reads settings (evidence: `backend/app/main.py`)
- FastAPI application → Database sessions: initializes database (evidence: `backend/app/main.py`)
- FastAPI application → Redis client: connects Redis (evidence: `backend/app/main.py`)
- FastAPI application → API router: registers routes (evidence: `backend/app/main.py`)
- API router → Report submission and retrieval: registers (evidence: `backend/app/api/__init__.py`)
- API router → Event clusters API: registers (evidence: `backend/app/api/__init__.py`)
- API router → Risk assessment API: registers (evidence: `backend/app/api/__init__.py`)
- API router → Alerts API: registers (evidence: `backend/app/api/__init__.py`)
- API router → Analytics API: registers (evidence: `backend/app/api/__init__.py`)
- API router → Health API: registers (evidence: `backend/app/api/__init__.py`)
- Report submission and retrieval → Database sessions: uses sessions (evidence: `backend/app/api/reports.py`)
- Report submission and retrieval → Weather report records: queries and saves (evidence: `backend/app/api/reports.py`)
- Report submission and retrieval → Verification pipeline: triggers verification (evidence: `backend/app/api/reports.py`)
- Database sessions → Weather report records: maps records (evidence: `backend/app/core/database.py`)
- Verification pipeline → Weather report records: loads report (evidence: `backend/app/ml/pipeline.py`)
- Verification pipeline → Weather verification: checks weather (evidence: `backend/app/ml/pipeline.py`)
- Verification pipeline → Image deduplication: checks images (evidence: `backend/app/ml/pipeline.py`)
- Verification pipeline → Text deduplication: checks duplicates (evidence: `backend/app/ml/pipeline.py`)
- Verification pipeline → Location verification: checks location (evidence: `backend/app/ml/pipeline.py`)
- Verification pipeline → Confidence scoring: scores signals (evidence: `backend/app/ml/pipeline.py`)
- Weather verification → Redis client: caches weather (evidence: `backend/app/ml/verifier.py`)
- Weather verification → Configuration: reads API key (evidence: `backend/app/ml/verifier.py`)
- Event clusters API → Database sessions: queries reports (evidence: `backend/app/api/events.py`)
- Event clusters API → Weather report records: reads report fields (evidence: `backend/app/api/events.py`)
- Event clusters API → Event clustering: clusters reports (evidence: `backend/app/api/events.py`)
- Risk assessment API → Event clusters API: gets clusters (evidence: `backend/app/api/risk.py`)
- Risk assessment API → Risk detection: assesses events (evidence: `backend/app/api/risk.py`)
- Alerts API → Database sessions: uses sessions (evidence: `backend/app/api/alerts.py`)
- Alerts API → Alert services: uses alert service (evidence: `backend/app/api/alerts.py`)
- Alerts API → Risk assessment API: references risk API (evidence: `backend/app/api/alerts.py`)
- Citizen → Submit report page: submits report
- Authority user → Authority page: reviews events
- Dashboard page → Frontend API client: loads data
