diff --git a/warehouse/models/mart/ntd/_mart_ntd.yml b/warehouse/models/mart/ntd/_mart_ntd.yml index 9fce418652..8a7b35a02e 100644 --- a/warehouse/models/mart/ntd/_mart_ntd.yml +++ b/warehouse/models/mart/ntd/_mart_ntd.yml @@ -68,6 +68,8 @@ models: description: The mode of service operated under the contract. A contractor can operate more than one mode/TOS under a contract (only one B-30 for that contractor). + - name: service_type + description: A summarization of modes into Fixed Route and Demand Response - name: tos description: The type of service operated under the contract. - name: time_period @@ -436,6 +438,8 @@ models: NTD recognizes a number of different modes including Motorbus (MB), Heavy Rail (HR), Light Rail (LR), and Demand Response (DR), among others. + - name: service_type + description: A summarization of modes into Fixed Route and Demand Response - name: _3_mode description: 3 Mode - A grouping of modes based upon whether the mode operates on rail, is a bus mode, is ferry boat service or other. @@ -446,6 +450,8 @@ models: - name: legacy_ntd_id description: Legacy NTD ID – The Transit Property’s NTD identification number in the Legacy NTD Database + - name: period_year_month + description: "" - name: period_month description: "" - name: period_year diff --git a/warehouse/models/mart/ntd/dim_annual_ntd_agency_service.sql b/warehouse/models/mart/ntd/dim_annual_ntd_agency_service.sql index c97dde2c74..4cb0332ea1 100644 --- a/warehouse/models/mart/ntd/dim_annual_ntd_agency_service.sql +++ b/warehouse/models/mart/ntd/dim_annual_ntd_agency_service.sql @@ -14,6 +14,11 @@ dim_annual_ntd_agency_service AS ( subrecipient_type, reporting_module, mode, + CASE + WHEN mode IN ('AR', 'CC', 'CR', 'HR', 'YR', 'IP', 'LR', 'MG', 'SR', 'TR', 'MB', 'RB', 'CB', 'TB', 'FB', 'IP') THEN 'Fixed Route' + WHEN mode IN ('DR', 'DT', 'VP', 'JT', 'PB') THEN 'Demand Response' + ELSE 'Unknown' -- mode is null sometimes + END AS service_type, tos, time_period, time_service_begins, diff --git a/warehouse/models/mart/ntd/dim_monthly_ntd_ridership_with_adjustments.sql b/warehouse/models/mart/ntd/dim_monthly_ntd_ridership_with_adjustments.sql index 48591b42d2..a46a98c7e5 100644 --- a/warehouse/models/mart/ntd/dim_monthly_ntd_ridership_with_adjustments.sql +++ b/warehouse/models/mart/ntd/dim_monthly_ntd_ridership_with_adjustments.sql @@ -14,9 +14,15 @@ select agency, mode_type_of_service_status, mode, + CASE + WHEN mode IN ('AR', 'CC', 'CR', 'HR', 'YR', 'IP', 'LR', 'MG', 'SR', 'TR', 'MB', 'RB', 'CB', 'TB', 'FB', 'IP', 'MO', 'AG') THEN 'Fixed Route' + WHEN mode IN ('DR', 'DT', 'VP', 'JT', 'PB') THEN 'Demand Response' + ELSE 'Unknown' -- mode is null sometimes + END AS service_type, _3_mode, tos, legacy_ntd_id, + concat(period_year, '-', lpad(period_month, 2, '0')) as period_year_month, period_year, period_month, upt,