Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

The changelog lists relevant feature changes between each release. Search GitHub issues and pull requests for smaller issues.

## 2025-08-20
- add converter for `share_birrer_ch` feed: correct form_factor and propulsion_type

## 2025-06-25:
- add converter for bolt feeds: remove all bicycle entries
- note: if future bolt feeds contain bicycles, the bicycle entries must be added again
Expand Down
2 changes: 2 additions & 0 deletions app/converters/gbfs_https_to_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class GbfsHttpsToHttpConverter(BaseConverter):
'gbfs.api.ridedott.com',
'zeus.city',
'yoio.rideatom.com',
'www.share-birrer.ch',
'auto-birrer.ch',
]

def convert(self, data: Union[dict, list], path: str) -> Union[dict, list]:
Expand Down
2 changes: 2 additions & 0 deletions app/converters/gbfs_set_ttl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class GbfsSetTtlConverter(BaseConverter):
'gbfs.prod.sharedmobility.ch',
'api.voiapp.io',
'gbfs.api.ridedott.com',
'www.share-birrer.ch',
'auto-birrer.ch',
]

def convert(self, data: Union[dict, list], path: str) -> Union[dict, list]:
Expand Down
36 changes: 36 additions & 0 deletions app/converters/gbfs_share_birrer_adjust_bicycle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from typing import Union

from app.base_converter import BaseConverter

BICYCLE_ELECTRIC_MAX_RANGE_METERS = 60000


class GbfsShareBirrerAdjustBicycleConverter(BaseConverter):
"""
share_birrer_ch uses invalid form_factor 'bike'
"""

hostnames = ['www.share-birrer.ch', 'auto-birrer.ch']

def convert(self, data: Union[dict, list], path: str) -> Union[dict, list]:
if not isinstance(data, dict):
return data

if path.endswith('/vehicle_types'):
fields = data.get('data')
if not isinstance(fields, dict):
return data
vehicle_types = fields.get('vehicle_types')
if not isinstance(vehicle_types, list):
return data
for vehicle_type in vehicle_types:
if vehicle_type.get('form_factor') == 'bike':
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that converter gbfs_set_return_constraint evaluates the form_factor to decide on which return constraint should be added. I did not check but assume alphabetic ordering in applying transformations. As gbfs_share_birrer_adjust_bicycle is alphabetic order behind gbfs_set_return_constraint, I assume that for yet unchanged form_factor bike no return constraint will be added.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i will set it explicitely

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

vehicle_type['form_factor'] = 'bicycle'
vehicle_type['propulsion_type'] = 'electric'
vehicle_type['max_range_meters'] = BICYCLE_ELECTRIC_MAX_RANGE_METERS
Comment on lines +27 to +30
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides this, birrer uses an invalid propulsion_type hydrogen:
image

According to v2.3 spec this should be hydrogen_fuel_cell
I suggest to fix this here as well.

vehicle_type['return_constraint'] = 'any_station' # currently, there is only one station for bicycles
if vehicle_type.get('propulsion_type') == 'hydrogen':
vehicle_type['propulsion_type'] = 'electric' # hydrogen_fuel_cell is not available in 2.2
return data

return data
2 changes: 2 additions & 0 deletions config_dist_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ HTTP_TO_HTTPS_HOSTS:
- gbfs.api.ridedott.com
- zeus.city
- yoio.rideatom.com
- www.share-birrer.ch
- auto-birrer.ch