From 5dc965d9ec46578150cbc90d500c725480327e1b Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Wed, 18 Dec 2024 20:33:02 +0000 Subject: [PATCH] Attempt multi-card inclusion --- dbt/models/model/model.vw_card_res_input.sql | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/dbt/models/model/model.vw_card_res_input.sql b/dbt/models/model/model.vw_card_res_input.sql index 6f33c9ada..6099723c9 100644 --- a/dbt/models/model/model.vw_card_res_input.sql +++ b/dbt/models/model/model.vw_card_res_input.sql @@ -818,13 +818,12 @@ FROM forward_fill AS f1 LEFT JOIN ( SELECT * FROM forward_fill - WHERE NOT ind_pin_is_multicard - /* Unfortunately, some res parcels are not unique by pin10, card, and - year. This complicates one of our core assumptions about the res parcel - universe. - See https://github.com/ccao-data/data-architecture/issues/558 for more - information. */ - AND SUBSTR(meta_pin, 11, 4) = '0000' + /* Unfortunately, some res parcels are not unique by pin10, card, and + year. This complicates one of our core assumptions about the res parcel + universe. + See https://github.com/ccao-data/data-architecture/issues/558 for more + information. */ + WHERE SUBSTR(meta_pin, 11, 4) = '0000' AND nearest_neighbor_1_dist_ft <= 500 ) AS nn1 ON f1.nearest_neighbor_1_pin10 = nn1.meta_pin10 @@ -832,8 +831,7 @@ LEFT JOIN ( LEFT JOIN ( SELECT * FROM forward_fill - WHERE NOT ind_pin_is_multicard - AND SUBSTR(meta_pin, 11, 4) = '0000' + WHERE SUBSTR(meta_pin, 11, 4) = '0000' AND nearest_neighbor_2_dist_ft <= 500 ) AS nn2 ON f1.nearest_neighbor_1_pin10 = nn2.meta_pin10