CityofToronto / bdit_volumes

Traffic Volumes Modelling Project
7 stars 6 forks source link

#87 TEPS 2023 #88

Closed gabrielwol closed 2 months ago

gabrielwol commented 2 months ago

Summary of edits:

Some high level checks: RESCU: Despite the outages we have noticed the last few months of 2023, there was more data for in 2023 than 2022.

SELECT yr, COUNT(*) AS num_detectors, ROUND(AVG(count), 1) AS avg_days, SUM(count) AS sensor_x_days
FROM (
    SELECT detector_id, '2022' AS yr, COUNT(*) FROM teps.rescu_enuf_vol_22 GROUP BY 1
    UNION
    SELECT detector_id, '2023' AS yr, COUNT(*) FROM teps.rescu_enuf_vol_23 GROUP BY 1
) AS summ
GROUP BY yr
"yr" "num_detectors" "avg_days" "sensor_x_days"
"2022" 98 144.1 14125
"2023" 98 205.4 20131

Classification counts:

Results look good for speedvol tables: "yr" "min" "max" "count"
"2022" "2022-02-22 00:00:00" "2022-12-05 23:45:00" 5665
"2023" "2023-01-10 00:00:00" "2023-12-07 23:45:00" 5027

Miovision - centreline check: Double checked and there were 4 legs missing from miovision centreline. All are valid omissions:

/*
5   "W" --bathurst and front, 3 legged intersection, delete this approach
78  "S" --private entrance at bloor and kingsway, delete this approach
68  "N" --this approach is north of steeles so outside of Toronto centreline.
1   "W" --bathurst and adelaide, 3 legged intersection, delete this approach.
*/
WITH mio_data AS (
    SELECT DISTINCT
        intersection_uid, leg
    FROM miovision_api.volumes_15min AS volumes
    WHERE
        volumes.datetime_bin >= '2023-01-01 00:00:00'::timestamp without time zone
        AND volumes.datetime_bin < '2024-01-01 00:00:00'::timestamp without time zone 
        AND (volumes.classification_uid <> ALL (ARRAY[2, 6, 10]))
)

SELECT mio_data.*, cm.centreline_id FROM mio_data
LEFT JOIN teps.centreline_miovision_20220705 cm
    ON mio_data.intersection_uid = cm.intersection_uid
    AND mio_data.leg = cm.leg
WHERE cm.centreline_id IS NULL