R/meta_obstacles.R

Defines functions meta_obstacles

Documented in meta_obstacles

#' artlookR obstacles metadata
#'
#' @param comm_name The community name as recognized by artlookR
#' @return A list with the label names, levels, artlookR id numbers for each value in the \code{obstacles} table,
#' any definitions available for that community, and hidden status of the \code{obstacles} table metadata.
#' @details You will need to run the \code{connection.R} script and create a connection object named \code{myconn} for this script to run.
#' @examples meta_obstacles("chicago")
#' @export
meta_obstacles <- function(comm_name){

  temp <- tbl(myconn, in_schema(comm_name, "obstacles")) %>%
    #filter(hidden == FALSE) %>%
    arrange(id) %>%
    collect

  output <- list(label = case_when(is.na(temp$display_name) ~ str_to_title(str_replace_all(temp$name, "_", " ")),
                                   TRUE ~ temp$display_name),
                 level = temp$name,
                 id = temp$id,
                 definition = temp$definition,
                 hidden = temp$hidden)

  output

}
Ingenuity-Inc/artlookR documentation built on May 18, 2022, 12:33 a.m.