How hariom710/evoptima works
Project type and purpose
• This is a Django-based web application that integrates a pre-trained machine learning model to predict electric vehicle (EV) charging demand.
• The project serves HTML pages (via Django templates), loads a serialized scikit-learn model (model.joblib) and scaler (scaler.joblib), accepts user input through a form, and stores/retrieves data in a local SQLite database.
File structure
• Top level:
• ev_charging_prediction.ipynb – Jupyter notebook for data exploration, feature engineering, model training
• ev_charging_data2.xlsx – source dataset
• requirements.txt – Python dependencies
• ev_charging_project/
• manage.py and ev_charging_project/settings.py, urls.py, wsgi.py, asgi.py – Django project configuration
• db.sqlite3 – development database
• ev_charging_project/model/
• model.joblib, scaler.joblib – serialized ML artifacts
• ev_charging_project/prediction/ (Django app)
• models.py – any data models
• forms.py – user input form definitions
• views.py – request handlers that load the ML model, apply scaler, return predictions
• templates/prediction/*.html – base.html and predict.html for UI
• static/css & static/js – styling and client-side scripts
• staticfiles/ – collected static assets for production
Key insights from README
• Core use case: predict kWh consumption based on session duration, temperature, timestamp features
• Tech: Python 3.10, Django 4.0, scikit-learn, SQLite (dev) / MySQL or PostgreSQL (prod)
• Future roadmap hints at API layers and React dashboard, but current code uses server-rendered templates.
Main components
a. Client (web browser)
– Sends HTTP GET/POST to Django server
– Renders predict.html and base.html, executes static JS/CSS
b. Django Web Server (Monolith)
– URL router → prediction.views
– Loads forms, validates inputs
– ML layer: loads scaler.joblib & model.joblib, transforms input, obtains prediction
– Renders template with result
– ORM layer queries/stores in database
c. Database
– SQLite (dev) or MySQL/PostgreSQL (prod) storing historical sessions, user inputs, logs
d. Static Asset Store
– CSS/JS served from staticfiles directory
e. (Optional training pipeline)
– Jupyter Notebook or separate Python script training model and exporting joblib files
Architectural patterns and principles
• MVC / MTV (Model-Template-View) pattern inherent in Django
• Single-process monolith: all layers coexist in one codebase
• Separation of concerns:
• prediction/ handles domain logic and ML
• model/ holds artifacts, could be extracted to a microservice later
• static & templates separate presentation
Elements
• Clear component names (e.g., “Django Prediction View”)
• ML model loading path (file system → memory)
• Database interactions (ORM → SQL)
• Static asset serving path (URL → staticfiles)