CityofToronto / bdit_king_pilot_dashboard

Dashboard for King St Pilot
GNU General Public License v3.0
4 stars 2 forks source link

Internal Dashboard - Handle Missing Data #126

Closed radumas closed 6 years ago

radumas commented 6 years ago

A sensor on Adelaide has been down for a few weeks resulting in 2 problems:

1. App partially freezes when switching to a timeperiod where data is fully missing

Error message described here

Uncaught TypeError: undefined does not have a method named "concat"(…)

Looking at any timeperiod in January will cause Adelaide to disappear from the table and then the frontend tries to fire a callback on an object (Adelaide's row) which doesn't exist anymore.

2. "Most recent data" for Adelaide is erroneously displayed on the table

In selected_data(), if the user is selecting "Last Day", the function filters data for which date_filter = data['most_recent'] == 1. The most_recent column is generated by the SQL query using a window:

rank() OVER (PARTITION BY street, direction, day_type, period ORDER BY dt DESC) AS most_recent,

This is not aware of "most recent" dates for other streets.

Two fixes: