Skip to content

Commit

Permalink
Merge branch 'main' into git_action_testground
Browse files Browse the repository at this point in the history
  • Loading branch information
vevetron authored Feb 4, 2025
2 parents c8a86de + 66999d7 commit 83ae54d
Show file tree
Hide file tree
Showing 91 changed files with 4,705 additions and 51 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{ config(materialized="table") }}

WITH
source_pivoted AS (
{{
dbt_utils.unpivot(
cast_to="int",
relation=ref("stg_ntd__capital_expenditures_time_series__facilities"),
exclude=[
"_2023_mode_status",
"agency_name",
"agency_status",
"census_year",
"city",
"last_report_year",
"legacy_ntd_id",
"mode",
"ntd_id",
"reporter_type",
"reporting_module",
"state",
"uace_code",
"uza_area_sq_miles",
"uza_name",
"uza_population",
"dt",
"execution_ts"
],
field_name="year",
value_name="facilities",
)
}}
),

int_ntd__capital_expenditures_time_series_facilities AS (
SELECT
agency_name,
agency_status,
census_year,
city,
last_report_year,
legacy_ntd_id,
mode,
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id,
reporter_type,
reporting_module,
state,
uace_code,
uza_area_sq_miles,
uza_name,
uza_population,
split(year, '_')[offset(1)] AS year,
facilities,
_2023_mode_status,
dt,
execution_ts
FROM source_pivoted
)

SELECT * FROM int_ntd__capital_expenditures_time_series_facilities
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{ config(materialized="table") }}

WITH
source_pivoted AS (
{{
dbt_utils.unpivot(
cast_to="int",
relation=ref("stg_ntd__capital_expenditures_time_series__other"),
exclude=[
"_2023_mode_status",
"agency_name",
"agency_status",
"census_year",
"city",
"last_report_year",
"legacy_ntd_id",
"mode",
"ntd_id",
"reporter_type",
"reporting_module",
"state",
"uace_code",
"uza_area_sq_miles",
"uza_name",
"uza_population",
"dt",
"execution_ts"
],
field_name="year",
value_name="other",
)
}}
),

int_ntd__capital_expenditures_time_series_other AS (
SELECT
agency_name,
agency_status,
census_year,
city,
last_report_year,
legacy_ntd_id,
mode,
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id,
reporter_type,
reporting_module,
state,
uace_code,
uza_area_sq_miles,
uza_name,
uza_population,
split(year, '_')[offset(1)] AS year,
other,
_2023_mode_status,
dt,
execution_ts
FROM source_pivoted
)

SELECT * FROM int_ntd__capital_expenditures_time_series_other
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{ config(materialized="table") }}

WITH
source_pivoted AS (
{{
dbt_utils.unpivot(
cast_to="int",
relation=ref("stg_ntd__capital_expenditures_time_series__rolling_stock"),
exclude=[
"_2023_mode_status",
"agency_name",
"agency_status",
"census_year",
"city",
"last_report_year",
"legacy_ntd_id",
"mode",
"ntd_id",
"reporter_type",
"reporting_module",
"state",
"uace_code",
"uza_area_sq_miles",
"uza_name",
"uza_population",
"dt",
"execution_ts"
],
field_name="year",
value_name="rolling_stock",
)
}}
),

int_ntd__capital_expenditures_time_series_rolling_stock AS (
SELECT
agency_name,
agency_status,
census_year,
city,
last_report_year,
legacy_ntd_id,
mode,
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id,
reporter_type,
reporting_module,
state,
uace_code,
uza_area_sq_miles,
uza_name,
uza_population,
split(year, '_')[offset(1)] AS year,
rolling_stock,
_2023_mode_status,
dt,
execution_ts
FROM source_pivoted
)

SELECT * FROM int_ntd__capital_expenditures_time_series_rolling_stock
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{ config(materialized="table") }}

WITH
source_pivoted AS (
{{
dbt_utils.unpivot(
cast_to="int",
relation=ref("stg_ntd__capital_expenditures_time_series__total"),
exclude=[
"_2023_mode_status",
"agency_name",
"agency_status",
"census_year",
"city",
"last_report_year",
"legacy_ntd_id",
"mode",
"ntd_id",
"reporter_type",
"reporting_module",
"state",
"uace_code",
"uza_area_sq_miles",
"uza_name",
"uza_population",
"dt",
"execution_ts"
],
field_name="year",
value_name="total",
)
}}
),

int_ntd__capital_expenditures_time_series_total AS (
SELECT
agency_name,
agency_status,
census_year,
city,
last_report_year,
legacy_ntd_id,
mode,
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id,
reporter_type,
reporting_module,
state,
uace_code,
uza_area_sq_miles,
uza_name,
uza_population,
split(year, '_')[offset(1)] AS year,
total,
_2023_mode_status,
dt,
execution_ts
FROM source_pivoted
)

SELECT * FROM int_ntd__capital_expenditures_time_series_total
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{ config(materialized="table") }}

WITH
source_pivoted AS (
{{
dbt_utils.unpivot(
cast_to="int",
relation=ref("stg_ntd__operating_and_capital_funding_time_series__capital_federal"),
exclude=[
"_2023_status",
"agency_name",
"agency_status",
"census_year",
"city",
"last_report_year",
"legacy_ntd_id",
"ntd_id",
"reporter_type",
"reporting_module",
"state",
"uace_code",
"uza_area_sq_miles",
"primary_uza_name",
"uza_population",
"dt",
"execution_ts"
],
field_name="year",
value_name="capital_federal",
)
}}
),

int_ntd__operating_and_capital_funding_time_series_capital_federal AS (
SELECT
agency_name,
agency_status,
census_year,
city,
last_report_year,
legacy_ntd_id,
format("%05d", cast(cast(ntd_id AS NUMERIC) AS INT64)) AS ntd_id,
reporter_type,
reporting_module,
state,
uace_code,
uza_area_sq_miles,
primary_uza_name,
uza_population,
split(year, '_')[offset(1)] AS year,
capital_federal,
_2023_status,
dt,
execution_ts
FROM source_pivoted
)

SELECT * FROM int_ntd__operating_and_capital_funding_time_series_capital_federal
Loading

0 comments on commit 83ae54d

Please sign in to comment.