Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
10 changes: 10 additions & 0 deletions dbt/models/pinval/columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ There are two cases in which this column might be null:

{% enddocs %}

## pin_class

{% docs column_pinval_pin_class %}
The property class for the PIN.

Unlike `char_class`, which may vary per card,
`pin_class` always reflects the class assigned to the PIN in
`default.vw_pin_universe`.
{% enddocs %}

## reason_report_ineligible

{% docs column_pinval_reason_report_ineligible %}
Expand Down
5 changes: 5 additions & 0 deletions dbt/models/pinval/pinval.assessment_card.sql
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ SELECT
COALESCE(twn.township_name, uni.township_name) AS meta_township_name,
COALESCE(ac.meta_nbhd_code, uni.nbhd_code) AS meta_nbhd_code,
LOWER(uni.triad_name) AS meta_triad_name,
uni.class AS pin_class,
COALESCE(ac.char_class, uni.class) AS char_class,
COALESCE(card_cd.class_desc, pin_cd.class_desc) AS char_class_desc,
COALESCE(ac.assessment_triad, uni.assessment_triad)
Expand Down Expand Up @@ -282,6 +283,10 @@ SELECT
-- can be a useful signal of something going wrong with our eligibility
-- criteria, so instead we hardcode this exception.
AND NOT (ac.meta_pin = '10361150280000' AND ac.assessment_year = '2024')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion, optional] Now that we're using pin_class as the basis of the non-regression class check in is_report_eligible, I think we no longer need a hardcoded exception for this PIN, because it now has regression_class = FALSE:

select
    card.meta_pin,
    card.meta_card_num,
    card.pin_class,
    card.char_class,
    class_dict.regression_class,
    class_dict.modeling_group
from z_ci_add_pin_class_to_custom_homeval_message_pinval.assessment_card as card
left join ccao.class_dict as class_dict
    on card.pin_class = class_dict.class_code
where card.meta_pin = '10361150280000' and card.assessment_year = '2024'
meta_pin meta_card_num pin_class char_class regression_class modeling_group
10361150280000 1 100 204 false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming this

-- Only count as report eligible if pin has a valid regression class
AND pin_cd.class_code IS NOT NULL
AND pin_cd.regression_class
AND pin_cd.modeling_group IN ('SF', 'MF', 'BB')
) AS is_report_eligible,
CASE
-- In some rare cases the parcel class can be different from
Expand Down
3 changes: 2 additions & 1 deletion dbt/models/pinval/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ models:
data_tests:
- not_null:
name: pinval_assessment_card_meta_triad_name_not_null
- name: pin_class
description: '{{ doc("column_pinval_pin_class") }}'
- name: reason_report_ineligible
description: '{{ doc("column_pinval_reason_report_ineligible") }}'
data_tests:
Expand All @@ -127,7 +129,6 @@ models:
# There are a handful of known PINs that had the wrong class
# at modeling time, and so got a model value even though it
# should not have
error_if: ">6"
- not_accepted_values:
name: pinval_assessment_card_reason_report_ineligible_not_non_tri_for_tri
values:
Expand Down
Loading