From 48885630e2b78ed313f5c98c43e005818816cc63 Mon Sep 17 00:00:00 2001 From: V Date: Fri, 21 Jun 2024 15:05:01 -0700 Subject: [PATCH 1/4] feat(dim_monthly_ntd_ridership_with_adjustments): adds a period_year_month column to make reporting by date easier --- warehouse/models/mart/ntd/_mart_ntd.yml | 2 ++ .../mart/ntd/dim_monthly_ntd_ridership_with_adjustments.sql | 1 + 2 files changed, 3 insertions(+) diff --git a/warehouse/models/mart/ntd/_mart_ntd.yml b/warehouse/models/mart/ntd/_mart_ntd.yml index 9fce418652..c2b533636b 100644 --- a/warehouse/models/mart/ntd/_mart_ntd.yml +++ b/warehouse/models/mart/ntd/_mart_ntd.yml @@ -446,6 +446,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_monthly_ntd_ridership_with_adjustments.sql b/warehouse/models/mart/ntd/dim_monthly_ntd_ridership_with_adjustments.sql index 48591b42d2..37a58d49c0 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 @@ -17,6 +17,7 @@ select _3_mode, tos, legacy_ntd_id, + concat(period_year, '-', lpad(period_month, 2, '0')) as period_year_month, period_year, period_month, upt, From eb0c102e83d59b58dfe367f5ce0e35bb5c767c08 Mon Sep 17 00:00:00 2001 From: V Date: Fri, 21 Jun 2024 16:10:59 -0700 Subject: [PATCH 2/4] feat(dim_annual_ntd_agency_service): adds new category service_type to make analysis easier on the different modes --- warehouse/models/mart/ntd/_mart_ntd.yml | 2 ++ warehouse/models/mart/ntd/dim_annual_ntd_agency_service.sql | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/warehouse/models/mart/ntd/_mart_ntd.yml b/warehouse/models/mart/ntd/_mart_ntd.yml index c2b533636b..7723c12b72 100644 --- a/warehouse/models/mart/ntd/_mart_ntd.yml +++ b/warehouse/models/mart/ntd/_mart_ntd.yml @@ -436,6 +436,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. 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, From 892d3d96a1f8e09291d5f123d96528e62c0de81b Mon Sep 17 00:00:00 2001 From: V Date: Wed, 26 Jun 2024 11:02:35 -0700 Subject: [PATCH 3/4] feat(dim_monthly_ntd_ridership_with_adjustments): added service_mode --- warehouse/models/mart/ntd/_mart_ntd.yml | 2 ++ .../mart/ntd/dim_monthly_ntd_ridership_with_adjustments.sql | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/warehouse/models/mart/ntd/_mart_ntd.yml b/warehouse/models/mart/ntd/_mart_ntd.yml index 7723c12b72..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 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 37a58d49c0..eab3342983 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,6 +14,11 @@ 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') 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, From 8dc8edbe02d419d3075b217712ca2524873d6b1e Mon Sep 17 00:00:00 2001 From: V <156962295+vevetron@users.noreply.github.com> Date: Wed, 26 Jun 2024 14:05:34 -0700 Subject: [PATCH 4/4] feat(dim_monthly_ntd_ridership_with_adjustments.sql): adds two more modes to service_type --- .../mart/ntd/dim_monthly_ntd_ridership_with_adjustments.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 eab3342983..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 @@ -15,7 +15,7 @@ select 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') THEN 'Fixed Route' + 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,