Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌦️ Weather Assistant

A full-stack Weather Dashboard built using FastAPI, React, SQLAlchemy, and WeatherAPI. The application provides real-time weather information, 5-day forecasts, weather history management, statistics, and data export functionality.

Developed as part of the AI Engineer Intern Technical Assessment.


Features

Current Weather

  • Search weather by city or location.
  • Real-time weather information using WeatherAPI.
  • Weather condition icons.
  • Displays:
    • Temperature
    • Feels Like Temperature
    • Humidity
    • Pressure
    • Wind Speed
    • Visibility
    • UV Index
    • Sunrise & Sunset

Location Search

  • Location autocomplete/search suggestions.
  • Fuzzy location matching.
  • Select locations directly from search results.

5-Day Forecast

  • Displays:
    • Date
    • Average Temperature
    • Minimum Temperature
    • Maximum Temperature
    • Weather Condition
    • Humidity
    • Air Quality
    • Weather Icon

Weather Statistics

  • Total Searches
  • Average Temperature
  • Highest Temperature
  • Lowest Temperature
  • Most Searched City

Database Features

  • Stores weather records in SQLite.
  • Full CRUD functionality:
    • Create
    • Read
    • Update
    • Delete

Export Features

  • Export weather history to CSV.
  • Export weather history to PDF.

Error Handling

  • Invalid location handling.
  • API error handling.
  • Database validation.
  • Proper HTTP status codes.

Tech Stack

Backend

  • FastAPI
  • SQLAlchemy
  • SQLite
  • Pydantic
  • HTTPX

Frontend

  • React
  • Vite
  • Axios

External API

  • WeatherAPI

Project Structure

weather-assistant/
│
├── app/
│   ├── core/
│   ├── models/
│   ├── routers/
│   ├── schemas/
│   ├── services/
│   └── utils/
│
├── weather-frontend/
│   ├── src/
│   │   ├── api/
│   │   ├── components/
│   │   ├── pages/
│   │   └── assets/
│
├── requirements.txt
├── README.md
└── .gitignore

Installation

Clone Repository

git clone https://github.com/Athrv-D/weather-assistant/

Backend Setup

Create Virtual Environment

python -m venv .venv

Activate Environment

Windows

.venv\Scripts\activate

Install Dependencies

pip install -r requirements.txt

Run Backend

uvicorn app.main:app --reload

Backend URL

http://127.0.0.1:8000

Swagger Documentation

http://127.0.0.1:8000/docs

Frontend Setup

Move to frontend

cd weather-frontend

Install packages

npm install

Run frontend

npm run dev

Frontend URL

http://localhost:5173

API Endpoints

Method Endpoint Description
GET /weather/search Search locations
GET /weather/current Current weather
GET /weather/forecast 5-Day Forecast
GET /weather/history Weather history
GET /weather/statistics Weather statistics
GET /weather/export/pdf Export PDF
GET /weather/export/csv Export CSV
PUT /weather/{id} Update weather record
DELETE /weather/{id} Delete weather record

Database

The application stores:

  • City
  • Country
  • Latitude
  • Longitude
  • Temperature
  • Feels Like Temperature
  • Humidity
  • Pressure
  • Wind Speed
  • Visibility
  • Weather Condition
  • Description
  • Weather Icon
  • UV Index
  • Air Quality
  • Sunrise
  • Timestamp

Future Improvements

  • User Authentication
  • Weather Charts
  • Weather Alerts
  • Multiple Export Formats
  • Maps Integration
  • AI Weather Recommendations

Request Flow

React Frontend │ ▼ FastAPI Backend │ ▼ WeatherAPI │ ▼ SQLite Database │ ▼ Response to Frontend

Author

Atharv Gupta

AI Engineer Intern Technical Assessment

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages