Skip to content

Commit

Permalink
push results of second travel time calculation through
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate-Wessel committed Jun 11, 2024
1 parent d2d6ce3 commit dd359f7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions backend/app/get_travel_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,11 @@ def get_travel_time(start_node, end_node, start_time, end_time, start_date, end_
observations = hr_sums[ hr_sums['length'] / total_corridor_length > 0.8 ]
# convert to format that can be used by the same summary function

# TODO unpack this into a list
obs_list = []
for tup in observations.itertuples():
dt, hr = tup.Index
#print(str(dt),tup.tt_extrapolated)
(dt, hr), tt = tup.Index, tup.tt
obs_list.append((dt, tt))

# TODO compare results to previous method
# TODO check query speeds

tt_hourly = [ tt for (dt,tt) in sample ]
Expand All @@ -138,9 +137,17 @@ def get_travel_time(start_node, end_node, start_time, end_time, start_date, end_
}

tt_seconds = mean_daily_mean(sample)
tt_seconds_raw = mean_daily_mean(obs_list)
print(
len(sample),
len(obs_list)
)

return {
'results': {'travel_time': timeFormat(tt_seconds)},
'results': {
'travel_time': timeFormat(tt_seconds),
'travel_time2': timeFormat(tt_seconds_raw)
},
'query': {
'corridor': {'links': links},
'query_params': query_params
Expand Down

0 comments on commit dd359f7

Please sign in to comment.