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.
- Python 3 with Flask
- SQLite (standard library
sqlite3) requestsfor the Open-Meteo geocoding and forecast APIspytestfor the tests
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
python -m venv venv
# Windows:
venv\Scripts\activate
# macOS / Linux:
source venv/bin/activate
pip install -r requirements.txtNo 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.
python run.py
# http://127.0.0.1:5000python -m pytestAll data is JSON. The API is stateless: each response depends only on the request and the stored 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.
| 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.
- Tou Wong (lku361)
- Zainab Rizvi (zri207)
- Abdul Moeed Qadeer (tmo874)