Skip to content

Commit

Permalink
Revert switch to condo unit value iasworld upload (#33)
Browse files Browse the repository at this point in the history
* Revert switch to condo unit value iasworld upload

* Correct output format
  • Loading branch information
wrridgeway authored Feb 15, 2024
1 parent b7e0cc4 commit fbe92d0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pipeline/07-export.R
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,8 @@ upload_data_prepped <- assessment_pin %>%
select(meta_year, meta_pin, meta_card_num, meta_lline_num),
by = c("meta_year", "meta_pin")
) %>%
mutate(meta_pin10 = str_sub(meta_pin, 1, 10)) %>%
group_by(meta_pin10, meta_tieback_proration_rate) %>%
mutate(
# For PINs missing an individual building value, fill with the average of
# PINs with the same proration rate in the building. This is super rare,
Expand All @@ -492,16 +494,32 @@ upload_data_prepped <- assessment_pin %>%
is.na(pred_pin_final_fmv_bldg),
mean(pred_pin_final_fmv_bldg, na.rm = TRUE),
pred_pin_final_fmv_bldg
)
) %>%
group_by(meta_pin10) %>%
mutate(
# Sum the building value of each PIN to the building total value
pred_pin10_final_fmv_bldg = sum(pred_pin_final_fmv_bldg, na.rm = TRUE),

# Hotfix for adjusting the total building value such that bldg_total *
# proration_rate = unit_value. Only applies to buildings where rates don't
# sum to 100%
pred_pin10_final_fmv_bldg = round(
pred_pin10_final_fmv_bldg * (1 / sum(
meta_tieback_proration_rate,
na.rm = TRUE
))
),
# For any missing LLINE values, simply fill with 1
meta_lline_num = replace_na(meta_lline_num, 1)
) %>%
ungroup() %>%
select(
township_code = meta_township_code,
PARID = meta_pin,
CARD = meta_card_num,
LLINE = meta_lline_num,
MV = pred_pin_final_fmv_bldg
MV = pred_pin10_final_fmv_bldg
) %>%
arrange(township_code, PARID)

Expand Down

0 comments on commit fbe92d0

Please sign in to comment.