Skip to content

Commit

Permalink
Updating documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-harrold committed Mar 17, 2024
1 parent 3a0cb1e commit cd34fed
Show file tree
Hide file tree
Showing 60 changed files with 411 additions and 188 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export(mk_table_nca_params)
export(nca_builder)
export(plot_sr_tc)
export(ruminate)
export(ruminate_check)
export(run_nca_components)
export(simulate_rules)
import(dplyr)
Expand Down
30 changes: 12 additions & 18 deletions R/CTS_Server.R
Original file line number Diff line number Diff line change
Expand Up @@ -1709,7 +1709,7 @@ CTS_fetch_state = function(id, id_ASM, id_MB, input, session, FM_yaml_file, MOD_

#browser()

if(current_ele[["cares"]][["COV_GOOD"]]){
if(current_ele[["cares"]][["COV_IS_GOOD"]]){
state = formods::FM_set_notification(state,
notify_text = paste0("Covariate ", selected_covariate, " Added"),
notify_id = "COV_IS_GOOD",
Expand Down Expand Up @@ -2150,30 +2150,24 @@ element}
#'@description Takes the ui elements in the module state and processes the covariate elements for addition.
#'@param state CTS state from \code{CTS_fetch_state()}
#'@param element Element list from \code{CTS_fetch_current_element()}
#'@return Element with the results of adding the rule. The \code{cares} list
#'@return Element with the results of adding the covariate. The \code{cares} list
#'element can be used to determine the exit status of the function.
#'\itemize{
#' \item{RULE_IS_GOOD} If true it indicates that the pieces of the rule from
#' the UI check out.
#' \item{RULE_UPDATED} If RULE_IS_GOOD and RULE_UPDATED is true then a
#' previous rule definition was overwritten. If RULE_IS_GOOD is TRUE and
#' RULE_UPDATED is FALSE then a new rule was added.
#' \item{notify_text} Text for notify message
#' \item{notify_id} Notification ID
#' \item{notify_type} Notification type
#' \item{msgs} Vector of messages.
#' \item{COV_IS_GOOD} If TRUE if the covariate was good and added, and FALSE if
#' there were any issues.
#' \item{msgs} Vector of messages.
#'}
#'@details This depends on the following UI values in the state
#'\itemize{
#' \item{} state[["CTS"]][["ui"]][["covariate_value"]]
#' \item{} state[["CTS"]][["ui"]][["covariate_type_selected"]]
#' \item{} state[["CTS"]][["ui"]][["selected_covariate"]]
#' \item{} state[["CTS"]][["ui"]][["covariate_value"]]
#' \item{} state[["CTS"]][["ui"]][["covariate_type_selected"]]
#' \item{} state[["CTS"]][["ui"]][["selected_covariate"]]
#'}
#'@example inst/test_apps/CTS_funcs.R
CTS_add_covariate = function(state, element){

msgs = c()
COV_GOOD = TRUE
COV_IS_GOOD = TRUE

covariate_value = state[["CTS"]][["ui"]][["covariate_value"]]
covariate_type = state[["CTS"]][["ui"]][["covariate_type_selected"]]
Expand All @@ -2182,7 +2176,7 @@ CTS_add_covariate = function(state, element){
tmp_msg = paste0("No value specified for covariate: ", selected_covariate, ".")
FM_le(state, tmp_msg)
msgs = c(msgs, tmp_msg)
COV_GOOD = FALSE
COV_IS_GOOD = FALSE
}else{
covariate_value = paste0("c(", covariate_value, ")")
cmd = paste0("cvval = ", covariate_value)
Expand All @@ -2205,13 +2199,13 @@ CTS_add_covariate = function(state, element){
msgs = c(msgs, tmp_msg)
msgs = c(msgs, paste0(" -> ", covariate_value))
msgs = c(msgs, tcres[["msgs"]])
COV_GOOD = FALSE
COV_IS_GOOD = FALSE
}
}

# Appending results
element[["cares"]] = list(
COV_GOOD = COV_GOOD,
COV_IS_GOOD = COV_IS_GOOD,
msgs = msgs
)
element}
Expand Down
67 changes: 58 additions & 9 deletions R/ruminate.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,70 @@
}

Sys.setenv(ruminate_rxfamily_found = suggested_found)
}

#'@export
#'@title Checks `ruminate` Dependencies
#'@description Looks at the suggested dependencies and checks to make sure
#'they are installed.
#'@param verbose Logical indicating if messages should be displayed
#'@return List with the following elements:
#' \itemize{
#' \item{all_found:} Boolean indicating if all packages were found
#' \item{found_pkgs:} Character vector of found packages
#' \item{missing_pkgs:} Character vector of missing packages
#'}
#'@examples
#' fcres =ruminate_check()
ruminate_check <- function(verbose=TRUE){

#mr = FM_message("Checking for other suggested packages", entry_type="h2")
#------------------------------------
# Checking for rxpackages
# If all the suggested packages are found this will be true:
suggested_found = TRUE
if(verbose){
mr = FM_message("Checking ruminate for suggested packages", entry_type="h1")
}

other_pkgs = c(
"clipr", "gridExtra", "prompter",
"rmarkdown", "readxl", "shinydashboard",
"ubiquity")
for(pkg in other_pkgs){
pkgs = c(
"clipr",
"gridExtra",
"knitr",
"nlmixr2lib",
"nonmem2rx",
"prompter",
"rmarkdown",
"readxl",
"rxode2et",
"shinydashboard",
"testthat",
"ubiquity")

pkg_found = c()
pkg_missing = c()
for(pkg in pkgs){
if(!requireNamespace(pkg, quietly=TRUE)){
#mr = FM_message(paste0("missing ", pkg), entry_type="danger")
if(verbose){
mr = FM_message(paste0("missing ", pkg), entry_type="danger")
}
pkg_missing = c(pkg_missing, pkg)
suggested_found = FALSE
} else {
#mr = FM_message(paste0("found ", pkg), entry_type="success")
if(verbose){
mr = FM_message(paste0("found ", pkg), entry_type="success")
}
pkg_found = c(pkg_found , pkg)
}
}
}

res = list(
all_found = suggested_found,
found_pkgs = pkg_found,
missing_pkgs = pkg_missing
)
res}



#'@export
#'@title Run the {ruminate} Shiny App
Expand Down
3 changes: 3 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ reference:
- title: "Running ruminate"
- contents:
- ruminate
- title: "Helper functions"
- contents:
- ruminate_check
- title: "CTS Module functions"
- contents:
- starts_with("CTS_")
Expand Down
28 changes: 14 additions & 14 deletions docs/articles/clinical_trial_simulation.html

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

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/articles/noncompartmental_analysis.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/news/index.html

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

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ articles:
model_builder: model_builder.html
noncompartmental_analysis: noncompartmental_analysis.html
simulate_rules: rmdhunks/simulate_rules.html
last_built: 2024-03-12T14:14Z
last_built: 2024-03-17T18:18Z

14 changes: 4 additions & 10 deletions docs/reference/CTS_add_covariate.html

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

8 changes: 4 additions & 4 deletions docs/reference/CTS_fetch_ds.html

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

8 changes: 4 additions & 4 deletions docs/reference/CTS_fetch_state.html

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

Loading

0 comments on commit cd34fed

Please sign in to comment.