From ec55035e63bad58ad5767729c322101d717dce27 Mon Sep 17 00:00:00 2001 From: Rob Wiederstein Date: Mon, 9 Mar 2026 15:12:58 -0400 Subject: [PATCH] Add unit numbers and rename label to address_1 in mailing export --- app.R | 18 ++++++++++-------- data-raw/update_owners.R | 4 +++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app.R b/app.R index 13f09f1..f84bb62 100644 --- a/app.R +++ b/app.R @@ -427,15 +427,17 @@ server <- function(input, output) { prep_mailing <- function(data) { data |> sf::st_drop_geometry() |> - dplyr::select(owner_1, owner_2, label) |> + dplyr::select(owner_1, owner_2, label, unit) |> dplyr::mutate( - owner_2 = dplyr::na_if(owner_2, "NA"), - owner_2 = ifelse(is.na(owner_2), "", owner_2), - label = stringr::str_squish(label), - city = "Venice", - state = "FL", - zip = "34285" - ) + owner_2 = dplyr::na_if(owner_2, "NA"), + owner_2 = ifelse(is.na(owner_2), "", owner_2), + address_1 = stringr::str_squish(label), + address_2 = ifelse(unit == "", "", paste0("Unit ", unit)), + city = "Venice", + state = "FL", + zip = "34285" + ) |> + dplyr::select(owner_1, owner_2, address_1, address_2, city, state, zip) } output$download_filtered <- downloadHandler( diff --git a/data-raw/update_owners.R b/data-raw/update_owners.R index cd7fcf6..c245484 100644 --- a/data-raw/update_owners.R +++ b/data-raw/update_owners.R @@ -46,9 +46,11 @@ owners_raw <- mutate( # extract clean street address (before multiple spaces / unit suffix) label = str_trim(str_extract(situs_address, "^\\d+\\s+\\S+\\s+\\S+")), + unit = str_trim(str_extract(situs_address, "\\d+\\s*$")), + unit = ifelse(is.na(unit), "", unit), location = paste0(label, ", Venice FL") ) |> - select(account_number, owner_1, owner_2, subdivision, homestead, label, location) + select(account_number, owner_1, owner_2, subdivision, homestead, label, unit, location) # join to geometry ---- owners <- owners_raw |>