title
EcoTrack AI
emoji
πΏ
colorFrom
green
colorTo
green
sdk
docker
pinned
false
πΏ EcoTrack AI : Carbon Intelligence Platform
AI-powered carbon footprint calculator with ML predictions, Groq AI insights, anomaly detection, AR product scanner, carbon offset marketplace, and community leaderboard.
Hack2Skill Challenge 3 submission.
π Live Demo : https://ecotracka-i.netlify.app
βοΈ Backend API : https://aaricacoding-ecotrack-ai.hf.space
π» GitHub : https://github.com/Aaricacoding/EcoTrack-AI
Feature
Detail
4-Step Carbon Wizard
Transport Β· Home Energy Β· Diet Β· Shopping β under 2 minutes
ML Trend Forecast
Polynomial Ridge Regression β 6-month carbon trajectory
Anomaly Detection
Isolation Forest detects unusual emission spikes in history
AI Insights
Groq LLaMA generates personalised narrative footprint analysis
EcoBot AI Coach
Multi-turn AI carbon coach β knows your exact footprint data
AR Carbon Scanner
Point camera at product barcode β instant COβ footprint overlay
Offset Marketplace
4 verified Indian carbon offset projects with real pricing
Community Leaderboard
Anonymous global ranking with footprint distribution chart
Smart Dashboard
Donut chart Β· comparison bars vs global/India benchmarks
Ranked Tips
Personalised actions sorted by COβ impact β highest savings first
Secure Accounts
JWT + bcrypt authentication with IP rate limiting
ecotrack-ai/
βββ backend/
β βββ app/
β β βββ core/ # config Β· security Β· database
β β βββ models/ # Pydantic schemas Β· SQLAlchemy ORM
β β βββ routers/ # auth Β· carbon Β· predictions Β· tips Β· insights
β β βββ services/ # carbon_calculator Β· ml_predictor Β· ai_insights Β· anomaly_detector
β β βββ main.py # FastAPI app Β· middleware Β· security headers
β βββ tests/
β β βββ test_all.py # 43 deterministic unit tests
β βββ requirements.txt
β βββ .env.example
βββ frontend/
βββ index.html # Single-file SPA Β· 9 tabs Β· Chart.js Β· ARIA compliant
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
uvicorn app.main:app --reload --port 8000
pytest tests/ -v --tb=short
Method
Endpoint
Description
POST
/api/auth/register
Register new user
POST
/api/auth/login
Login and receive JWT
GET
/api/auth/me
Get current user profile
POST
/api/carbon/calculate
Calculate footprint (authenticated)
POST
/api/carbon/calculate/anonymous
Calculate footprint (no auth)
GET
/api/carbon/history
Get user calculation history
POST
/api/predictions/forecast
6-month ML forecast
POST
/api/tips/personalized
Get ranked reduction tips
POST
/api/insights/analyze
Groq LLaMA footprint analysis
POST
/api/insights/anomaly
Isolation Forest anomaly detection
POST
/api/insights/chat
EcoBot multi-turn conversation
GET
/health
Health check
Polynomial Ridge Regression (Trend Forecasting)
PolynomialFeatures(degree=2) + Ridge(alpha=1.0, random_state=42)
Captures realistic reduction curve β rapid early gains then plateau
Uses real DB history when available, simulated otherwise
Isolation Forest (Anomaly Detection)
IsolationForest(n_estimators=100, contamination=0.15, random_state=42)
Trains on user personal history β not global thresholds
Returns per-category z-scores and human-readable explanation
Layer
Mechanism
Passwords
bcrypt via passlib
Auth
HS256 JWT Β· 60-minute expiry
Validation
Pydantic v2 strict schemas
Rate limiting
slowapi Β· 5 reg/min Β· 10 login/min Β· 30 calc/min
Headers
X-Frame-Options Β· HSTS Β· X-Content-Type-Options
Secrets
Environment variables only Β· never hardcoded
Class
Coverage
TestTransportCalculation
Zero input Β· petrol vs EV Β· flights
TestHomeCalculation
Solar Β· per-capita scaling
TestDietCalculation
Vegan vs omnivore Β· waste multiplier
TestRatingAndPercentile
All 5 tiers Β· monotonicity Β· bounds
TestFullFootprint
Total integrity Β· valid rating
TestMLPrediction
Determinism Β· output length Β· non-negative
TestInputValidation
Negative values Β· invalid enums
TestSecurity
bcrypt Β· JWT roundtrip Β· tampered token
TestAnomalyDetection
Spike detection Β· z-scores Β· determinism
TestInsightSchemas
AI request response validation
Category
Factor
Source
Petrol car
0.192 kg COβe/km
EPA 2023
EV India grid
0.053 kg COβe/km
CEA 2023
Electricity India
0.716 kg COβe/kWh
CEA 2023
Short-haul flight
255 kg COβe/trip
ICAO
Long-haul flight
1050 kg COβe/trip
ICAO
Vegan diet
1500 kg COβe/yr
Poore & Nemecek 2018
Global average
4000 kg COβe/yr
IPCC AR6
India average
1800 kg COβe/yr
World Bank
Layer
Technology
Backend
FastAPI Β· Python 3.11 Β· Uvicorn
Database
SQLAlchemy Β· SQLite
ML
scikit-learn Β· numpy
AI
Groq LLaMA 3.1 8B
Auth
python-jose Β· passlib bcrypt
Frontend
Vanilla JS Β· Chart.js Β· BarcodeDetector API
Deployment
HuggingFace Spaces Β· Netlify
Testing
pytest Β· 43 tests
MIT License : Built for Hack2Skill Challenge 3