ocpi-tariffs icon indicating copy to clipboard operation
ocpi-tariffs copied to clipboard

Simplifing / normalizing tariffs

Open rudolphfroger opened this issue 2 years ago • 0 comments

It would be great if the tool could simplify tariffs by removing everything which has no effect.

Example with price components which do nothing:

{
  "id": "EXAMPLE",
  "currency": "EUR",
  "elements": [
    {
      "price_components": [
        {
          "type": "FLAT",
          "price": 0,
          "step_size": 1
        },
        {
          "type": "TIME",
          "price": 0,
          "step_size": 1
        },
        {
          "type": "ENERGY",
          "price": 0.54,
          "step_size": 1
        }
      ]
    }
  ],
  "last_updated": "2023-10-04T07:15:01.745Z"
}

Is equal to:

{
  "id": "EXAMPLE",
  "currency": "EUR",
  "elements": [
    {
      "price_components": [
        {
          "type": "ENERGY",
          "price": 0.54,
          "step_size": 1
        }
      ]
    }
  ],
  "last_updated": "2023-10-04T07:15:01.745Z"
}

Another typical example are restrictions which do not restrict anything. Such as:

  • "start_time": "00:00", "stop_time": "00:00"
  • probably not correct but with the same intention: "start_time": "00:00", "stop_time": "23:59"
  • "day_of_week": ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"]
  • "min_duration": 0 (probably goes for all min_* restrictions)

Also having more generic tariff elements (for a certain dimension) specified before more restricting elements makes the latter one unnecessary.

I expect that tariffs with these no-op components and no-op restrictions exist because the OCPI tariff structure is generated in a way which always specified these things.

rudolphfroger avatar Oct 04 '23 08:10 rudolphfroger