Skip to content

Commit dcde88c

Browse files
authored
Merge branch 'main' into nextbike_set_range_properties
2 parents dde0b20 + ce791ca commit dcde88c

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
The changelog lists relevant feature changes between each release. Search GitHub issues and pull requests for smaller issues.
44

55
## Upcoming release (under development)
6+
67
- add converter for `gbfs.nextbike.net` feed: set `max_range_meters` and `current_range_meters` for vehicles with `propulsion_type` != `human`.
8+
- add converter for `mds.bird.co` feed: remove `station_information`, `station_status` and `free_bike_status` feeds from gbfs.json if they are always empty.
79

810
## 2024-06-14
911
- add converter for `data.lime.bike` feed: remove `station_status` and `station_information` feeds from gbfs.json, as Lime associates all free floating bikes to a single station, which is semantically wrong.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from typing import List, Union
2+
3+
from app.base_converter import BaseConverter
4+
5+
6+
class GbfsBirdRemoveStationsOrVehiclesConverter(BaseConverter):
7+
hostnames = ['mds.bird.co']
8+
9+
@staticmethod
10+
def _get_system_id_from_path(path: str) -> str:
11+
return path.split('/')[-3:-2][0]
12+
13+
def convert(self, data: Union[dict, list], path: str) -> Union[dict, list]:
14+
if not path.endswith('/gbfs.json') or not isinstance(data, dict) or not isinstance(data.get('data'), dict):
15+
return data
16+
17+
system_id = self._get_system_id_from_path(path)
18+
for language in data['data']:
19+
if not isinstance(data['data'][language].get('feeds'), list):
20+
continue
21+
22+
new_feeds = []
23+
for feed in data['data'][language]['feeds']:
24+
if not isinstance(feed, dict):
25+
continue
26+
if system_id in ['basel', 'biel', 'kloten', 'zurich'] and feed.get('name') in ['station_information', 'station_status']:
27+
continue
28+
if system_id in ['sarreguemines'] and feed.get('name') in ['free_bike_status']:
29+
continue
30+
new_feeds.append(feed)
31+
32+
data['data'][language]['feeds'] = new_feeds
33+
34+
return data

config_dist_dev.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ HTTP_TO_HTTPS_HOSTS:
44
- apis.deutschebahn.com
55
- stables.donkey.bike
66
- data.lime.bike
7+
- mds.bird.co

0 commit comments

Comments
 (0)