From 36a9c9615182c4d0443dffa1fbf4472810b1f35c Mon Sep 17 00:00:00 2001 From: Nate Wessel Date: Fri, 10 May 2024 09:16:04 -0400 Subject: [PATCH] Remove misleading sample estimates (#117) * axe the output * clip clip clip * remove from readme --- README.md | 1 - backend/app/get_travel_time.py | 14 -------------- frontend/src/travelTimeQuery.js | 7 +------ 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/README.md b/README.md index c0c49ec..07df5bf 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ The app can return results in either CSV or JSON format. The fields in either ca | `daysOfWeek` | Text description of the days of week included in the query. | | `holidaysIncluded` | Boolean, indicating if statutory holidays where (True) or were not (False) included in the query. | | `hoursInRange` | The total number of hours that are theoretically within the scope of the query's various parameters. This does not imply that data is/was available at all times. It's possible to construct requests with zero hours in range such as e.g `2023-01-01` to `2023-01-02`, Mondays only (There's only one Sunday in that range). Impossible combinations are included in the output for clarity and completeness but are not actually executed against the API and should return an error. | -| `estimatedVehicleCount` | Deprecated. A very rough estimate of the number of observed probe vehicles operating within the given corridor and temporal bounds. This is NOT an estimate of traffic volume. Includes partial trips through the corridor and may be subject to additional caveats which we are still exploring. This is calculated as the total amount of time vehicles spent travelling along the selected links divided by the mean travel time. | | `mean_travel_time_minutes` | The mean travel time in minutes is given as a floating point number rounded to two decimal places. Where insufficient data was available to complete the request, the value will be null, and in cases where the request was impossible a value of -999 will be assigned. (See `hoursInRange`). | | `mean_travel_time_seconds` | Same as above, but measured in seconds. | diff --git a/backend/app/get_travel_time.py b/backend/app/get_travel_time.py index 8708c1d..f3988dc 100644 --- a/backend/app/get_travel_time.py +++ b/backend/app/get_travel_time.py @@ -51,17 +51,6 @@ def get_travel_time(start_node, end_node, start_time, end_time, start_date, end_ FROM corridor_period_daily_avg_tt ''' - sample_size_query = f""" - SELECT SUM( ((length / 1000.0) / mean) * sample_size ) AS probe_hours - FROM here.ta_path - WHERE - link_dir = ANY(%(link_dir_list)s) - AND dt <@ %(date_range)s::daterange - AND EXTRACT(ISODOW FROM dt)::integer = ANY(%(dow_list)s) - AND EXTRACT(HOUR FROM tod)::numeric <@ %(time_range)s::numrange - {sample_holiday_clause} - """ - links = get_links(start_node, end_node) query_params = { @@ -82,13 +71,10 @@ def get_travel_time(start_node, end_node, start_time, end_time, start_date, end_ cursor.execute(agg_tt_query, query_params) # travel_time may be null if there's insufficient data travel_time, = cursor.fetchone() - cursor.execute(sample_size_query, query_params) - probe_hours, = cursor.fetchone() connection.close() return { 'travel_time': None if travel_time is None else float(travel_time), 'links': links, - 'estimated_vehicle_count': None if travel_time is None else float((probe_hours * 60) / travel_time), 'query_params': query_params } \ No newline at end of file diff --git a/frontend/src/travelTimeQuery.js b/frontend/src/travelTimeQuery.js index e504a48..67f9eeb 100644 --- a/frontend/src/travelTimeQuery.js +++ b/frontend/src/travelTimeQuery.js @@ -7,7 +7,6 @@ export class TravelTimeQuery { #days #holidayOption #travelTime - #estimatedSample constructor({corridor,timeRange,dateRange,days,holidayOption}){ this.#corridor = corridor this.#timeRange = timeRange @@ -39,10 +38,7 @@ export class TravelTimeQuery { } return fetch(this.URI) .then( response => response.json() ) - .then( data => { - this.#travelTime = data.travel_time - this.#estimatedSample = data.estimated_vehicle_count - } ) + .then( data => this.#travelTime = data.travel_time ) } get hasData(){ return Boolean(this.#travelTime) @@ -65,7 +61,6 @@ export class TravelTimeQuery { record.set('daysOfWeek', this.days.name) record.set('holidaysIncluded', this.#holidayOption.holidaysIncluded) record.set('hoursInRange', this.hoursInRange) - record.set('estimatedVehicleCount', this.#estimatedSample) record.set('mean_travel_time_minutes', this.#travelTime) record.set( 'mean_travel_time_seconds',