Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip non-numerics from PINs in default.vw_pin_appeal #680

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dbt/models/default/default.vw_pin_appeal.sql
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ WITH reasons AS (
-- Select distinct rows to deduplicate a few appeals that got published
-- twice by accident, otherwise we wouldn't expect any dupes in this query
SELECT DISTINCT
htpar.parid,
REGEXP_REPLACE(htpar.parid, '[^0-9]', '') AS parid,
htpar.taxyr,
htpar.caseno,
htpar.user38,
28 changes: 28 additions & 0 deletions dbt/models/default/schema/default.vw_pin_appeal.yml
Original file line number Diff line number Diff line change
@@ -81,3 +81,31 @@ unit_tests:
expect:
rows:
- {class: "211A"}
- name: default_vw_pin_appeal_pin_strips_non_numerics
description: pin transformation should remove non-numeric characters
model: default.vw_pin_appeal
given:
- input: source("iasworld", "htpar")
rows:
# `parid` is the important column here, and all other columns are
# only set to ensure proper joins and filters when creating the
# dummy tables
- {parid: "1-2.3)", taxyr: "2024", cur: "Y", deactivat: null, cpatty: "1", caseno: "1", heartyp: "A"}
- input: source("iasworld", "pardat")
rows:
- {parid: "123", taxyr: "2024", cur: "Y", deactivat: null}
- input: source("iasworld", "legdat")
rows:
- {parid: "123", taxyr: "2024", cur: "Y", deactivat: null}
- input: ref("default.vw_pin_value")
rows:
- {pin: "123", year: "2024"}
- input: source("iasworld", "htagnt")
rows:
- {agent: "1", cur: "Y", deactivat: null}
- input: ref("ccao.htpar_reascd")
rows:
- {reascd: "28"}
expect:
rows:
- {pin: "123"}