For judging purposes, the required .csv output files are in the output folder
A full-stack demo for energy forecasting and AI-assisted analysis. Upload your historical workbook, generate synthetic forecasts (hourly and monthly), and optionally blend with Gemini-based hyper training. The UI is React + Vite + Tailwind; the backend is Node/Express.
- Upload an Excel workbook with three sheets:
training_consumption: hourly consumption by group (columns are group IDs)training_prices: hourly electricity pricesgroups: group metadata
- Parse and store data in-memory for quick iteration.
- Generate synthetic predictions:
- Hourly 48h forecast (FWh) with diurnal shape, EV/night effects, and basic weather hooks.
- Monthly 12-month forecast scaled by hours in month.
- CSV exports that mirror the uploaded structure (semicolon-separated; decimal commas; headers without unit suffix).
- AI analysis & hyper-train (optional):
- Ask natural-language questions and get pretty, direct answers.
- Hyper-train sends compact samples to Gemini and returns per-group hourly/monthly forecasts (guardrailed and normalized), plus a simple aggregated series for quick viewing.
- Units & CSV
- All energy values expressed in FortumWattHours (FWh).
- CSV headers cleaned (no
(FWh)), semicolon-separated, decimal comma formatting.
- Forecast shaping
- Hourly values clamped to realistic ranges (baseline ~0–5 FWh).
- Diurnal profile with evening peaks; mild seasonality for monthly.
- EV penetration parameter increases evening load.
- Frontend UX
- Hyper Forecast Summary card with quick stats and derived metrics.
- Analysis answer style: structured vs direct (pretty bullets, human-readable).
- Uploads accordion with previews and quick load.
- Export buttons for hourly and monthly CSV.
- LLM guardrails
- Strict prompt schema demanding 48 hourly and 12 monthly entries per group.
- Tolerant parser accepting alternate key names and shapes; timestamp canonicalization.
- Normalization and fallback synthesis when model output is incomplete.
- Relaxed validation path that passes through model output and avoids 502s.
- macOS with zsh (default shell) or any modern Unix shell
- Node.js 18+
- npm 9+
- Install dependencies for backend and frontend:
cd backend
npm install
cd ../frontend
npm install- Environment variables (for Gemini features):
cd ../backend
cp .env.example .env
# Edit .env and set Gemini endpoint & credentials if you want LLM features
# e.g.
# GEMINI_URL=https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent
# GEMINI_API_KEY=your_key_here
# or provide GEMINI_ACCESS_TOKENUse two terminals or the root helper script.
- Backend (port 4000):
cd backend
npm run dev- Frontend (port 5173 by default):
cd frontend
npm run devAlternatively from the repo root:
npm install
npm run devOpen the UI at the printed URL (typically http://localhost:5173/). The Vite dev server proxies /api to the backend.
- Prepare a workbook with sheets:
training_consumption,training_prices,groups. - Use the UI to upload the workbook (Upload training workbook section).
- Load the dataset from the Past Uploads accordion.
- (Optional) Click “Hyper Train (AI blend)” to request per-group forecasts via Gemini.
- Generate and download CSVs (hourly/monthly) or view the 48h forecast chart.
- Ask AI analysis questions in the Analysis section.
- Upload & manage
- POST
/api/upload-training(form-datafile) - GET
/api/uploads,/api/upload-preview,/api/load-upload
- POST
- Synthetic forecasts
- GET
/api/predict-csv?start=ISO→ returns both hourly and monthly CSV strings - GET
/api/predict-hourly.csv?start=ISO - GET
/api/predict-monthly.csv?start=ISO
- GET
- AI
- POST
/api/analyze-training?format=textor/api/analyse-training?format=text→ human‑readable answer - POST
/api/hyper-train→ per-group hourly/monthly + aggregated series
- POST
- Ports busy: change dev ports in frontend Vite config or backend.
- Missing sheets: ensure workbook has all three required sheets named exactly.
- Gemini errors: verify GEMINI_URL and GEMINI_API_KEY or access token.
- Model JSON drift: tolerant parsing and normalization are implemented; set
DEBUG_LLM=1to inspect raw.
- Data is in-memory; restart clears state.
- Forecasts are illustrative for demo purposes.
MIT