How tarunk0209/energy-consumption-prediction works
This is a manufacturing energy-prediction web application. Users manage products, machine types, shifts, and production batches, then request an estimate for a saved batch; the backend sends its production features to a regression-model service, stores the result, and exposes prediction history for the frontend. The graph also includes the documented model-training/data branch. Relationships involving unsampled service and training details rely on README documentation; source excerpts show the frontend routing and the backend’s ML-service request.
Main entry points: App.jsx Workspace app · api.js HTTP API client · main.py REST API and prediction orchestration · train_model.py Model training and evaluation
Components 17
Frontend
- Workspace app
frontend/src/App.jsx - Product management
frontend/src/Products.jsx - Machine and shift management
frontend/src/MasterData.jsx - Batch management
frontend/src/ProductionBatches.jsx - Prediction interface
frontend/src/EnergyPrediction.jsx - Prediction history view
frontend/src/PredictionHistory.jsx - HTTP API client
frontend/src/api.js
Backend API and storage
- REST API and prediction orchestration
backend/main.py - Request and response schemas
backend/schemas.py - Production and prediction records
backend/models.py - SQLite database
backend/database.py
Prediction and modeling
- ML prediction service
ml_service/main.py - Saved regression pipeline
models/energy_model.joblib
Training data
- Model training and evaluation
ml_service/train_model.py - Sample data generator
ml_service/generate_data.py - Historical production data
data/historical_production.csv
Other components
- User
Connections 22
- User → Workspace app: uses
README.md - Workspace app → Product management: renders
frontend/src/App.jsx - Workspace app → Machine and shift management: renders
frontend/src/App.jsx - Workspace app → Batch management: renders
frontend/src/App.jsx - Workspace app → Prediction interface: renders
frontend/src/App.jsx - Workspace app → Prediction history view: renders
frontend/src/App.jsx - Workspace app → HTTP API client: requests products
frontend/src/App.jsx - Product management → HTTP API client: sends CRUD requests
frontend/src/Products.jsx - Machine and shift management → HTTP API client: sends CRUD requests
frontend/src/MasterData.jsx - Batch management → HTTP API client: sends batch requests
frontend/src/ProductionBatches.jsx - Prediction interface → HTTP API client: requests predictions
frontend/src/EnergyPrediction.jsx - Prediction history view → HTTP API client: loads history
frontend/src/PredictionHistory.jsx - HTTP API client → REST API and prediction orchestration: sends HTTP requests
frontend/src/api.js - REST API and prediction orchestration → Request and response schemas: uses schemas
backend/main.py - REST API and prediction orchestration → Production and prediction records: queries and updates
backend/main.py - REST API and prediction orchestration → SQLite database: persists records
backend/main.py - Production and prediction records → SQLite database: maps records
backend/models.py - REST API and prediction orchestration → ML prediction service: posts batch features
backend/main.py - ML prediction service → Saved regression pipeline: loads for inference
README.md - Model training and evaluation → Historical production data: trains from
README.md - Sample data generator → Historical production data: generates
README.md - Model training and evaluation → Saved regression pipeline: saves pipeline
README.md