hasadna / hasadna/open-bus-stride-api

'siri_ride_journey_ref' not unique : 'siri_ride_journey_ref' == " 2022-03-06-0"

Open
#16 0 comments 0 reactions 1 assignee Claimed by @OriHoch View on GitHub
Dominant language
Python
Stars
8
Forks
18
PR merge metrics
No merged PRs in 30d

Description

I tried using 'siri_ride_journey_ref' as a unique identifier of a "trip" in the df of all locations in one day (2022-03-06) that I created... however, I found that many siri records (75,852 of 4,718,821 ) have 'siri_ride_journey_ref' == " 2022-03-06-0" - so not unique

to collect all locations for one day, I loop through all route_id s and make the following request :

(the below is for route_id = '1877' because it is one of the route_IDs that have 'siri_ride_journey_ref' == " 2022-03-06-0" in the response)

route_id = '1877'
rt_date = '20220306'
date_yyyy = int(rt_date[0:4])
date_mm = int(rt_date[4:6])
date_dd = int(rt_date[6:])

siri_vehicle_locations_df = pd.DataFrame(stride.iterate('/siri_vehicle_locations/list', {
'siri_routes__line_ref': route_id,
'siri_rides__schedualed_start_time_from': datetime.datetime(date_yyyy, date_mm, date_dd, tzinfo=tz.gettz('Israel')),
'siri_rides__schedualed_start_time_to': datetime.datetime(date_yyyy, date_mm, date_dd, tzinfo=tz.gettz('Israel'))+datetime.timedelta(days=1),
'order_by': 'recorded_at_time desc',
'limit': -1
}, limit=50000))

print(siri_vehicle_locations_df )

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.