-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identify when Miovision volume are unusually high #951
Comments
gabrielwol
added a commit
that referenced
this issue
May 13, 2024
gabrielwol
added a commit
that referenced
this issue
May 13, 2024
I worked on a data check to identify when volumes had doubled week over week for a specific intersection/mode: https://github.com/CityofToronto/bdit_data-sources/tree/951-identify-high-miovision-volumes Running the function for a month:
SELECT dates.dt, UNNEST(d.summary)
FROM generate_series('2024-04-01'::date, '2024-05-01'::date, interval '1 day') AS dates(dt),
LATERAL (
SELECT summary FROM gwolofs.miovision_doubling(dates.dt::date)
) AS d Identifying all the runs:
WITH doublings AS (
SELECT dates.dt,
SPLIT_PART(UNNEST(d.summary), ',', 1) AS intersection,
SPLIT_PART(UNNEST(d.summary), ',', 2) AS mode,
SPLIT_PART(UNNEST(d.summary), 'volume: ', 2) AS volumes
FROM generate_series('2024-04-01'::date, '2024-05-01'::date, interval '1 day') AS dates(dt),
LATERAL (
SELECT summary FROM gwolofs.miovision_doubling(dates.dt::date)
) AS d
ORDER BY 2, 3, 1
)
SELECT * FROM (
SELECT *, dt - lag(dt) OVER (PARTITION BY intersection, mode ORDER BY dt) AS lag_diff
FROM doublings
) diffs
WHERE lag_diff IS NULL OR lag_diff > interval '1 day' |
Reluctant to enable a torrent of notifications like what I identified above. Some ideas:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Last week I discovered a case where bike volumes had gone up more than 4x in recent weeks and I wanted to investigate ways of identifying this automagically.
The text was updated successfully, but these errors were encountered: