Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a is_active field to PointDeCharge table? #129

Open
5 tasks
jmaupetit opened this issue Jul 18, 2024 · 2 comments
Open
5 tasks

Add a is_active field to PointDeCharge table? #129

jmaupetit opened this issue Jul 18, 2024 · 2 comments
Labels
API Item related to the API service question Further information is requested schema Discussions around data schemas

Comments

@jmaupetit
Copy link
Member

jmaupetit commented Jul 18, 2024

Purpose

When a point of charge (PoC) is decommissioned (most of the time when the PoC has a new operator), we should keep this database entry to ensure database consistency (mostly regarding dynamic data). But if this PoC is no longer active, we should be able to flag it as is and adapt database queries or indicator calculations by taking into account this status update.

Proposal

  • add a is_active: bool = True field to the PointDeCharge model
  • add database migration
  • ensure the Statique model does not export this field

Cherry on the cake:

  • add a /statique/inactivate/bulk endpoint *
  • add a /statique/activate/bulk endpoint (in case we made a mistake) *

* expected payload would be a list of id_pdc_itinerance

@jmaupetit jmaupetit added question Further information is requested schema Discussions around data schemas API Item related to the API service labels Jul 18, 2024
@loco-philippe
Copy link
Collaborator

I think it's a good idea, but it seems to me that it's better to add the field to the station table.

It may also be useful to discuss with operators to understand what types of operations are required to define operating modes (and possible additional attributes or endpoints).

e.g. is it interesting to separate the creation of an operator, the creation of a station and the association of a station to an operator ?

@loco-philippe
Copy link
Collaborator

loco-philippe commented Jan 8, 2025

deactivation / reactivation rule proposal :

  • deactivation of pocs:

    • all poc can be deactivated
    • deactivation of a poc is not propagated to the station
  • purge of deactivated pocs

    • a deactivated poc without session and without status is included in the data to purge
  • reactivation

    • all deactivated pocs (not yet deleted) can be reactivated

Deactivation of a station is equivalent to deactivation of all pocs.
The is_active status of a station can be calculated with the following rule :
- if all pocs of the station are deactivated, the station is deactivated (is_active is False) else is_active is True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Item related to the API service question Further information is requested schema Discussions around data schemas
Projects
None yet
Development

No branches or pull requests

2 participants