Skip to content
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

Detector Status and Set Assignment Updates #499

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,19 @@ station_diagnostic_set_assign as (
station_id,
district,
station_type,
dt_set_id,
_valid_from as station_valid_from,
_valid_to as station_valid_to,
case
/*when LIKE(UPPER(THRESHOLD_SET), "LOW%") then "Low_Volume"
This value is currently in district config file but not in
our current metadata files
when LIKE(UPPER(THRESHOLD_SET), "RURAL%") then "Rural"
We need the definition of when a station is considered
Rural from Iteris
*/
when district = 11 then 'Urban_D11'
when district = 6 then 'D6_Ramps'
when UPPER(dt_set_id) like 'LOW%' then 'Low_Volume'
when UPPER(dt_set_id) like 'RURAL%' then 'Rural'
when UPPER(dt_set_id) like 'URBAN_D11%' then 'Urban_D11'
when UPPER(dt_set_id) like 'D6_RAMPS%' then 'D6_Ramps'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to understand the logic. Does this imply each detector has different thresholds for each category?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The threshold set and method is applied at the station level. @thehanggit there isn't much documentation in the user guide but what I've been able to discover is that each station is associated with a threshold set based on the metadata coming from the configuration files sent by district or the threshold set can be manually defined in the PeMS application. The threshold set corresponds to the diagnostic criteria found in the diagnostic_threshold_values.csv seed file. If a threshold set value is not provided by district in the configuration file or in the PeMS application, the default is "Urban". The diagnostic test method (second column in the seed file) is based on the station type. Once we know the threshold set and method, we can apply the corresponding diagnostic criteria to stations and their associated detectors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The threshold set and method is applied at the station level. @thehanggit there isn't much documentation in the user guide but what I've been able to discover is that each station is associated with a threshold set based on the metadata coming from the configuration files sent by district or the threshold set can be manually defined in the PeMS application. The threshold set corresponds to the diagnostic criteria found in the diagnostic_threshold_values.csv seed file. If a threshold set value is not provided by district in the configuration file or in the PeMS application, the default is "Urban". The diagnostic test method (second column in the seed file) is based on the station type. Once we know the threshold set and method, we can apply the corresponding diagnostic criteria to stations and their associated detectors.

Thanks! That means the detector status would be aligned with the old PeMS by implementing the similar threshold set.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The threshold set and method is applied at the station level. @thehanggit there isn't much documentation in the user guide but what I've been able to discover is that each station is associated with a threshold set based on the metadata coming from the configuration files sent by district or the threshold set can be manually defined in the PeMS application. The threshold set corresponds to the diagnostic criteria found in the diagnostic_threshold_values.csv seed file. If a threshold set value is not provided by district in the configuration file or in the PeMS application, the default is "Urban". The diagnostic test method (second column in the seed file) is based on the station type. Once we know the threshold set and method, we can apply the corresponding diagnostic criteria to stations and their associated detectors.

Thanks! That means the detector status would be aligned with the old PeMS by implementing the similar threshold set.

As long as they are similar in the upper-level tables, we can cite their threshold as reference in yaml file to make it clear.

else 'Urban'
end as station_diagnostic_set_id,
case
when station_type in ('FR', 'OR') then 'ramp'
else 'mainline'
when station_type in ('ML', 'HV') then 'mainline'
else 'ramp'
end as station_diagnostic_method_id

from {{ ref ('int_vds__active_stations') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,33 +86,39 @@ detector_status as (
then 'Insufficient Data'
when
awm.station_diagnostic_method_id = 'ramp'
and sps.zero_vol_ct / ({{ var("detector_status_max_sample_value") }})
> (awm.zero_flow_percent / 100)
and
(sps.zero_vol_ct / sps.sample_ct)
>= (awm.zero_flow_percent / 100)
then 'Card Off'
when
awm.station_diagnostic_method_id = 'mainline'
and sps.zero_occ_ct / ({{ var("detector_status_max_sample_value") }})
> (awm.zero_occupancy_percent / 100)
and
(sps.zero_occ_ct / sps.sample_ct)
>= (awm.zero_occupancy_percent / 100)
then 'Card Off'
when
awm.station_diagnostic_method_id = 'ramp'
and sps.high_volume_ct / ({{ var("detector_status_max_sample_value") }})
> (awm.high_flow_percent / 100)
and
(sps.high_volume_ct / sps.sample_ct)
>= (awm.high_flow_percent / 100)
then 'High Val'
when
awm.station_diagnostic_method_id = 'mainline'
and sps.high_occupancy_ct / ({{ var("detector_status_max_sample_value") }})
> (awm.high_occupancy_percent / 100)
and
(sps.high_occupancy_ct / sps.sample_ct)
>= (awm.high_occupancy_percent / 100)
then 'High Val'
when
awm.station_diagnostic_method_id = 'mainline'
and sps.zero_vol_pos_occ_ct / ({{ var("detector_status_max_sample_value") }})
> (awm.flow_occupancy_percent / 100)
and
(sps.zero_vol_pos_occ_ct / sps.sample_ct)
>= (awm.flow_occupancy_percent / 100)
then 'Intermittent'
when
awm.station_diagnostic_method_id = 'mainline'
and sps.zero_occ_pos_vol_ct / ({{ var("detector_status_max_sample_value") }})
> (awm.occupancy_flow_percent / 100)
and
(sps.zero_occ_pos_vol_ct / sps.sample_ct)
>= (awm.occupancy_flow_percent / 100)
then 'Intermittent'
when
coalesce(co.min_occupancy_delta = 0, false)
Expand Down
Loading