WeaveWise is a clothing sustainability tracker that reads garment tags, extracts structured clothing data, and estimates environmental impact for a single item or an entire wardrobe.
The product flow is:
- User uploads a garment tag image
- OCR extracts text from the tag
- An LLM parses materials, percentages, country of origin, and care hints
- The backend looks up sustainability context and impact factors
- The app returns an impact summary, comparisons, and wardrobe-level insights
Clothing sustainability data is fragmented. Unlike food, there is no single public API that tells you the climate impact of a garment from a simple label. Most useful data is spread across lifecycle assessment reports, textile benchmark systems, and research PDFs.
This project solves that by combining:
- OCR for clothing tags
- LLM-based parsing for messy real-world label text
- MongoDB Atlas for structured persistence
- sustainability lookup and summarization logic
- a React frontend for item and wardrobe reports
A clothing tag often contains:
- material composition
- for example:
60% Cotton, 35% Polyester, 5% Elastane
- for example:
- country of manufacture
- for example:
Made in Bangladesh
- for example:
- care instructions
- for example: wash temperature, tumble dry, dry clean
- brand or product description
These fields matter because:
- material composition drives manufacturing emissions
- country of origin affects transport and production energy context
- care instructions influence the use-phase footprint over the garment lifetime
The application estimates clothing impact using a layered pipeline:
- OCR extracts raw text from a garment tag image
- parsing logic converts that raw text into structured garment data
- search and enrichment gather supporting sustainability context
- MongoDB stores sessions and can be expanded to store material lookup tables
- impact logic produces garment-level and wardrobe-level outputs
- React
- Vite
- TypeScript
- Python 3.11+
- FastAPI
- Uvicorn
- MongoDB Atlas
pymongo
- Groq API
- LangGraph
- Bright Data search
- Pillow
- BeautifulSoup
- python-dotenv
YaleHacks/
├── frontend/
│ ├── src/
│ │ ├── App.tsx
│ │ ├── api.ts
│ │ ├── BackgroundClothes.tsx
│ │ ├── WardrobeReport.tsx
│ │ └── main.tsx
│ ├── package.json
│ └── vite.config.ts
├── src/
│ └── yalehacks/
│ ├── api.py
│ ├── brightdata_client.py
│ ├── cli.py
│ ├── config.py
│ ├── db.py
│ ├── graph.py
│ ├── query_build.py
│ ├── tag_read.py
│ └── wardrobe_impact.py
├── pyproject.toml
└── .env
Create a local .env file in the repo root.
Required:
MONGODB_URI=your_mongodb_atlas_connection_string
MONGODB_DB_NAME=yalehacks
BRIGHTDATA_API_KEY=your_brightdata_key
BRIGHTDATA_ZONE=search_api
GROQ_API_KEY=your_groq_key
GROQ_VISION_MODEL=meta-llama/llama-4-scout-17b-16e-instruct
GROQ_SUMMARY_MODEL=openai/gpt-oss-20b
CORS_ORIGINS=*Notes:
MONGODB_URIconnects the app to MongoDB AtlasBRIGHTDATA_API_KEYpowers web search enrichmentGROQ_API_KEYpowers the LLM steps.envshould never be committed
This project requires Python 3.11 or newer.
If needed on macOS:
brew install python@3.11cd "/Users/osamahgilani/Documents/New project/YaleHacks"
/opt/homebrew/bin/python3.11 -m venv .venvcd "/Users/osamahgilani/Documents/New project/YaleHacks"
.venv/bin/pip install .cd "/Users/osamahgilani/Documents/New project/YaleHacks/frontend"
npm installcd "/Users/osamahgilani/Documents/New project/YaleHacks"
.venv/bin/uvicorn yalehacks.api:app --host 127.0.0.1 --port 8000cd "/Users/osamahgilani/Documents/New project/YaleHacks/frontend"
npm run dev -- --host 127.0.0.1 --port 5173- frontend:
http://127.0.0.1:5173 - backend health:
http://127.0.0.1:8000/health
If port 5173 is already in use, Vite may move the frontend to 5174.
GET /health
Returns:
{ "status": "ok" }POST /api/ocr
Accepts:
- image file upload
- optional
session_id - optional
description
Returns:
{
"session_id": "uuid",
"ocr_text": "raw text from garment tag"
}POST /api/graph
Accepts either:
session_id- or raw
ocr_text
Returns:
{
"session_id": "uuid",
"summary": "impact summary",
"search_query": "generated sustainability query"
}POST /api/search
Builds or uses a query and performs search enrichment.
POST /api/wardrobe/impact
Accepts a list of wardrobe items with summaries and returns a combined wardrobe-level impact report.
GET /api/sessions/{session_id}
Returns the stored session document.
MongoDB Atlas should evolve to include these collections:
materialscountriescare_instructionsscansusers
{
"material_name": "polyester",
"aliases": ["polyester", "poly", "PES"],
"co2_per_kg": 5.5,
"water_per_kg": 17,
"energy_mj_per_kg": 104,
"is_recyclable": true,
"recycled_variant_co2": 2.1,
"biodegradable": false,
"category": "synthetic",
"source": "Higg MSI"
}{
"country": "Bangladesh",
"iso_code": "BD",
"avg_shipping_co2_per_kg": 0.8,
"factory_energy_mix": "mostly_fossil",
"energy_co2_factor": 1.2
}{
"instruction": "machine_wash_40",
"co2_per_wash_kg": 0.3,
"water_per_wash_liters": 50,
"estimated_washes_per_year": 52
}{
"user_id": "user_123",
"raw_ocr_text": "60% Cotton 40% Polyester Made in China",
"parsed_data": {
"materials": [
{ "name": "cotton", "percentage": 60 },
{ "name": "polyester", "percentage": 40 }
],
"country": "China",
"care": ["machine_wash_30", "do_not_tumble_dry"]
},
"carbon_score": {
"material_co2": 4.2,
"transport_co2": 0.6,
"use_phase_co2": 12.1,
"total_co2": 16.9,
"rating": "C"
}
}Recommended sources for building the material-impact lookup layer:
- Higg Materials Sustainability Index
- OECOTEXTILES research data
- European Commission Product Environmental Footprint datasets
- Made-By Environmental Benchmark for Fibers
- Quantis World Apparel LCA
- Textile Exchange Preferred Fiber & Materials reports
- Carbon Trust research on fashion lifecycle emissions
Because there is no single open API for clothing impact, the intended approach is to normalize these sources into your own MongoDB collections.
The intended scoring model is:
Total CO2 = Material CO2 + Transport CO2 + Use-Phase CO2
Material CO2 = sum(material_co2_per_kg × percentage × garment_weight_kg)
Transport CO2 = country_shipping_co2_per_kg × garment_weight_kg
Use-Phase CO2 = co2_per_wash × washes_per_year × garment_lifespan_years
Suggested rating scale:
- A: under 5 kg CO2
- B: 5-10 kg
- C: 10-20 kg
- D: 20-35 kg
- F: above 35 kg
Because clothing tags do not include weight, garment-type defaults can be used:
- t-shirt: ~0.2 kg
- jeans: ~0.8 kg
- jacket: ~1.2 kg
- finalize MongoDB schema
- seed materials and country data
- validate OCR on real garment tags
- improve parsing reliability for mixed-fiber labels
- add care-instruction normalization
- save and inspect scan history
- add full carbon breakdown per garment
- add alternatives and lower-impact suggestions
- support better wardrobe-level comparison
- polish frontend UX
- deploy backend and frontend
- add production-grade image storage
- frontend: Vercel
- backend: Railway or Render
- database: MongoDB Atlas
- The app boots locally with the backend and frontend commands above
- The full pipeline depends on valid
.envsecrets - MongoDB support already exists in the current codebase
node_modules/should remain ignored and local only
- swap OCR provider depending on accuracy and cost
- add manual correction UI after OCR
- add multilingual label support
- estimate confidence scores per parsed field
- add visual charts for material and wardrobe comparisons
- support material substitutions and greener alternatives
No license file is currently included in this branch. Add one before public distribution if needed.