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:
38
app.R
38
app.R
@@ -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() %>%
|
||||
|
||||
Reference in New Issue
Block a user