fix: Remove exclude-hours from some API calls - #1647
Conversation
|
@NoamGaash @OriHoch @ShayAdler |
|
@arielvino when you're saying that the data is fine, what do you mean by that? how did you test it?
the reason we ignored the midnight times is because we had a theory that maybe the service-day duration model isn't aligned with what we implemented in our DB, and maybe some plans doesn't have a matched ride execution because of timezone, daylight saving time and service hours related issues |
|
The frontend dashboard show nothing since ~October 2024 because an ETL edit caused the aggregation in the database to stop proccessing new data. However, the rides data itself is still intact and can be fetched and compared via other API endpoints. Now I tasked claude to sample them. The following is claude anlysis - unverified yet. (Anyway since the frontend show nothing currently - I will abandon this till it fixed. Individual-ride verification: does midnight/DST break plan↔execution matching?Tests the original theory behind the dashboard's MethodA single endpoint exposes everything needed:
Fetch a window (datetime filters are timezone-aware; curl -s 'https://open-bus-stride-api.hasadna.org.il/siri_rides/list?limit=300&order_by=scheduled_start_time%20asc&scheduled_start_time_from=2024-06-03T23:3
0:00%2B03:00&scheduled_start_time_to=2024-06-04T00:30:00%2B03:00&expand_related_data=true' -o midnight.jsonAnalyze per ride: import json, collections
from datetime import datetime
from zoneinfo import ZoneInfo
IL = ZoneInfo('Asia/Jerusalem')
rides = json.load(open('midnight.json'))
deltas, day_mm, jref_mm, unmatched = collections.Counter(), 0, 0, 0
for r in rides:
sched = datetime.fromisoformat(r['scheduled_start_time'])
il_day = sched.astimezone(IL).date().isoformat()
if r['journey_ref'][:10] != il_day: jref_mm += 1
if r['gtfs_ride_id'] is None: unmatched += 1; continue
deltas[(sched - datetime.fromisoformat(r['gtfs_ride__start_time'])).total_seconds()] += 1
if r['gtfs_route__date'][:10] != il_day: day_mm += 1
print(len(rides), 'rides | unmatched:', unmatched, '| deltas:', dict(deltas),
'| day mismatches:', day_mm, '| journey_ref mismatches:', jref_mm)A fast unmatched-rate probe for any date (used for the sweeps below; swap the date in both params): curl -s 'https://open-bus-stride-api.hasadna.org.il/siri_rides/list?limit=300&scheduled_start_time_from=2024-03-28T10:00:00%2B00:00&scheduled_start_time_to
=2024-03-28T10:20:00%2B00:00' | jq '[length, ([.[] | select(.gtfs_ride_id == null)] | length)]'Result 1 — regular midnight crossing: cleanWindow 2024-06-03 23:30 → 06-04 00:30 Israel time, 300 rides:
Daytime control (2024-06-04 10:00 IL, 1500 rides): 2.8% unmatched, delta 0 for 1447, a small tail of ±1–4 min (matcher tolerance). So the midnight window Result 2 — DST spring-forward (Fri 2024-03-29, 02:00→03:00): real, but a whole-day outageUnmatched rate at noon (UTC window, same probe command per date):
Planned GTFS data exists for both broken days (116,805 and 60,741 rides — Result 3 — DST fall-back (Sun 2023-10-29, 02:00→01:00): essentially healthy, trace artifactsTransition days: 5/300 and 4/300 unmatched at noon — baseline. In a 1,500-ride evening sample: delta 0 for 1,429, the usual ±1–4 min tail, and 2 rides Result 4 — byproduct: the exact date the matcher died2025/2026 DST transitions are untestable because Conclusions
|

Description
Removes the hardcoded
exclude_hour_from=23&exclude_hour_to=2that the dashboard has sent togtfs_rides_agg/group_bysince 2023 (#6, commit 891bc0e).Why remove it:
It was added to hide "edge cases in the EOD hours" (Added gtfs_rides_agg_by_hour View migration open-bus-stride-db#21, gtfs_ride_agg API adaptations to the new view open-bus-stride-api#27)
but those edge cases were never documented anywhere.
I verified directly against the production API: the night/early-morning hours look completely normal (today and as far back as
the data goes, including the week the exclusion was introduced). Whatever happened in 2023 was likely a transient issue.
The aggregation view bins hours in UTC while the frontend means Israel time, so "exclude 23:00–02:59" actually drops 02:00–05:59 Israel time - silently hiding the 05:00 morning ramp-up, ~3% of all planned rides - while the real midnight hours stay in. (Same
UTC-vs-Israel bug class as Serious bug:
rides_execution/listuses UTC midnight for date filtering instead of Israel midnight. Possibly the root cause of multiple other issues. open-bus-stride-api#54; will be reported separately against stride-api/stride-db along with the verification queries.)Expected effect: dashboard/operator totals rise by ~3% - previously hidden early-morning data coming back, not a regression.
Anyway, since operator/dashboard aggregation is currently broken at the ETL level - this will not affect the frontend till those be fixed - see
hasadna/open-bus-stride-etl#22.