-
Notifications
You must be signed in to change notification settings - Fork 4
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
Make vw_pin_appeal
unique by pin
, year
, case_no
#674
Conversation
-- reason codes. | ||
-- CTE so that we can join reason descriptions onto cleaned reason codes. | ||
WITH reasons AS ( | ||
SELECT | ||
htpar.*, | ||
SELECT DISTINCT | ||
htpar.parid, | ||
htpar.taxyr, | ||
htpar.caseno, | ||
htpar.user38, | ||
htpar.user104, | ||
htpar.resact, | ||
htpar.hrstatus, | ||
htpar.cpatty, | ||
-- user125 isn't used in the view, but it's FilingID and we want to | ||
-- include it to make sure we're only dropping true dupes using DISTINCT | ||
htpar.user125, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulling in the smallest number of columns I can because of the DISTINCT
LEFT JOIN {{ source('iasworld', 'pardat') }} AS pardat | ||
-- This is an INNER JOIN since there are apparently parcels in htpar that are | ||
-- not in pardat. See 31051000511064, 2008. | ||
INNER JOIN {{ source('iasworld', 'pardat') }} AS pardat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some godforsaken reason there are PINs in htpar
that are not in pardat
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question, non-blocking] Why remove these PINs, when the only side effect of their inclusion would be some appeals with null classes? We could just document that artifact in the view? I guess I don't feel super confident that in these cases the mistake lies in extraneous appeals, rather than missing rows from pardat
. But if you do, I'm happy to move forward with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thought was that we usually depend on pardat or the parcel shapefile as our parcel universe. Once we start letting pins from outside of those two sources into views our universe is going to be inconsistent across tables, views, etc. Personally, I trust pardat more than htpar.
WHERE htpar.cur = 'Y' | ||
AND htpar.deactivat IS NULL | ||
AND htpar.caseno IS NOT NULL | ||
AND htpar.heartyp IN ('A', 'C') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conditional means we'll only get strictly defined appeals - I'm not entirely positive that's what we want, but it is what we suggest our view is. If we allow in other values for this column we need to address three appeals in 2022 that have both "E" and "A" heartyp
for the same pin
, case_no
, year
.
vw_pin_appeal
unique by pin
, year
, case_no
@@ -59,7 +65,7 @@ unit_tests: | |||
- {parid: "123", taxyr: "2024", cur: "Y", deactivat: null, class: "2.1-1)A"} | |||
- input: source("iasworld", "htpar") | |||
rows: | |||
- {parid: "123", taxyr: "2024", cur: "Y", deactivat: null, cpatty: "1", caseno: "1"} | |||
- {parid: "123", taxyr: "2024", cur: "Y", deactivat: null, cpatty: "1", caseno: "1", heartyp: "A", user125: "A", user38: "CC", user104: "A", resact: "A", hrstatus: "A", user100: "A", user101: "A", user89: "A"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeancochrane this works, but I'm not sure if I've included extraneous columns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work with only heartyp
, since that's the only new column that's being used in a table filter or join. The rest of the new columns here after heartyp
should be unnecessary, since we're not testing their output and the default that dbt chooses (null) won't affect joins or filters. Does that work as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work tracking down some tricky behavior here! A couple thoughts below, but nothing serious.
Before we merge, could we also update the data catalog docs for iasworld.htpar.heartyp
to include the enumerated values that you explained in the body of the PR? I assume we also need to add descriptions for A
and C
:
O = Omitted Assessments, which are new for 2024 and by next year, there will the following new ones as well as others that will be used by the Tax side:
E = COE only
EE = Erroneous Exemptions (will likely change it to avoid conflict with E)
P = PTAB Refunds (Treasurer)
S = Specific Objections (Treasurer)
LEFT JOIN {{ source('iasworld', 'pardat') }} AS pardat | ||
-- This is an INNER JOIN since there are apparently parcels in htpar that are | ||
-- not in pardat. See 31051000511064, 2008. | ||
INNER JOIN {{ source('iasworld', 'pardat') }} AS pardat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question, non-blocking] Why remove these PINs, when the only side effect of their inclusion would be some appeals with null classes? We could just document that artifact in the view? I guess I don't feel super confident that in these cases the mistake lies in extraneous appeals, rather than missing rows from pardat
. But if you do, I'm happy to move forward with this.
Co-authored-by: Jean Cochrane <jeancochrane@users.noreply.github.com>
default.vw_pin_appeal
is not unique bypin
,year
,case_no
as our docs suggest it should be. There are actual duplicates iniasworld.htpar
that need to be removed. While I was trying to sort this out, Mirella told me we should also be much more parsimonious in terms of which values forhtpar.heartyp
we include in order to exclude things like PTAB adjustments and erroneous exemptions.(After some initial confusion on my part, I confirmed she meant "only include 'A' and 'C'")
yields zero rows.