From f360fd3bc59b79e290c497d5906328816faab43e Mon Sep 17 00:00:00 2001 From: Nate-Wessel Date: Wed, 24 Apr 2024 20:57:13 +0000 Subject: [PATCH] add sample size --- backend/app/get_travel_time.py | 39 ++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/backend/app/get_travel_time.py b/backend/app/get_travel_time.py index f2f40cc..676a22e 100644 --- a/backend/app/get_travel_time.py +++ b/backend/app/get_travel_time.py @@ -88,25 +88,28 @@ def get_travel_time(start_node, end_node, start_time, end_time, start_date, end_ 'seconds': tt_seconds, 'minutes': tt_seconds / 60, 'clock': secs2clock(tt_seconds), - 'confidence_intervals': { - 'p=0.9': { - 'lower': { - 'seconds': p90lower, - 'clock': secs2clock(p90lower) + 'confidence': { + 'sample': len(sample), + 'intervals': { + 'p=0.9': { + 'lower': { + 'seconds': p90lower, + 'clock': secs2clock(p90lower) + }, + 'upper': { + 'seconds': p90upper, + 'clock': secs2clock(p90upper) + } }, - 'upper': { - 'seconds': p90upper, - 'clock': secs2clock(p90upper) - } - }, - 'p=0.95': { - 'lower': { - 'seconds': p95lower, - 'clock': secs2clock(p95lower) - }, - 'upper': { - 'seconds': p95upper, - 'clock': secs2clock(p95upper) + 'p=0.95': { + 'lower': { + 'seconds': p95lower, + 'clock': secs2clock(p95lower) + }, + 'upper': { + 'seconds': p95upper, + 'clock': secs2clock(p95upper) + } } } }