Skip to content

Commit

Permalink
run information console output
Browse files Browse the repository at this point in the history
  • Loading branch information
Ty-WDFW committed Mar 9, 2024
1 parent f33340f commit 1cc6e2e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export(msf_mortalities_chinook_)
export(msf_mortalities_coho_)
export(population_statistics)
export(remove_run)
export(run_info)
export(statistical_week)
export(stock_mortality)
importFrom(rlang,.data)
Expand Down
27 changes: 27 additions & 0 deletions R/integrity.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,30 @@ remove_run <- function(fram_db, run_id){
))

}

#' Provides a print out of Run ID information
#' @param fram_db FRAM database object
#' @param run_id FRAM run ID
#' @export
#' @examples
#' \dontrun{fram_db |> run_info(run_id = 132)}
#'

run_info <- function(fram_db, run_id = NULL) {
if (is.null(run_id)) {rlang::abort('A run ID must be provided')}

run_info <- fram_db |>
fetch_table('RunID') |>
dplyr::filter(.data$run_id == .env$run_id)

cli::cli_h1('FRAM Run Information')
cli::cli_text(cat(cli::col_blue('Species: '), cli::col_grey(run_info$species_name[[1]])))
cli::cli_text(cat(cli::col_blue('Run Name: '), cli::col_grey(run_info$run_name[[1]])))
cli::cli_text(cat(cli::col_blue('Run Title: '), cli::col_grey(run_info$run_title[[1]])))
cli::cli_text(cat(cli::col_blue('Run Date: '), cli::col_grey(run_info$run_time_date[[1]])))
cli::cli_text(cat(cli::col_blue('TAMM: '), cli::col_grey(run_info$tamm_name[[1]])))
cli::cli_text(cat(cli::col_blue('Coast Iterations: '), cli::col_grey(run_info$coastal_iterations[[1]])))
cli::cli_text(cat(cli::col_blue('Run Comments: '), '\n', cli::col_grey(run_info$run_comments[[1]])))

}

20 changes: 20 additions & 0 deletions man/run_info.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1cc6e2e

Please sign in to comment.