-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
88529ac
commit 88b2654
Showing
10 changed files
with
52 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
volumes/miovision/sql/views/create-view-volumes_15min_filtered.sql
This file was deleted.
Oops, something went wrong.
29 changes: 19 additions & 10 deletions
29
volumes/miovision/sql/views/create-view-volumes_15min_mvt_filtered.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,42 @@ | ||
CREATE VIEW miovision_api.volumes_15min_mvt_filtered AS ( | ||
CREATE OR REPLACE VIEW miovision_api.volumes_15min_mvt_filtered AS ( | ||
SELECT | ||
v15.volume_15min_mvt_uid, | ||
v15.intersection_uid, | ||
v15.datetime_bin, | ||
v15.classification_uid, | ||
v15.leg, | ||
v15.movement_uid, | ||
v15.volume, | ||
v15.processed | ||
FROM miovision_api.volumes_15min_mvt AS v15 | ||
v15.volume | ||
FROM miovision_api.volumes_15min_mvt_unfiltered AS v15 | ||
--only include "common" movements | ||
JOIN miovision_api.intersection_movements USING ( | ||
intersection_uid, classification_uid, leg, movement_uid | ||
) | ||
--anti join unacceptable_gaps | ||
LEFT JOIN miovision_api.unacceptable_gaps AS un USING (datetime_bin, intersection_uid) | ||
--anti join anomalous_ranges | ||
LEFT JOIN miovision_api.anomalous_ranges AS ar | ||
ON ar.problem_level = ANY(ARRAY['do-not-use', 'questionable']) | ||
ON (ar.problem_level = ANY(ARRAY['do-not-use'::text, 'questionable'::text])) | ||
AND ar.intersection_uid = v15.intersection_uid | ||
AND ( | ||
ar.classification_uid = v15.classification_uid | ||
OR ar.classification_uid IS NULL | ||
) AND ( | ||
ar.leg = v15.leg | ||
OR ar.leg IS NULL | ||
) AND v15.datetime_bin >= ar.range_start | ||
) | ||
AND v15.datetime_bin >= ar.range_start | ||
AND ( | ||
v15.datetime_bin <= ar.range_end | ||
OR ar.range_end IS NULL | ||
) | ||
WHERE ar.uid IS NULL | ||
WHERE | ||
ar.uid IS NULL | ||
AND un.datetime_bin IS NULL | ||
); | ||
|
||
COMMENT ON VIEW miovision_api.volumes_15min_mvt_filtered IS E'' | ||
'miovision_api.volumes_15min_mvt with anomalous_ranges labeled ' | ||
'''do-not-use'' or ''questionable'' filtered out.'; | ||
'miovision_api.volumes_15min with anomalous_ranges labeled ' | ||
'''do-not-use'' or ''questionable'' filtered out, unacceptable_gaps anti-joined, | ||
and only common (>0.05%) movements (`intersection_movements`) included.'; | ||
|
||
GRANT SELECT ON TABLE miovision_api.volumes_15min_mvt_filtered TO bdit_humans; |
16 changes: 11 additions & 5 deletions
16
volumes/miovision/sql/views/create-view-volumes_15min_tmc.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters