Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
105f304
small change to run_dev.R
AARON-CLARK Feb 17, 2023
a99823b
Adjust initial auto-decision values
AARON-CLARK Feb 17, 2023
a30658b
Add the default login note, because we want to deploy with a demo use…
AARON-CLARK Feb 20, 2023
fe147ec
updated app.R
Feb 22, 2023
0f25cf7
update renv.lock and add demo credentials to credentials.sqlite on st…
AARON-CLARK Feb 24, 2023
d1841af
updated login note in app.R
AARON-CLARK Feb 24, 2023
f013e7e
fix merge conflicts in run_app()
AARON-CLARK Mar 15, 2023
8b943f1
fixed merge conflicts
AARON-CLARK Jun 22, 2023
219863b
get rid of url checker
AARON-CLARK Jun 22, 2023
4d052ad
uncomment upload_pkgs00(NULL)
AARON-CLARK Jun 23, 2023
335f29e
attempted fix for known riskmetric weighting bug #293
AARON-CLARK Jul 5, 2023
fa4a93e
remove print statements
AARON-CLARK Jul 5, 2023
7f26c90
get rid of database.sql... what is that?
AARON-CLARK Jul 6, 2023
6fbc9d4
Merge pull request #566 from pharmaR/dev-demo-shiniyapp.io-v100
AARON-CLARK Jul 6, 2023
f58dc8d
update config with new decision rules
AARON-CLARK Jul 10, 2023
db06cef
track database.sqlite
AARON-CLARK Jul 10, 2023
3dedbb5
track credentials temporarily
AARON-CLARK Jul 11, 2023
8ce5bcb
Use configuration file for demo databases
Jeff-Thompson12 Jul 11, 2023
e537989
Correctly specify demo configuration
Jeff-Thompson12 Jul 11, 2023
3c0c8a8
fix bug with re-scoring
AARON-CLARK Jul 12, 2023
ffbb826
fixed merge conflict with credentials_demo.sqlite
AARON-CLARK Jul 12, 2023
a78d15e
Resolve v2.0.0 merge conflicts
Jeff-Thompson12 Aug 11, 2023
dbc7134
Update databases
Jeff-Thompson12 Aug 11, 2023
fecdafc
Add an RSConnect ignore file
Jeff-Thompson12 Aug 11, 2023
966d461
Merge branch 'master' into dev-demo-shinyapp.io-v2.0.0
Jeff-Thompson12 Aug 14, 2023
e30dc9e
Merge branch 'master' into dev-demo-shinyapp.io-v2.0.0
AARON-CLARK Aug 15, 2023
7ab635d
fix broken package dependency table
AARON-CLARK Aug 15, 2023
266a00d
Merge branch 'master' into dev-demo-shinyapp.io-v2.0.0
AARON-CLARK Aug 15, 2023
a7a76a5
update database and config with some extra content
AARON-CLARK Aug 15, 2023
3871b84
Merge pull request #610 from pharmaR/dev-demo-shinyapp.io-v2.0.0
AARON-CLARK Aug 15, 2023
30452dd
fix merge conflicts in mod_uploadPackage regarding URL checker
AARON-CLARK Oct 20, 2023
55e9a24
initialize new creds and assessment db for demo
AARON-CLARK Oct 20, 2023
cfeaf35
update default demo crednetials and login notes
AARON-CLARK Oct 20, 2023
3958ee1
Initialize roles as well
Jeff-Thompson12 Oct 20, 2023
263bf9b
Move rules to demo configuration
Jeff-Thompson12 Oct 20, 2023
ff10aa7
fix typo in credentials initiatlization for demo branch and turn on f…
AARON-CLARK Oct 20, 2023
590f147
Add base:: prefix onto parse()
AARON-CLARK Oct 20, 2023
dd6689c
Verify app will not crash if `get_parse_data()` never runs
Jeff-Thompson12 Oct 20, 2023
c1fccdf
Verify app fails at first parsing
Jeff-Thompson12 Oct 20, 2023
9ae5731
Make sure value isn't being overwritten with global option
Jeff-Thompson12 Oct 20, 2023
86b7257
Merge branch 'dev' into demo-shinyapps.io
AARON-CLARK Oct 23, 2023
5f5d260
add placeholder file into source/ folder
AARON-CLARK Oct 23, 2023
83c6ed7
testing dummy pkg in source file with new unlink() call, exluding dum…
AARON-CLARK Oct 24, 2023
7fa9fe7
create demo database of 10 pkgs
AARON-CLARK Oct 24, 2023
0fccec3
revert back to original unlink
AARON-CLARK Oct 24, 2023
5ef937a
update database with other half of 300 pkgs, and rewrite login_note
AARON-CLARK Oct 24, 2023
c36a06d
Add the dummy file back again
AARON-CLARK Oct 24, 2023
f665c4c
ignore sources again
AARON-CLARK Oct 24, 2023
845143d
remove demo database and reset config file
AARON-CLARK Oct 24, 2023
adb1fb1
update databases
AARON-CLARK Oct 25, 2023
3ce522a
resolve merge conflicts
aclark02-arcus Jun 18, 2024
e000f04
Merge pull request #801 from pharmaR/master
aclark02-arcus Jul 8, 2024
0735bba
Merge pull request #809 from pharmaR/dev
aclark02-arcus Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
rsconnect/
/*.sqlite
.Rproj.user
.Rhistory
.RData
Expand All @@ -12,6 +11,8 @@ inst/doc
auto_decisions.json
^docs$
docs/
*.sqlite
!*demo.sqlite
tarballs/
report_preferences/
.Renviron
111 changes: 57 additions & 54 deletions R/mod_uploadPackage.R
Original file line number Diff line number Diff line change
Expand Up @@ -302,75 +302,78 @@ uploadPackageServer <- function(id, user, auto_list, credentials, parent) {

})

checking_urls <- reactiveValues()

observeEvent(input$check_urls, {
checking_urls$finished <- FALSE
removeModal()
})

observe({
req(input$check_urls, !isTRUE(checking_urls$finished))
invalidateLater(60*1000)

withProgress({
good_urls <- purrr::map_lgl(checking_urls$url_lst,
~ try(curlGetHeaders(.x, verify = FALSE), silent = TRUE) %>%
{class(.) != "try-error" && attr(., "status") != 404})
Sys.sleep(.5)
}, message = "Checking URLs")

checking_urls$finished <- all(good_urls)
})

observeEvent(checking_urls$finished, {
req(checking_urls$finished)
showModal(modalDialog(
title = h2("Data Connection Issues"),
h5("The needed URLs are now reachable. Please try to upload the desired packages now."),
))
})
# Commented out only for shinyapps.io deployment!
# checking_urls <- reactiveValues()
#
# observeEvent(input$check_urls, {
# checking_urls$finished <- FALSE
# removeModal()
# })
#
# observe({
# req(input$check_urls, !isTRUE(checking_urls$finished))
# invalidateLater(60*1000)
#
# withProgress({
# good_urls <- purrr::map_lgl(checking_urls$url_lst,
# ~ try(curlGetHeaders(.x, verify = FALSE), silent = TRUE) %>%
# {class(.) != "try-error" && attr(., "status") != 404})
# Sys.sleep(.5)
# }, message = "Checking URLs")
#
# checking_urls$finished <- all(good_urls)
# })
#
# observeEvent(checking_urls$finished, {
# req(checking_urls$finished)
# showModal(modalDialog(
# title = h2("Data Connection Issues"),
# h5("The needed URLs are now reachable. Please try to upload the desired packages now."),
# ))
# })

uploaded_pkgs <- reactiveVal(data.frame())
# Save all the uploaded packages, marking them as 'new', 'not found',
# 'duplicate' or 'removed'
observeEvent(uploaded_pkgs00(), {

uploaded_packages <- uploaded_pkgs00()
uploaded_pkgs00(NULL)
uploaded_pkgs00(NULL) # keep!
uploaded_packages$score <- NA_real_
if (!rlang::is_empty(auto_list())) {
uploaded_packages$decision <- dplyr::coalesce(uploaded_packages$decision, "")
uploaded_packages$decision_rule <- ""
}
np <- nrow(uploaded_packages)

if (!isTRUE(getOption("shiny.testmode"))) {
url_lst <- c(
"https://cran.r-project.org",
"https://cranlogs.r-pkg.org"
)

good_urls <- purrr::map_lgl(url_lst,
~ try(curlGetHeaders(.x, verify = FALSE), silent = TRUE) %>%
{class(.) != "try-error" && attr(., "status") != 404})

if (!all(good_urls)) {
checking_urls$url_lst <- url_lst[!good_urls]
showModal(modalDialog(
title = h2("Data Connection Issues"),
h5("The process has been cancelled because at least one of the URLs used to populate the metrics is unreachable at this time."),
br(),
h5("Notify when URLs are reachable?"),
footer = tagList(
actionButton(ns("check_urls"), "Yes"),
modalButton("No")
)
))
}

req(all(good_urls))
}
# if (!isTRUE(getOption("shiny.testmode"))) {
# url_lst <- list(
# "https://cran.rstudio.com",
# "https://cran.r-project.org",
# "https://cranlogs.r-pkg.org"
# )
#
# good_urls <- purrr::map_lgl(url_lst,
# ~ try(curlGetHeaders(.x, verify = FALSE), silent = TRUE) %>%
# {class(.) != "try-error" && attr(., "status") != 404})
#
# if (!all(good_urls)) {
# checking_urls$url_lst <- url_lst[!good_urls]
# showModal(modalDialog(
# title = h2("Data Connection Issues"),
# h5("The process has been cancelled because at least one of the URLs used to populate the metrics is unreachable at this time."),
# br(),
# h5("Notify when URLs are reachable?"),
# footer = tagList(
# actionButton(ns("check_urls"), "Yes"),
# modalButton("No")
# )
# ))
# }
#
# req(all(good_urls))
# }

if (!isTruthy(session$userData$repo_pkgs())) {
if (isTRUE(getOption("shiny.testmode"))) {
Expand Down
2 changes: 1 addition & 1 deletion R/utils_insert_db.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ insert_riskmetric_to_db <- function(pkg_name, pkg_version = "",
# Get the metrics weights to be used during pkg_score.
metric_weights <- metric_weights_df$weight
names(metric_weights) <- metric_weights_df$name

riskmetric_score <-
riskmetric_assess %>%
riskmetric::pkg_score(weights = metric_weights)
Expand Down
9 changes: 5 additions & 4 deletions R/utils_startup.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ create_credentials_db <- function(db_name, admin_role = ""){

# Init the credentials table for credentials database
credentials <- data.frame(
user = "ADMIN",
password = "QWERTY1",
user = c("demo_admin", "demo_lead", "demo_reviewer", "demo_viewer"),
password = c("Admin@1", "Lead@1", "Reviewer@1", "Viewer@1"),
# password will automatically be hashed
admin = TRUE,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
admin = TRUE,
admin = c(TRUE, rep(FALSE, 3))

expire = as.character(get_Date()),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be set to NULL in the creation? Or do we have to update it in the app?

role = admin_role,
role = c("admin", "lead", "reviewer", "viewer"),
stringsAsFactors = FALSE
)

Expand All @@ -101,7 +101,8 @@ create_credentials_db <- function(db_name, admin_role = ""){
con, name = "pwd_mngt",
passphrase = passphrase) %>%
dplyr::mutate(must_change = ifelse(
have_changed == "TRUE", must_change, as.character(TRUE)))
user == "ADMIN" & have_changed == "FALSE",
as.character(TRUE), must_change))

shinymanager::write_db_encrypt(
con,
Expand Down
17 changes: 16 additions & 1 deletion app.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
# To deploy, run: rsconnect::deployApp()
# Or use the blue button on top of this file

Sys.setenv(GOLEM_CONFIG_ACTIVE = "demo")
# options(rsconnect.max.bundle.files = 20000)
options(shiny.fullstacktrace = TRUE)
pkgload::load_all(export_all = FALSE,helpers = FALSE,attach_testthat = FALSE)
options( "golem.app.prod" = TRUE)
riskassessment::run_app() # add parameters here (if any)
riskassessment::run_app(
login_note = shiny::HTML(
"<em>Note:</em><br>
Use the following credentials to log on with varying roles & privileges in the app, expanded upon <a href='https://pharmar.github.io/riskassessment/articles/User_Roles_and_Privileges.html#roles' target='_blank'>here</a>:
<br><br>
U: <span style='text-transform:none;'><u>demo_admin</u></span>; &nbsp;&nbsp;&nbsp; P: <u><span style='text-transform:none;'>Admin@1</span></u>
<br>
U: <span style='text-transform:none;'><u>demo_lead</u></span>; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P: <u><span style='text-transform:none;'>Lead@1</span></u>
<br>
U: <span style='text-transform:none;'><u>demo_reviewer</u></span>; P: <u><span style='text-transform:none;'>Reviewer@1</span></u>
<br>
U: <span style='text-transform:none;'><u>demo_viewer</u></span>; &nbsp;&nbsp; P: <u><span style='text-transform:none;'>Viewer@1</span></u>")
)
Binary file added credentials_demo.sqlite
Binary file not shown.
Binary file added database_demo.sqlite
Binary file not shown.
9 changes: 7 additions & 2 deletions dev/run_dev.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ golem::detach_all_attached()
# Document and reload your package, which runs these three functions...
golem::document_and_reload()

# Run the application
run_app(pre_auth_user = 'admin')

# Run the application
run_app(
pre_auth_user = 'admin',
login_note = shiny::HTML('<em>Note:</em> To log in for the first time, use the admin user:
<u>admin</u> with password <u>QWERTY1</u>.'))
# run_app(pre_auth_user = 'lead')
# run_app(pre_auth_user = 'reviewer')
# run_app(pre_auth_user = 'viewer')


# # turn off any options
# options(shiny.autoload.r=NULL)

Expand Down
23 changes: 21 additions & 2 deletions inst/db-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ default:
- Low Risk
- Medium Risk
- High Risk
metric_weights:
covr_coverage: 0
example:
assessment_db: database_ex.sqlite
credential_db: credentials_ex.sqlite
Expand Down Expand Up @@ -75,6 +73,27 @@ example2:
- GxP Compliant
- Needs Review
- Not GxP Compliant
demo:
assessment_db: database_demo.sqlite
credential_db: credentials_demo.sqlite
metric_weights:
covr_coverage: 0
decisions:
rules:
rule_1:
metric: bugs_status
condition: ~ metric_score(.x) <= .25
decision: High Risk
rule_2:
metric: dependencies
condition: ~ length(.x) >= 30
decision: High Risk
Medium Risk:
- .3983
- .6391
High Risk:
- .6391
- 1
noncredentialed:
use_shinymanager: false
assessment_db: database_noncredentialed.sqlite
Expand Down
11 changes: 11 additions & 0 deletions source/dummy_placeholder_file
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DO NOT DELETE THIS FILE

It's here for convenience so that this demo branch is easier to deploy to
shinyapps.io. When deploying, having any file in the source/ directory
will ensure that this folder persistents when deployed. Thus, it aptly
facilitates storage of untarred pkg sources much more consistently. Without it,
shinyapps.io will frequenly (and successfully) remove the source/ dir, which is
not ideal.

Thank you!
{riskassessment} dev team
2 changes: 1 addition & 1 deletion vignettes/riskassessment.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -403,4 +403,4 @@ Check out some of the `riskmetric` or `riskassessment` presentations in [www.pha
<br>
<br>
<br>
<br>
<br>