Common utilities for MoveEV projects
Project description
MoveEV Common Models
This package contains the common models used for Electric Vehicle (EV) Charging Data across the MoveEV ecosystem.
Overview
The moveev_common package provides a set of standardized data models that represent various aspects of EV charging sessions, vehicle information, and location data. These models ensure consistency and interoperability between different components of the MoveEV platform.
Models
The package includes the following main models:
-
ChargingEvent: Represents individual charging events with detailed metrics including:
- Charging duration and timestamps
- Energy consumed (kWh)
- Voltage and current measurements (milli-volts, milli-amps)
- Location data (lat/long)
- Provider-specific information
- Start/end energy measurements (micro-watt-hours)
- Charging power (kilowatts)
-
ChargingStat: Tracks real-time charging statistics including:
- State of charge (milli-percent)
- Charging voltage and current
- Energy consumption
- Location data
- Odometer readings (meters)
- Vehicle telemetry
-
Vehicle: Contains vehicle information including:
- VIN number
- Telematics device details (ID, hardware ID, name)
- Credential associations
- Creation and update timestamps
- Additional metadata (JSONB)
-
Credential: Manages authentication and access credentials for:
- Various charging providers
- Telematics systems
- API integrations
- Username/password pairs
- Database connections
-
Client: Manages client application information including:
- Client name
- Authentication token
- Service associations
-
ClientService: Manages client service configurations including:
- Client associations
- Service endpoints
- Event logging relationships
-
Service: Defines available services including:
- Service name
- Service URL
- Integration endpoints
-
EventLog: Tracks event notifications including:
- Charging event references
- Client service associations
- Timestamp information
- Delivery status
-
LastRunTime: Tracks service execution times including:
- Credential associations
- Job name
- Last execution timestamp
-
Location: Represents geographical location data including:
- Latitude and longitude
- Resolved address information
- Associated charging events
Usage
These models can be imported and used in various MoveEV projects to ensure consistent data structures when working with EV charging data. They provide a common language for different components of the system to communicate and share information effectively.
Contributing
When adding new fields or modifying existing models, please ensure that changes are reflected across all relevant components of the MoveEV ecosystem to maintain consistency.
For more detailed information about each model and its fields, please refer to the source code and inline documentation.
Database Migrations
Generating Migrations
-
Make your model changes in the appropriate files under
src/moveev_common/. For example, to add new fields to a model:class Credential(Base): # ... existing fields ... session_id = Column(String) session_expiry = Column(DateTime)
-
Activate your virtual environment:
source .venv/bin/activate
-
Generate the migration script:
alembic revision --autogenerate -m "description of your changes"
This will create a new migration file in the
alembic/versions/directory. -
Review the generated migration file to ensure it correctly captures your changes. The file will be named something like
1234abcd_description_of_your_changes.py. -
If the migration looks correct, proceed to running the migration as described below.
To run database migrations:
Running Migrations
Local Development
alembic -x environment=local upgrade head
Production
alembic -x environment=production upgrade head
Make sure your .env file contains both sets of database credentials:
POSTGRES_USERPOSTGRES_PASSWORDPOSTGRES_HOSTPOSTGRES_PORTPOSTGRES_DB
AND
POSTGRES_USER_PRODUCTIONPOSTGRES_PASSWORD_PRODUCTIONPOSTGRES_HOST_PRODUCTIONPOSTGRES_PORT_PRODUCTIONPOSTGRES_DB_PRODUCTION
Package Deployment
To update and deploy this package to PyPI, follow these steps:
-
Update version numbers in both configuration files:
# pyproject.toml version = "x.y.z" # setup.cfg version = x.y.z
-
Build the package:
python3.10 -m build
-
Upload to PyPI:
python3.10 -m twine upload dist/*
Note: Make sure you have the required credentials and permissions to upload to PyPI. You'll need to have build and twine packages installed, and a token for the PyPI repository:
pip install build twine
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moveev_common-0.2.2.tar.gz.
File metadata
- Download URL: moveev_common-0.2.2.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2baf45f877332e10c3c8ae8841e4b6c2b6f81b4219e6cba265668ef09b54cad
|
|
| MD5 |
35776b711e8d777488999df8306d4a09
|
|
| BLAKE2b-256 |
b7ee2b1f991b40921b989b592b3ec5cd370619f6d514f30116cfbf7b70d71448
|
File details
Details for the file moveev_common-0.2.2-py3-none-any.whl.
File metadata
- Download URL: moveev_common-0.2.2-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf70f01099464927d6186b520e70fbb93284e5c7a2918643f0eaeea010be9f7b
|
|
| MD5 |
5909fd942a2229bf998c4a048bef0f35
|
|
| BLAKE2b-256 |
d15f9aa019af8a8bc202f1b4fd2c6b5bd6952092ff7756777520fe2875ed9e3d
|