mirror of
https://github.com/dylanbenzi/hurricane_normalization_app.git
synced 2026-07-30 05:08:57 +00:00
add additional db getters
This commit is contained in:
@@ -52,6 +52,7 @@ view.hurdat_ids <- tbl(con, "hurdat_ids")
|
||||
view.all_lf_type_landfalls <- tbl(con, "all_lf_type_landfalls")
|
||||
view.lf_id_location <- tbl(con, "lf_id_location")
|
||||
view.lf_landfall_gis <- tbl(con, "lf_landfall_gis")
|
||||
view.best_track_summary <- tbl(con, "best_track_summary")
|
||||
#qry <- econ.storm_base_loss %>%
|
||||
# left_join(view.hurdat_track, by = c("storm_basin", "storm_year", "storm_name"))
|
||||
|
||||
@@ -97,6 +98,32 @@ split_full_lf_id <- function(full_lf_id) {
|
||||
|
||||
# DB getters
|
||||
|
||||
get_best_track_summary <- function(storm) {
|
||||
query <- view.best_track_summary %>%
|
||||
filter(
|
||||
storm_basin == storm$storm_basin,
|
||||
storm_year == storm$storm_year,
|
||||
storm_name == storm$storm_name
|
||||
)
|
||||
|
||||
result <- query %>% collect()
|
||||
|
||||
return(result)
|
||||
}
|
||||
|
||||
get_hurdat_id <- function(storm) {
|
||||
query <- view.hurdat_ids %>%
|
||||
filter(
|
||||
storm_basin == storm$storm_basin,
|
||||
storm_year == storm$storm_year,
|
||||
storm_name == storm$storm_name
|
||||
)
|
||||
|
||||
result <- query %>% collect()
|
||||
|
||||
return(result)
|
||||
}
|
||||
|
||||
# returns a list of loss storms we have data on
|
||||
get_all_loss_storms <- function() {
|
||||
query <- view.all_loss_storms
|
||||
@@ -124,6 +151,18 @@ get_latest_aggregate_losses <- function() {
|
||||
return(result)
|
||||
}
|
||||
|
||||
get_latest_aggregate_loss <- function(storm) {
|
||||
query <- view.all_normalized_losses %>%
|
||||
filter(
|
||||
storm_year == storm$storm_year,
|
||||
storm_name == storm$storm_name
|
||||
)
|
||||
|
||||
result <- query %>% collect()
|
||||
|
||||
return(result)
|
||||
}
|
||||
|
||||
# returns unique lf ids for a storm
|
||||
get_unique_lf_ids <- function(storm) {
|
||||
query <- view.all_loss_landfalls %>%
|
||||
|
||||
Reference in New Issue
Block a user