How retr0alfred/voltwise works
Purpose and Runtime
VoltWise is a frontend-first energy-trading analytics dashboard for Indian power-market (IEX), demand, weather, and engineered market-feature data. It runs as a React 18 + TypeScript single-page application built and served by Vite. The backend is only a placeholder at backend/.gitkeep; no API, model-serving, or persistence layer is implemented.
Primary browser entry points are frontend/index.html, frontend/src/main.tsx, and frontend/src/App.tsx.
Application Shell and Navigation
frontend/src/App.tsx defines the application-level composition and route-driven page selection using React Router. The shared navigation shell is implemented in frontend/src/components/Navbar.tsx.
The main user-facing routes/pages are:
• Dashboard: frontend/src/pages/Dashboard.tsx
• Predictions scaffold: frontend/src/pages/Predictions.tsx
• Team/about content: frontend/src/pages/AboutUs.tsx
The Predictions route is intentionally a UI boundary for future backend/model integration, represented by frontend/src/components/predictions/PredictionsPlaceholder.tsx.
Data Boundary: Static CSVs in the Browser
All current analytics data is static and publicly served from frontend/public/data/, with no server-side transformation at runtime:
• IEX market data: frontend/public/data/IEX.csv
• Demand data: frontend/public/data/demand.csv
• Weather history: frontend/public/data/weather.csv
• Merged/engineered features: frontend/public/data/voltwise_final.csv
This means browser download size, parsing, and visualization performance are the primary operational constraints. There is currently no authentication, remote service dependency, database, or API contract.
CSV Ingestion and Data Normalization
frontend/src/hooks/useCSVData.ts is the central client-side ingestion boundary. It uses PapaParse with a worker-first parsing strategy and fallback handling, isolating CSV fetch/parse lifecycle from rendering components.
frontend/src/utils/dataHelpers.ts contains shared parsing, types, and data-shaping logic. Dashboard consumers should depend on these normalized structures rather than directly interpreting raw CSV fields. This is the natural replacement boundary if static files are later exchanged for backend APIs or model outputs.
Dashboard Analytics Composition
frontend/src/pages/Dashboard.tsx orchestrates dataset loading and presents the analytics modules. Visualization is decomposed by domain:
• Market pricing and IEX signals: frontend/src/components/dashboard/IEXChart.tsx
• National/regional demand: frontend/src/components/dashboard/DemandChart.tsx
• Multi-city weather: frontend/src/components/dashboard/WeatherChart.tsx
• Aggregate indicators: frontend/src/components/dashboard/KPICards.tsx
• Data-driven narrative/summary: frontend/src/components/dashboard/VoltWiseSummary.tsx
Charts use Recharts and intentionally minimize heavy animation for stability with large CSV datasets. The flow is static files → PapaParse/normalization → page-level state → chart/KPI props → browser-rendered visuals.
UI State and Design System
Theme state is centrally exposed through frontend/src/context/ThemeContext.tsx, allowing shared presentation behavior across the application shell and pages. Global styling is rooted at frontend/src/styles/globals.css, with Tailwind configured through frontend/tailwind.config.ts.
The frontend uses Tailwind CSS for styling and Lucide React for icons. Component-level presentation is separated from data ingestion, so dashboard visual components can be retained when a future service changes the data source.
Deployment and Future Integration
The deployable unit is the Vite frontend under frontend/, configured by frontend/vite.config.ts and dependency/runtime definitions in frontend/package.json. Production output is static client assets and can be hosted on any static web host.
Future prediction architecture should introduce an API/model boundary behind the existing predictions page, likely replacing or extending the CSV hook with typed asynchronous service clients. The empty backend/ directory marks the intended location for that implementation, but no backend runtime or external ML service is presently defined.
Main entry points: App.tsx App router and shell · Dashboard.tsx Dashboard page · useCSVData.ts CSV ingestion hook · .gitkeep Reserved backend directory
Components 17
Frontend Runtime
React SPA built and served by Vite.
- Vite build and static host · Builds the deployable browser application.
frontend/vite.config.ts - Frontend dependencies
frontend/package.json - Browser entry
frontend/index.html - React bootstrap
frontend/src/main.tsx - App router and shell · Selects routes and composes the shared application shell.
frontend/src/App.tsx - Shared navigation
frontend/src/components/Navbar.tsx - Theme state
frontend/src/context/ThemeContext.tsx - Global design styles
frontend/src/styles/globals.css - About page
frontend/src/pages/AboutUs.tsx
Client Data Pipeline
Static datasets are fetched and normalized in the browser.
- CSV ingestion hook · Fetches and parses CSVs with PapaParse worker-first fallback handling.
frontend/src/hooks/useCSVData.ts - Data normalization · Provides shared parsing, types, and normalized dashboard structures.
frontend/src/utils/dataHelpers.ts - Static CSV datasets · IEX, demand, weather, and engineered feature CSVs are downloaded directly by the browser.
Dashboard Analytics
Domain visualizations consume normalized page state.
- Dashboard page · Orchestrates dataset loading and analytics state.
frontend/src/pages/Dashboard.tsx - Charts, KPIs, and summary · IEXChart, DemandChart, WeatherChart, KPICards, and VoltWiseSummary render normalized dashboard props.
frontend/src/components/dashboard/IEXChart.tsx
Future Integration
Reserved boundary; no backend runtime exists.
- Predictions page · UI route reserved for future prediction integration.
frontend/src/pages/Predictions.tsx - Predictions placeholder · Future API or model outputs attach behind this UI boundary.
frontend/src/components/predictions/PredictionsPlaceholder.tsx - Reserved backend directory · Contains no implemented API, model-serving, or persistence runtime.
backend/.gitkeep
Connections 18
- Frontend dependencies → Vite build and static host: defines runtime dependencies
- Vite build and static host → Browser entry: serves
- Browser entry → React bootstrap: loads
- React bootstrap → App router and shell: mounts
- App router and shell → Shared navigation: composes
- App router and shell → Theme state: provides shared state
- App router and shell → Global design styles: uses
- App router and shell → Dashboard page: routes to
- App router and shell → Predictions page: routes to
- App router and shell → About page: routes to
- Predictions page → Predictions placeholder: renders
- Dashboard page → CSV ingestion hook: loads datasets through
- Static CSV datasets → CSV ingestion hook: browser fetches
- CSV ingestion hook → Data normalization: normalizes parsed rows with
- Data normalization → Dashboard page: supplies typed data
- Dashboard page → Charts, KPIs, and summary: passes analytics props
- Reserved backend directory → Predictions placeholder: future API/model integration
- Reserved backend directory → CSV ingestion hook: potential future data-source replacement