Skip to content

Commit

Permalink
Minor ridership fixes (#3378)
Browse files Browse the repository at this point in the history
* feat(dim_monthly_ntd_ridership_with_adjustments): adds a period_year_month column to make reporting by date easier,  adds service_mode and adds two more modes to service_type

* feat(dim_annual_ntd_agency_service): adds new category service_type to make analysis easier on the different modes
  • Loading branch information
vevetron authored Jun 28, 2024
1 parent 493b894 commit eabfbe6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions warehouse/models/mart/ntd/_mart_ntd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions warehouse/models/mart/ntd/dim_annual_ntd_agency_service.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit eabfbe6

Please sign in to comment.