Add pin class to pinval.assessment_card#1000
Conversation
pinval.assessment_card
dbt/models/pinval/schema.yml
Outdated
| # at modeling time, and so got a model value even though it | ||
| # should not have | ||
| error_if: ">6" | ||
| error_if: ">22" |
There was a problem hiding this comment.
[Nitpick, blocking] Hmm, there shouldn't be this many ineligible reports. Let me take a look at this before we merge.
There was a problem hiding this comment.
OK, I think I have a proposal of how we can resolve these errors for good. This query demonstrates that all the PINs that are failing this check are PINs that have regression-class cards, but non-regression-class PINs:
select
card.meta_pin,
card.meta_card_num,
card.pin_class,
card.char_class,
card.is_report_eligible,
card.reason_report_ineligible,
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.is_report_eligible
and card.reason_report_ineligible is not nullIn the past, we've chosen not to consider the card class or PIN class when computing is_report_eligible because we believed that any mismatches could be a useful flag that the model is valuing PINs that have non-regression classes. However, after thinking about it more, I think this is not the right place to implement that flag, because HomeVal is ultimately a totally separate process from modeling and we don't want modeling errors to block HomeVal changes.
I think the easiest fix, then, would be to consider PIN class when computing is_report_eligible. If a PIN is not a regression class, we should not show a report for it, even if the model valued it; I think this makes sense because the report will be misleading in those cases.
Here's the block we'll need to change to consider PIN class when computing is_report_eligible:
data-architecture/dbt/models/pinval/pinval.assessment_card.sql
Lines 247 to 285 in cc4758e
We don't need to copy the changes to reason_report_ineligible because they are already implemented there:
data-architecture/dbt/models/pinval/pinval.assessment_card.sql
Lines 286 to 307 in cc4758e
Co-authored-by: Jean Cochrane <jeancochrane@users.noreply.github.com>
jeancochrane
left a comment
There was a problem hiding this comment.
I'm glad we can resolve the pinval_assessment_card_reason_report_ineligible_is_null_when_is_report_eligible errors while also improving the query. Nice work!
| @@ -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') | |||
There was a problem hiding this comment.
[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 |
There was a problem hiding this comment.
Thanks for confirming this
Bring in the pin class to
pinval.assessment_card. Supports ccao-data/homeval#155(PR #1000 btw)