# ram200509/weather-mapreduce architecture

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

- Interactive diagram: https://gitdiagram.com/ram200509/weather-mapreduce
- Repository: https://github.com/ram200509/weather-mapreduce

## Overview

This project generates synthetic daily weather records, computes city/year temperatures through a local mapper–sort–reducer job, and computes rainfall, summer-temperature, and heat analytics. The Streamlit dashboard reads the dataset and generated CSVs, displays city-focused trends and metrics, and fits a per-city linear regression for 2027. The README documents these capabilities; source excerpts show the Python MapReduce and extra-analytics implementations, while Spark is described as optional/unused. Edges reflect only relationships visible in the excerpts or README.

Main entry points: [`dashboard/app.py`](https://github.com/ram200509/weather-mapreduce/blob/main/dashboard/app.py) (Streamlit dashboard), [`mapreduce/run_jobs.py`](https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/run_jobs.py) (Job runner), [`mapreduce/spark_jobs.py`](https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/spark_jobs.py) (Spark analytics), [`data/weather_data.csv`](https://github.com/ram200509/weather-mapreduce/blob/main/data/weather_data.csv) (Weather records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Weather data"]
  node_generator["Synthetic generator"]
  node_weather_csv["Weather records<br/>[weather_data.csv]"]
end

subgraph group_processing["Analytics processing"]
  node_runner["Job runner<br/>[run_jobs.py]"]
  node_mapper["City-year mapper<br/>[mapper.py]"]
  node_sort["Shuffle and sort"]
  node_reducer["Temperature reducer<br/>[reducer.py]"]
  node_extra["Extra analytics<br/>[extra_jobs.py]"]
  node_spark["Spark analytics<br/>[spark_jobs.py]"]
end

subgraph group_results["Analytics results"]
  node_yearly["Yearly averages"]
  node_rainfall["Monthly rainfall"]
  node_summer["Summer temperatures"]
  node_heat["Extreme heat counts"]
end

subgraph group_presentation["Dashboard"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_forecast["2027 regression forecast<br/>[app.py]"]
end

node_user(("Dashboard user"))

node_generator -->|"writes records"| node_weather_csv
node_runner -->|"invokes"| node_mapper
node_runner -->|"pipes through"| node_sort
node_runner -->|"invokes"| node_reducer
node_runner -->|"reads input"| node_weather_csv
node_runner -->|"writes averages"| node_yearly
node_mapper -->|"emits keyed rows"| node_sort
node_sort -->|"groups keys"| node_reducer
node_reducer -->|"produces averages"| node_yearly
node_extra -->|"reads records"| node_weather_csv
node_extra -->|"writes totals"| node_rainfall
node_extra -->|"writes averages"| node_summer
node_extra -->|"writes counts"| node_heat
node_spark -->|"reads records"| node_weather_csv
node_spark -->|"writes averages"| node_yearly
node_spark -->|"writes totals"| node_rainfall
node_spark -->|"writes averages"| node_summer
node_spark -->|"writes counts"| node_heat
node_user -->|"views"| node_dashboard
node_dashboard -->|"reads records"| node_weather_csv
node_dashboard -->|"reads averages"| node_yearly
node_dashboard -->|"reads rainfall"| node_rainfall
node_dashboard -->|"reads summer data"| node_summer
node_dashboard -->|"reads heat counts"| node_heat
node_dashboard -->|"fits model"| node_forecast

click node_generator "https://github.com/ram200509/weather-mapreduce/blob/main/data/generate_weather_data.py"
click node_weather_csv "https://github.com/ram200509/weather-mapreduce/blob/main/data/weather_data.csv"
click node_runner "https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/run_jobs.py"
click node_mapper "https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/mapper.py"
click node_reducer "https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/reducer.py"
click node_extra "https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/extra_jobs.py"
click node_spark "https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/spark_jobs.py"
click node_yearly "https://github.com/ram200509/weather-mapreduce/blob/main/output/avg_temp_city_year.csv"
click node_rainfall "https://github.com/ram200509/weather-mapreduce/blob/main/output/rainfall_city_month.csv"
click node_summer "https://github.com/ram200509/weather-mapreduce/blob/main/output/summer_temp_city.csv"
click node_heat "https://github.com/ram200509/weather-mapreduce/blob/main/output/extreme_heat_days.csv"
click node_dashboard "https://github.com/ram200509/weather-mapreduce/blob/main/dashboard/app.py"
click node_forecast "https://github.com/ram200509/weather-mapreduce/blob/main/dashboard/app.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_generator,node_weather_csv,node_user toneBlue
class node_runner,node_mapper,node_sort,node_reducer,node_extra,node_spark toneAmber
class node_yearly,node_rainfall,node_summer,node_heat toneMint
class node_dashboard,node_forecast toneRose
```

## Components

### Weather data

- [Synthetic generator](https://github.com/ram200509/weather-mapreduce/blob/main/data/generate_weather_data.py): `data/generate_weather_data.py`
- [Weather records](https://github.com/ram200509/weather-mapreduce/blob/main/data/weather_data.csv): `data/weather_data.csv`

### Analytics processing

- [Job runner](https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/run_jobs.py): `mapreduce/run_jobs.py`
- [City-year mapper](https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/mapper.py): `mapreduce/mapper.py`
- **Shuffle and sort**
- [Temperature reducer](https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/reducer.py): `mapreduce/reducer.py`
- [Extra analytics](https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/extra_jobs.py): `mapreduce/extra_jobs.py`
- [Spark analytics](https://github.com/ram200509/weather-mapreduce/blob/main/mapreduce/spark_jobs.py): `mapreduce/spark_jobs.py`

### Analytics results

- [Yearly averages](https://github.com/ram200509/weather-mapreduce/blob/main/output/avg_temp_city_year.csv): `output/avg_temp_city_year.csv`
- [Monthly rainfall](https://github.com/ram200509/weather-mapreduce/blob/main/output/rainfall_city_month.csv): `output/rainfall_city_month.csv`
- [Summer temperatures](https://github.com/ram200509/weather-mapreduce/blob/main/output/summer_temp_city.csv): `output/summer_temp_city.csv`
- [Extreme heat counts](https://github.com/ram200509/weather-mapreduce/blob/main/output/extreme_heat_days.csv): `output/extreme_heat_days.csv`

### Dashboard

- [Streamlit dashboard](https://github.com/ram200509/weather-mapreduce/blob/main/dashboard/app.py): `dashboard/app.py`
- [2027 regression forecast](https://github.com/ram200509/weather-mapreduce/blob/main/dashboard/app.py): `dashboard/app.py`

### Other components

- **Dashboard user**

## Connections

- Synthetic generator → Weather records: writes records (evidence: `data/generate_weather_data.py`)
- Job runner → City-year mapper: invokes (evidence: `mapreduce/run_jobs.py`)
- Job runner → Shuffle and sort: pipes through (evidence: `mapreduce/run_jobs.py`)
- Job runner → Temperature reducer: invokes (evidence: `mapreduce/run_jobs.py`)
- Job runner → Weather records: reads input (evidence: `mapreduce/run_jobs.py`)
- Job runner → Yearly averages: writes averages (evidence: `mapreduce/run_jobs.py`)
- City-year mapper → Shuffle and sort: emits keyed rows (evidence: `README.md`)
- Shuffle and sort → Temperature reducer: groups keys (evidence: `README.md`)
- Temperature reducer → Yearly averages: produces averages (evidence: `README.md`)
- Extra analytics → Weather records: reads records (evidence: `mapreduce/extra_jobs.py`)
- Extra analytics → Monthly rainfall: writes totals (evidence: `mapreduce/extra_jobs.py`)
- Extra analytics → Summer temperatures: writes averages (evidence: `mapreduce/extra_jobs.py`)
- Extra analytics → Extreme heat counts: writes counts (evidence: `mapreduce/extra_jobs.py`)
- Spark analytics → Weather records: reads records (evidence: `mapreduce/spark_jobs.py`)
- Spark analytics → Yearly averages: writes averages (evidence: `mapreduce/spark_jobs.py`)
- Spark analytics → Monthly rainfall: writes totals (evidence: `mapreduce/spark_jobs.py`)
- Spark analytics → Summer temperatures: writes averages (evidence: `mapreduce/spark_jobs.py`)
- Spark analytics → Extreme heat counts: writes counts (evidence: `mapreduce/spark_jobs.py`)
- Dashboard user → Streamlit dashboard: views (evidence: `README.md`)
- Streamlit dashboard → Weather records: reads records (evidence: `dashboard/app.py`)
- Streamlit dashboard → Yearly averages: reads averages (evidence: `dashboard/app.py`)
- Streamlit dashboard → Monthly rainfall: reads rainfall (evidence: `dashboard/app.py`)
- Streamlit dashboard → Summer temperatures: reads summer data (evidence: `dashboard/app.py`)
- Streamlit dashboard → Extreme heat counts: reads heat counts (evidence: `dashboard/app.py`)
- Streamlit dashboard → 2027 regression forecast: fits model (evidence: `dashboard/app.py`)
