R/meta_resource_types.R

Defines functions meta_resource_types

Documented in meta_resource_types

#' artlookR resource_types 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{resource_types} table,
#' any definitions available for that community, and hidden status of the \code{resource_types} 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_resource_types("chicago")
#' @export
meta_resource_types <- function(comm_name){

  temp <- tbl(myconn, in_schema(comm_name, "resource_types")) %>%
    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.