This project is a local three-service app for household energy analysis, appliance tracking, and smart recommendations.
frontend/= React + Vite UIbackend/= Node/Express API and SQLite ownerai_service/= Python/Flask recommendations servicedata/processed/= processed household CSV datasets used as the demo user pool
Current behavior:
- The
Simple Logindropdown is a temporary user switcher. - Each demo user is mapped to one processed CSV dataset.
- Appliance usage is stored in SQLite and scoped by the selected user.
- Smart recommendations use:
- selected user appliance usage from the backend
- selected dataset energy profile
- the full processed dataset pool for baseline and peak-hour analysis
- Frontend loads available demo users from the AI service.
- Selecting a user changes the active dataset context across the page.
- The backend serves:
- monthly usage for the selected dataset
- weekly overview for the selected dataset
- appliance usage for the selected user
- appliance context summary for the AI service
- The AI service:
- fetches appliance context from the backend
- compares the selected dataset against the dataset pool
- calculates peak demand hours from processed CSVs
- generates smart recommendations
- Appliance usage added in the form is stored only for the currently selected user.
Use three terminals.
cd C:\Users\muhdh\Desktop\Apps\School\Y2S2\Hackomania\frontend
npm run devcd C:\Users\muhdh\Desktop\Apps\School\Y2S2\Hackomania\backend
npm startRuns on http://localhost:3001
cd C:\Users\muhdh\Desktop\Apps\School\Y2S2\Hackomania\ai_service
python ai_api.pyRuns on http://localhost:5001
Notes:
- Pinecone is optional at runtime. If unavailable, the AI service still runs.
- Tavily is optional. If it fails, appliance lookup falls back.
- The backend creates
backend/appliances.dbautomatically on startup.
- Start all three services.
- Open the frontend in the browser.
- Use
Simple Loginto choose a demo user. - Check:
- monthly usage chart
- weekly overview
- smart recommendations
- Add appliance usage for that selected user.
- Switch users and verify appliance usage and recommendations are isolated per user.
GET /api/monthly-usage?dataset=<dataset_id>GET /api/weekly-overview?dataset=<dataset_id>POST /api/appliancesGET /api/appliances?user_id=<dataset_id>GET /api/context-summary?user_id=<dataset_id>
GET /healthGET /api/ai/datasetsGET /api/ai/recommendations?dataset=<dataset_id>POST /api/ai/appliance-consumption
frontend/src/pages/Index.tsxfrontend/src/components/UsageChart.tsxfrontend/src/components/WeeklyOverview.tsxfrontend/src/components/Recommendations.tsxfrontend/src/components/ApplianceUsageForm.tsxfrontend/src/components/ApplianceUsageDashboard.tsxbackend/server.jsai_service/ai_api.pyai_service/ai_service.py
- The login system is temporary and dataset-backed, not real authentication.
- Appliance lookup may use fallback estimates if Tavily is unavailable.
- Recommendation rendering still depends on parsing formatted text from the AI response.
curl http://localhost:3001/api/appliances
curl "http://localhost:3001/api/monthly-usage?dataset=1130211_FD1_L1_EDMI_1_D"
curl "http://localhost:3001/api/weekly-overview?dataset=1130211_FD1_L1_EDMI_1_D"
curl http://localhost:5001/health
curl http://localhost:5001/api/ai/datasets
curl "http://localhost:5001/api/ai/recommendations?dataset=1130211_FD1_L1_EDMI_1_D"