Skip to content

Commit

Permalink
Bump data_test_iasworld_year_start to 2025 to reflect rollover
Browse files Browse the repository at this point in the history
  • Loading branch information
jeancochrane committed Jan 27, 2025
1 parent 62bf0e0 commit dc67f1b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dbt/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ vars:
# year, since errors in past data cannot usually be amended once records are
# closed. Set as an integer for compatibility with comparison operators and
# SQL's BETWEEN
data_test_iasworld_year_start: 2024
data_test_iasworld_year_start: 2025

# End year for iasWorld data tests. Typically set to a date in the future,
# but can also be use to select specific time frames for testing
Expand Down
6 changes: 6 additions & 0 deletions dbt/models/default/default.vw_pin_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ SELECT
leg.user1 AS township_code,
town.township_name,
REGEXP_REPLACE(par.nbhd, '([^0-9])', '') AS nbhd,
-- Add pre-mailed values to cover us for the period after the rollover but
-- before the year's assessment cycle starts
vwpv.pre_mailed_class,
vwpv.pre_mailed_bldg,
vwpv.pre_mailed_land,
vwpv.pre_mailed_tot,
vwpv.mailed_class,
vwpv.mailed_bldg,
vwpv.mailed_land,
Expand Down
8 changes: 8 additions & 0 deletions dbt/models/default/schema/default.vw_pin_history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ models:
description: '{{ doc("shared_column_mailed_tot") }}'
- name: pin
description: '{{ doc("shared_column_pin") }}'
- name: pre_mailed_bldg
description: '{{ doc("shared_column_pre_mailed_bldg") }}'
- name: pre_mailed_class
description: '{{ doc("shared_column_pre_mailed_class") }}'
- name: pre_mailed_land
description: '{{ doc("shared_column_pre_mailed_land") }}'
- name: pre_mailed_tot
description: '{{ doc("shared_column_pre_mailed_tot") }}'
- name: township_code
description: '{{ doc("shared_column_township_code") }}'
- name: township_name
Expand Down
6 changes: 3 additions & 3 deletions dbt/models/default/schema/default.vw_pin_value.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,21 @@ models:
column_name: board_class
config:
where: CAST(year AS int) < {{ var('data_test_iasworld_year_start') }} - 1
error_if: ">1260"
error_if: ">1261"
- not_null:
name: default_vw_pin_value_board_tot_mv_not_null
column_name: board_tot_mv
config:
where: |
CAST(year AS int) < {{ var('data_test_iasworld_year_start') }} - 1 AND
year >= '2020'
error_if: ">1260"
error_if: ">1261"
- not_null:
name: default_vw_pin_value_board_tot_not_null
column_name: board_tot
config:
where: CAST(year AS int) < {{ var('data_test_iasworld_year_start') }} - 1
error_if: ">1260"
error_if: ">1261"
- not_null:
name: default_vw_pin_value_certified_class_not_null
column_name: certified_class
Expand Down
5 changes: 4 additions & 1 deletion dbt/models/reporting/reporting.vw_top_5_muni.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ most_recent_values AS (
pin,
year,
oneyr_pri_board_tot AS prior_bor_av,
COALESCE(certified_tot, mailed_tot) AS ccao_av,
COALESCE(certified_tot, mailed_tot, pre_mailed_tot) AS ccao_av,
CASE
WHEN
(certified_tot IS NULL AND mailed_tot IS NULL)
THEN 'pre-mailed'
WHEN certified_tot IS NULL THEN 'mailed'
ELSE 'certified'
END AS ccao_stage_used,
Expand Down
10 changes: 10 additions & 0 deletions dbt/models/reporting/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,16 @@ models:

- name: reporting.vw_top_5_muni
description: '{{ doc("view_vw_top_5_muni") }}'
columns:
- name: ccao_stage_used
data_tests:
- accepted_values:
name: reporting_vw_top_5_muni_ccao_stage_used_certified_in_prior_years
values:
- certified
config:
where: >
CAST(year AS int) < {{ var('data_test_iasworld_year_start') }}
data_tests:
# It would be nice to move hyphen checks to unit tests, but the fixture
# definitions would be extremely complicated, so for now we leave them
Expand Down

0 comments on commit dc67f1b

Please sign in to comment.