-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #450 from cagov/hang_bottleneck_dashboard
Bottleneck Dashboard
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
transform/models/marts/performance/performance__bottleneck_delay_agg_daily.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
with daily_bottleneck_delay as ( | ||
select | ||
station_id, | ||
sample_date, | ||
time_shift, | ||
cast(district as int) as district, | ||
station_type, | ||
freeway, | ||
direction, | ||
absolute_postmile, | ||
daily_time_shift_duration, | ||
daily_time_shift_bottleneck_extent, | ||
daily_time_shift_spatial_delay_35_mph, | ||
daily_time_shift_spatial_delay_40_mph, | ||
daily_time_shift_spatial_delay_45_mph, | ||
daily_time_shift_spatial_delay_50_mph, | ||
daily_time_shift_spatial_delay_55_mph, | ||
daily_time_shift_spatial_delay_60_mph, | ||
county | ||
from {{ ref('int_performance__bottleneck_delay_metrics_agg_daily') }} | ||
), | ||
|
||
bottleneck_delay_with_county as ( | ||
{{ get_county_name('daily_bottleneck_delay') }} | ||
), | ||
|
||
geo as ( | ||
select distinct | ||
station_id, | ||
latitude, | ||
longitude, | ||
concat(longitude, ',', latitude) as location | ||
from {{ ref('geo__current_detectors') }} | ||
), | ||
|
||
bottleneck_delay_county_geo as ( | ||
select | ||
bottleneck_delay_with_county.*, | ||
geo.latitude, | ||
geo.longitude, | ||
geo.location | ||
from | ||
bottleneck_delay_with_county | ||
inner join | ||
geo | ||
on bottleneck_delay_with_county.station_id = geo.station_id | ||
) | ||
|
||
select * from bottleneck_delay_county_geo |