mirror of
https://github.com/dylanbenzi/hurricane_normalization_app.git
synced 2026-07-30 05:08:57 +00:00
add downloadable datasets ui
This commit is contained in:
+5
-4
@@ -27,6 +27,7 @@ library(shinyWidgets)
|
|||||||
library(paletteer)
|
library(paletteer)
|
||||||
library(shinyjs)
|
library(shinyjs)
|
||||||
library(quarto)
|
library(quarto)
|
||||||
|
library(bsicons)
|
||||||
|
|
||||||
APP_DIR <- getwd()
|
APP_DIR <- getwd()
|
||||||
|
|
||||||
@@ -79,10 +80,10 @@ storm_coverage <- get_storm_data_coverage() %>%
|
|||||||
has_cost_data
|
has_cost_data
|
||||||
)
|
)
|
||||||
|
|
||||||
dt_yr_range <- range(storm_coverage$storm_year, na.rm = TRUE)
|
dt_yr_range <- range(storm_coverage$storm_year, na.rm = TRUE)
|
||||||
dt_death_max <- max(storm_coverage$total_direct_deaths, na.rm = TRUE)
|
dt_death_max <- max(storm_coverage$total_direct_deaths, na.rm = TRUE)
|
||||||
dt_mmh_max <- max(storm_coverage$mmh, na.rm = TRUE)
|
dt_mmh_max <- max(storm_coverage$mmh, na.rm = TRUE)
|
||||||
dt_mmp_max <- max(storm_coverage$mmp, na.rm = TRUE)
|
dt_mmp_max <- max(storm_coverage$mmp, na.rm = TRUE)
|
||||||
|
|
||||||
onStop(function() {
|
onStop(function() {
|
||||||
poolClose(con)
|
poolClose(con)
|
||||||
|
|||||||
@@ -1,5 +1,89 @@
|
|||||||
library(bslib)
|
library(bslib)
|
||||||
|
|
||||||
|
download_card <- function(
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
data_coverage,
|
||||||
|
last_updated,
|
||||||
|
data_id
|
||||||
|
) {
|
||||||
|
return(
|
||||||
|
card(
|
||||||
|
fill = F,
|
||||||
|
layout_columns(
|
||||||
|
col_widths = c(10, 2),
|
||||||
|
strong(title),
|
||||||
|
actionButton(
|
||||||
|
class = "btn-primary btn-sm",
|
||||||
|
icon = icon("download"),
|
||||||
|
paste("download", data_id, sep = "-"),
|
||||||
|
"Download"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
p(description),
|
||||||
|
div(
|
||||||
|
class = "d-flex",
|
||||||
|
div(
|
||||||
|
class = "d-flex me-4",
|
||||||
|
bs_icon("database-fill", class = "text-muted me-1"),
|
||||||
|
h6(data_coverage)
|
||||||
|
),
|
||||||
|
div(
|
||||||
|
class = "d-flex me-4",
|
||||||
|
bs_icon("calendar-event-fill", class = "text-muted me-1"),
|
||||||
|
h6(last_updated)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
# cost norm, economic factors, fatalities, svis, rmw county weights, landfalls
|
||||||
|
download_cards <- list(
|
||||||
|
download_card(
|
||||||
|
"Cyclone Cost Normalization",
|
||||||
|
"Normalized economic damage estimates for US landfalling hurricanes 1900-2023 using updated MMH/MMP methodology.",
|
||||||
|
"1900-2023",
|
||||||
|
"8/03/2025",
|
||||||
|
"cost_norm"
|
||||||
|
),
|
||||||
|
download_card(
|
||||||
|
"Economic Factors",
|
||||||
|
"Yearly economic factors for GDP deflator and Current-Cost Net Stock of Fixed Assets and Consumer Durable Goods (CCNFACDG) used in the MMH/MMP cost normalization methodology.",
|
||||||
|
"1900-2024",
|
||||||
|
"-/-/2025",
|
||||||
|
"usa_econ"
|
||||||
|
),
|
||||||
|
download_card(
|
||||||
|
"Tracked Landfalls",
|
||||||
|
"Landfalls with identifiers, RMW county weights, and time/location data for all storms normalized using the MMH/MMP methodology.",
|
||||||
|
"1900-2024",
|
||||||
|
"3/15/2026",
|
||||||
|
"landfalls"
|
||||||
|
),
|
||||||
|
download_card(
|
||||||
|
"Cyclone Fatalities",
|
||||||
|
"All known direct fatalities with peril categories from tropical cyclones",
|
||||||
|
"1963-2024",
|
||||||
|
"3/31/2026",
|
||||||
|
"fatalities"
|
||||||
|
),
|
||||||
|
download_card(
|
||||||
|
"Social Vulnerability Index",
|
||||||
|
"County/tract level data representing the vulnerability of people in that region",
|
||||||
|
"X-X",
|
||||||
|
"...",
|
||||||
|
"svi"
|
||||||
|
),
|
||||||
|
download_card(
|
||||||
|
"Additional Data",
|
||||||
|
"We can add more here later",
|
||||||
|
"X-X",
|
||||||
|
"...",
|
||||||
|
"additional"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
ui <- page_navbar(
|
ui <- page_navbar(
|
||||||
id = "main_navbar",
|
id = "main_navbar",
|
||||||
fillable = TRUE,
|
fillable = TRUE,
|
||||||
@@ -431,7 +515,17 @@ ui <- page_navbar(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
nav_panel("Export")
|
nav_panel(
|
||||||
|
"Export",
|
||||||
|
layout_column_wrap(
|
||||||
|
width = 1 / 2,
|
||||||
|
card(
|
||||||
|
card_header("Available Datasets"),
|
||||||
|
!!!download_cards
|
||||||
|
),
|
||||||
|
card()
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
nav_menu(
|
nav_menu(
|
||||||
"About",
|
"About",
|
||||||
|
|||||||
Reference in New Issue
Block a user