Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeatherFit Backend

Backend for WeatherFit, an app that suggests what to wear based on the weather and the clothes you own. It is a Flask REST API with SQLite storage. It manages a wardrobe, fetches forecasts from Open-Meteo, and produces outfit and packing suggestions.

Tech stack

  • Python 3 with Flask
  • SQLite (standard library sqlite3)
  • requests for the Open-Meteo geocoding and forecast APIs
  • pytest for the tests

Project structure

weatherfit/
  __init__.py      app factory (create_app) and blueprint registration
  db.py            SQLite connection handling and schema
  wardrobe.py      wardrobe CRUD and filtering (/api/wardrobe)
  weather.py       Open-Meteo fetching, cleaning and enrichment
  forecast.py      weather endpoint (/api/weather)
  recommend.py     outfit and packing logic
  suggestions.py   recommendation and packing endpoints (/api)
tests/             pytest suite
run.py             local entry point
requirements.txt   dependencies

Setup

python -m venv venv
# Windows:
venv\Scripts\activate
# macOS / Linux:
source venv/bin/activate

pip install -r requirements.txt

No API key is needed; Open-Meteo is free. The database file location can be set with the WEATHERFIT_DB environment variable, but it defaults to weatherfit.db so no setup is required.

Running

python run.py
# http://127.0.0.1:5000

Tests

python -m pytest

API

All data is JSON. The API is stateless: each response depends only on the request and the stored wardrobe.

Wardrobe

Method Endpoint Description
GET /api/wardrobe List items (filterable)
POST /api/wardrobe Create an item
GET /api/wardrobe/<id> Read one item
PUT /api/wardrobe/<id> Update an item
DELETE /api/wardrobe/<id> Delete an item

List filters (combinable): ?type=top, ?warmth=5, ?q=rain (text search over name and tags).

An item looks like:

{
  "name": "Rain Jacket",
  "type": "outerwear",
  "warmth": 4,
  "water_resistant": true,
  "formality": 2,
  "tags": "waterproof,winter"
}

type is one of top, bottom, outerwear, footwear, accessory. warmth and formality are 1 to 5.

Weather and recommendations

Method Endpoint Description
GET /api/weather?location=Amsterdam Cleaned forecast
GET /api/recommendations?location=Amsterdam Outfit for today plus an explanation
GET /api/packing-lists?destination=Oslo&start_date=&end_date= Packing list for a trip plus a summary

Raw Open-Meteo responses are cut down to the fields we use, rounded, and tagged with a condition label (rainy, cold, mild, warm, hot) that the recommendation logic reads. The explanations are built by a small function in recommend.py, so no API key is required and the logic stays testable.

Team

  • Tou Wong (lku361)
  • Zainab Rizvi (zri207)
  • Abdul Moeed Qadeer (tmo874)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages