Technologies Used

Python OpenWeatherMap API Pandas GitHub Actions

Automated Weather Tracker Dashboard with OpenWeatherMap API, GitHub Actions, and Interactive Visualizations

Weather Tracker is a lightweight but practical automation project I built to fetch, store, and visualize real-time weather data for a chosen location. The focus was to make the system fully hands-free β€” from collecting daily weather metrics to keeping a clean historical dataset that can be visualized as trends over time.

The pipeline pulls live data from the OpenWeatherMap API (temperature, humidity, and weather description), stores it in a version-controlled CSV (daily_weather.csv), and keeps the dataset updated daily using GitHub Actions. On top of the data pipeline, the dashboard visualizes trends using interactive line charts (Chart.js), making it easy to quickly understand how weather patterns change across days.


Key Features

  • Real-time weather metrics (temperature, humidity, description)
  • Daily data persistence into a historical CSV dataset
  • Fully automated daily runs using GitHub Actions (no manual refresh)
  • Interactive trend charts for temperature and humidity using Chart.js
  • Secure API key handling using environment variables

Secure API Key Management

API_KEY = os.getenv("API_KEY")
if not API_KEY:
    raise ValueError("API_KEY environment variable not set")

The API key is handled securely through environment variables, keeping secrets out of the codebase and making it deployment-friendly.

Weather Data Fetch + Extraction

response = requests.get(URL)
if response.status_code == 200:
    data = response.json()

    weather_data = {
        "Date": [datetime.now().strftime("%Y-%m-%d %H:%M:%S")],
        "City": [CITY],
        "Temperature (C)": [data["main"]["temp"]],
        "Humidity (%)": [data["main"]["humidity"]],
        "Weather Description": [data["weather"][0]["description"]]
    }

This extracts the most important weather fields from the API response and formats them into a structured dataset.

Daily CSV Storage (Append-or-Create Logic)

df = pd.DataFrame(weather_data)
file_name = "daily_weather.csv"

try:
    existing_data = pd.read_csv(file_name)
    updated_data = pd.concat([existing_data, df])
    updated_data.to_csv(file_name, index=False)
except FileNotFoundError:
    df.to_csv(file_name, index=False)

The script appends new daily data while preserving history. If the CSV doesn’t exist yet, it creates it cleanly.