Skip to content

Conversation

@gabrielwol
Copy link
Collaborator

@gabrielwol gabrielwol commented Nov 6, 2025

What this pull request accomplishes:

3 new functions:

  • delete auto ARs for one day
  • merge consecutive/overlapping ARs
  • perform delete + add + merge functions in sequence

Issue(s) this solves:

What, in particular, needs to reviewed:

What needs to be done by a sysadmin after this PR is merged

E.g.: these tables need to be migrated/created in the production schema.

Test:

DROP TABLE IF EXISTS gwolofs.anomalous_range_copy_20251106;

CREATE TABLE gwolofs.anomalous_range_copy_20251106 AS SELECT intersection_uid, classification_uid, notes, investigation_level, problem_level, range_start, range_end, leg FROM miovision_api.anomalous_ranges;

SELECT miovision_api.identify_anomalous_ranges('2025-11-01'::date);

--check results are the same:
SELECT intersection_uid, classification_uid, notes, investigation_level, problem_level, range_start, range_end, leg FROM miovision_api.anomalous_ranges
EXCEPT
SELECT intersection_uid, classification_uid, notes, investigation_level, problem_level, range_start, range_end, leg FROM gwolofs.anomalous_range_copy_20251106;

SELECT intersection_uid, classification_uid, notes, investigation_level, problem_level, range_start, range_end, leg FROM gwolofs.anomalous_range_copy_20251106
EXCEPT
SELECT intersection_uid, classification_uid, notes, investigation_level, problem_level, range_start, range_end, leg FROM miovision_api.anomalous_ranges
--also test with some intersections that have outages;
SELECT * FROM miovision_api.anomalous_ranges ar WHERE
        ar.range_start = '2025-11-01'::date
        AND ar.range_end = '2025-11-01'::date + 1
        AND ar.investigation_level = 'auto_flagged';

DROP TABLE IF EXISTS gwolofs.anomalous_range_copy_20251106;

CREATE TABLE gwolofs.anomalous_range_copy_20251106 AS SELECT intersection_uid, classification_uid, notes, investigation_level, problem_level, range_start, range_end, leg FROM miovision_api.anomalous_ranges;

SELECT miovision_api.identify_anomalous_ranges('2025-11-01'::date, '{49, 54}'::int[]);

--check results are the same:
SELECT intersection_uid, classification_uid, notes, investigation_level, problem_level, range_start, range_end, leg FROM miovision_api.anomalous_ranges
EXCEPT
SELECT intersection_uid, classification_uid, notes, investigation_level, problem_level, range_start, range_end, leg FROM gwolofs.anomalous_range_copy_20251106;

SELECT intersection_uid, classification_uid, notes, investigation_level, problem_level, range_start, range_end, leg FROM gwolofs.anomalous_range_copy_20251106
EXCEPT
SELECT intersection_uid, classification_uid, notes, investigation_level, problem_level, range_start, range_end, leg FROM miovision_api.anomalous_ranges

@gabrielwol gabrielwol self-assigned this Nov 6, 2025
@gabrielwol gabrielwol added enhancement Miovision Permanent intersection-based video multimodal volume collection. Also use "Permanent Sensors" label labels Nov 6, 2025
@gabrielwol gabrielwol linked an issue Nov 6, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Miovision Permanent intersection-based video multimodal volume collection. Also use "Permanent Sensors" label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clear automated anomalous_ranges during pull

2 participants