Add active listings tab from RentCast API

- update_listings.R: pulls 1-mile radius, clips to plat boundary
- Listings tab: table with listed date, address, sqft, price, $/sqft
- Weekly cron: Sunday 11:30pm (30 min after owners refresh)
- httr2 added to renv.lock
This commit is contained in:
2026-03-09 16:11:34 -04:00
parent 996bd04746
commit 751a771c45
3 changed files with 165 additions and 1 deletions

38
app.R
View File

@@ -8,7 +8,8 @@ library(leafpop)
library(DT)
# load data ----
owners <- readRDS("./data/owners.rds")
owners <- readRDS("./data/owners.rds")
listings <- readRDS("./data/listings.rds")
last_sale_date <- format(attr(owners, "last_sale_date"), "%Y-%m-%d")
sbdvn <- sf::st_read("./data/plats/plats.shp")
venice_bndry <- readRDS("./data/venice.rds")
@@ -87,6 +88,11 @@ ui <- f7Page(
title = "Owners",
icon = f7Icon("person_2_fill")
),
f7PanelItem(
tabName = "Listings",
title = "Listings",
icon = f7Icon("tag_fill")
),
f7PanelItem(
tabName = "Resources",
title = "Resources",
@@ -244,6 +250,17 @@ ui <- f7Page(
)
)
),
#### listings ----
f7Tab(
title = "Listings",
tabName = "Listings",
icon = f7Icon("tag_fill"),
f7Card(
title = "Active Listings:",
divider = TRUE,
DTOutput("listings_table")
)
),
#### services ----
f7Tab(
title = "Resources",
@@ -456,6 +473,25 @@ server <- function(input, output) {
}
)
# listings table ----
output$listings_table <- renderDT({
datatable(
listings |>
select(listed_date, address, sqft, price, price_per_sqft) |>
mutate(
price = scales::dollar(price),
price_per_sqft = scales::dollar(price_per_sqft)
),
colnames = c("Listed", "Address", "Sq Ft", "Price", "$/Sq Ft"),
rownames = FALSE,
options = list(
pageLength = 25,
searching = FALSE,
dom = 't'
)
)
})
# venice map ----
output$venice_map <- renderLeaflet({
leaflet() %>%