Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devex: Resolve merge conflicts dev #143

Merged
merged 88 commits into from
Nov 20, 2024
Merged
Changes from 22 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
e5e4da4
Add primary key field to tables
jthompson-arcus Oct 16, 2024
1cffcdf
Temporary fix to preserve current functionality
jthompson-arcus Oct 16, 2024
ec0c753
Re-create `review_testdb.sqlite`
jthompson-arcus Oct 16, 2024
193f05d
Repair `mod_review_form` tests
jthompson-arcus Oct 16, 2024
58435dc
Repair `fct_SQLite` tests
jthompson-arcus Oct 16, 2024
8f59b04
Rebuild `testdb.sqlite`
jthompson-arcus Oct 16, 2024
ec868d8
Temporary fix for adding queries to work as expected
jthompson-arcus Oct 16, 2024
804f7de
Add preliminary logging table
jthompson-arcus Oct 16, 2024
48314ae
Add "all_review_data_log" to list of expected tables
jthompson-arcus Oct 16, 2024
0b2eb31
Update `db_save_review` to update instead of append
jthompson-arcus Oct 28, 2024
37a7c11
Repair tests from `db_save_review()` changes
jthompson-arcus Oct 28, 2024
91a8c49
Merge branch 'dev' into jt-113-logging_tables
jthompson-arcus Oct 29, 2024
f98f0d2
Only store old records in logging table
jthompson-arcus Oct 29, 2024
9e55193
Modify update process to only updated/append appropriate records
jthompson-arcus Oct 29, 2024
f66f758
Actually pull the newer record when updated
jthompson-arcus Oct 29, 2024
2ad8cc7
Add `db_version` table to DB
jthompson-arcus Oct 30, 2024
75ad1d1
Add `edit_date_time` to logging table
jthompson-arcus Oct 30, 2024
4c8e2e5
Update all columns not considered in common
jthompson-arcus Oct 30, 2024
3f32584
Correct error in creating primary key tables
jthompson-arcus Oct 30, 2024
b81500d
Update `fct_SQLite.R` tests to reflect changes
jthompson-arcus Oct 30, 2024
d268d14
Update test DB
jthompson-arcus Oct 30, 2024
1cb9afa
Incorporate review logging tests into `test-fct_SQLite.R`
jthompson-arcus Oct 30, 2024
c6dace0
Add logging tests to `test-mod_review_forms.R`
jthompson-arcus Oct 30, 2024
7effc4c
Add index to `all_review_data` table
jthompson-arcus Oct 30, 2024
cd5d630
Utilize UPSERT for DB append/update procedure
jthompson-arcus Oct 31, 2024
564d0f9
Make UPSERT process more robust
jthompson-arcus Oct 31, 2024
af8f76c
Add function `update_db_version()` to migrate old DBs
jthompson-arcus Oct 31, 2024
f2ef3a6
Update version and NEWS
jthompson-arcus Oct 31, 2024
2c633d2
Fix warning message popping up in tests
jthompson-arcus Oct 31, 2024
f299d4a
Resolve merge conflicts with `dev`
jthompson-arcus Nov 4, 2024
63dc37d
Resolve merge conflicts with `dev`
jthompson-arcus Nov 5, 2024
0e6b4af
Update version number
jthompson-arcus Nov 5, 2024
c9b8cf8
Resolve merge conflicts with `dev`
jthompson-arcus Nov 5, 2024
abe5703
Revert changes to `mod_review_data_fct_helpers.R`
jthompson-arcus Nov 7, 2024
9c4dc72
Update internal documentation
jthompson-arcus Nov 7, 2024
62aa39d
Add index columns and db version to internal data
jthompson-arcus Nov 7, 2024
8e7f752
Create helper function to add new tables
jthompson-arcus Nov 7, 2024
7b7114d
Oopsies
jthompson-arcus Nov 7, 2024
6e65f04
Update UPSERT documentation
jthompson-arcus Nov 7, 2024
4af9905
Ignore `.Renviron` on git
jthompson-arcus Nov 8, 2024
7af507c
Initialize `db_get_table()`
jthompson-arcus Nov 8, 2024
2191a04
Use `db_get_table()` instead of `db_slice_rows()` to retrieve review …
jthompson-arcus Nov 8, 2024
0582b3b
Use `db_get_table()` instead of `db_slice_rows()` in tests
jthompson-arcus Nov 8, 2024
b370ff5
Remove unneeded slicing and filtering
jthompson-arcus Nov 8, 2024
f0837f2
Capture second snapshot
jthompson-arcus Nov 8, 2024
27c9220
Add comment for `idx_cols`
jthompson-arcus Nov 11, 2024
d1c81ea
Use unique names in function arguments from internal package objects
jthompson-arcus Nov 11, 2024
f271502
Merge pull request #115 from openpharma/jt-113-logging_tables
LDSamson Nov 11, 2024
cea4d43
Merge branch 'dev' into jt-113-simplify_review_process
jthompson-arcus Nov 11, 2024
3e1a650
Add trigger for update on id
jthompson-arcus Nov 11, 2024
851a5ba
Check DB version at run time
jthompson-arcus Nov 11, 2024
485f464
Update NEWS and version
jthompson-arcus Nov 11, 2024
dfdf945
Decode shinyproxy user name with base64 encoding, and return a warnin…
LDSamson Nov 1, 2024
dda0b05
Update news and version
LDSamson Nov 4, 2024
d56c4b1
Add a check if the package base64enc is installed within the `decode_…
LDSamson Nov 4, 2024
bab7a92
Update test database so a form with different review status per item …
LDSamson Nov 7, 2024
a37ff1d
Update mod_review_forms logic to ensure review was saved successfully
LDSamson Nov 7, 2024
7ac3278
Update mod_review_forms tests
LDSamson Nov 13, 2024
29eb7a0
Add all common vars to rows_update, so that review status is only upd…
LDSamson Nov 13, 2024
9940944
Update news and description
LDSamson Nov 15, 2024
bafae70
Resolve R CMD documentation note
LDSamson Nov 15, 2024
d21f519
Mark functions as internal for package website
LDSamson Nov 15, 2024
7efa574
Increase wait time to pass tests within Alpine Docker
LDSamson Nov 15, 2024
9d8555b
Update Alpine Docker test results
LDSamson Nov 15, 2024
0e266d7
Use `DBI` directly instead of `tbl()` and `collect()`
jthompson-arcus Nov 18, 2024
1405702
Fix typo in `user_db` version check
jthompson-arcus Nov 18, 2024
240c4e8
Only update records with new status.
jthompson-arcus Nov 18, 2024
8085287
Remove argument no longer used
jthompson-arcus Nov 18, 2024
a797883
Remove `common_vars` from tests
jthompson-arcus Nov 18, 2024
20f9528
Repair tests with `db_get_table()` returning `data.frame` not `tibble`
jthompson-arcus Nov 18, 2024
6fb21a6
Update `review_testdb.sqlite`
jthompson-arcus Nov 18, 2024
2a7b9e9
Update `mod_review_forms` test with new testing DB
jthompson-arcus Nov 18, 2024
c6ef19c
Update `all_review_data_id_update_trigger` to include `idx_cols`
jthompson-arcus Nov 18, 2024
1a85f40
Add `keys` argument to `db_add_log()`
jthompson-arcus Nov 18, 2024
c427f2d
Resolve some R CMD check issues
jthompson-arcus Nov 18, 2024
5d52f83
Add pkgdown gha workflow
aclark02-arcus Oct 1, 2024
bbf2b53
don't rely on renv.lock
aclark02-arcus Oct 1, 2024
e9ed1a4
update news
aclark02-arcus Oct 1, 2024
734f9ca
Update pkgdown workflow for use on dev and devex
LDSamson Nov 19, 2024
92677b0
Small NEWS.md wording update
jthompson-arcus Nov 19, 2024
573c633
Merge pull request #138 from openpharma/ls_create_v0.1.1
jthompson-arcus Nov 19, 2024
0e8b655
Resolve merge conflicts with `main`
jthompson-arcus Nov 19, 2024
a9488cc
small alignment fix
LDSamson Nov 20, 2024
906daf8
Merge pull request #142 from openpharma/jt-resolve_merge_conflicts_main
LDSamson Nov 20, 2024
b8e598e
Merge branch 'dev' into jt-113-simplify_review_process
LDSamson Nov 20, 2024
f57b549
Improve alignment according to https://style.tidyverse.org/syntax.htm…
LDSamson Nov 20, 2024
740a10a
Merge pull request #135 from openpharma/jt-113-simplify_review_process
LDSamson Nov 20, 2024
993035f
Resolve merge conflicts with `dev`
jthompson-arcus Nov 20, 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
13 changes: 11 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@

## Changed

- Added `pkgdown` GHA workflow to automatically update documentation site with PRs & pushes to `main` and `dev`
- Generalized `merge_meta_with_data()` to allow user-defined processing functions.
- Added a feature where, in applicable tables, a user can navigate to a form by double-clicking a table row.
- Fixed warnings in `apply_edc_specific_changes` due to the use of a vector within `dplyr::select`.
@@ -13,7 +12,17 @@

## Bug fixes

- When using the `shinyproxy` deployment configuration, the user name is now expected to be base64 encoded, and will now be base64 encoded by `clinsight` by default, so that the app can also handle non-ASCII signs in user names that are stored in HTTP headers. To display the user name correctly, use base64 encoding in the `application.yml` in ShinyProxy settings (for example: `http-headers.X_SP_USERNAME: "#{T(java.util.Base64).getEncoder().encodeToString(oidcUser.getFullName().getBytes())}"`).

# clinsight 0.1.1

## Changed

- Added `pkgdown` GHA workflow to automatically update documentation site with pushes to `main`

## Bug fixes

- Fixed inconsistencies in app messages when saving a review for a form with items with different review states (with some items reviewed previously by a different reviewer, and some items being completely new).
- Fixed a bug where clinsight deployed with `shinyproxy` would crash when a user with non-ASCII letters in their name would attempt to login. In this new version, when using the `shinyproxy` deployment configuration, the user name is now expected to be base64 encoded, and will now be base64 encoded by `clinsight` by default, so that the app can also handle non-ASCII signs in user names that are stored in HTTP headers. To display the user name correctly, use base64 encoding in the `application.yml` in ShinyProxy settings (for example: `http-headers.X_SP_USERNAME: "#{T(java.util.Base64).getEncoder().encodeToString(oidcUser.getFullName().getBytes())}"`).

# clinsight 0.1.0

2 changes: 1 addition & 1 deletion R/app_server.R
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
#' the `header widgets` ([mod_header_widgets_server()]), and the `query page`
#' ([mod_queries_server()])
#'
#' @param input,output,session Internal parameters for {shiny}.
#' @param input,output,session Internal parameters for `shiny`.
#' @seealso [app_ui()], [run_app()]
#'
app_server <- function(
2 changes: 1 addition & 1 deletion R/fct_data_helpers.R
Original file line number Diff line number Diff line change
@@ -391,7 +391,7 @@ get_form_level_data <- function(
#' @param value_column A string containing the column name with the item values.
#' @param id_column The columns identifying a unique participant (subject_id).
#'
#' @return as data frame with an additional column named "base_{varname}".
#' @return as data frame with an additional column named "base_`varname`".
#' @export
#' @examples
#' library(dplyr)
1 change: 0 additions & 1 deletion R/fct_utils.R
Original file line number Diff line number Diff line change
@@ -755,4 +755,3 @@ decode_base64 <- function(
}
rawToChar(decoded)
}

2 changes: 2 additions & 0 deletions R/mod_query_add.R
Original file line number Diff line number Diff line change
@@ -179,6 +179,8 @@ mod_query_add_server <- function(
db_path, query_id = new_query$query_id, n = new_query$n
)
query_in_db <- unique(query_in_db[names(new_query)])
query_in_db <- query_in_db[query_in_db$timestamp == new_query$timestamp[1], ]

if(identical(new_query, query_in_db)){
r$query_data <- dplyr::bind_rows(r$query_data, new_query)
}
27 changes: 19 additions & 8 deletions R/mod_review_forms.R
Original file line number Diff line number Diff line change
@@ -253,23 +253,34 @@ mod_review_forms_server <- function(
tables = "all_review_data"
)

review_row_db <- db_get_review(
# Contains multiple rows, one for each item.
updated_rows_db <- db_get_review(
db_path, subject = review_row$subject_id, form = review_row$item_group
)
review_row_db <- unique(review_row_db[names(review_row)])
)[c(names(review_row), "event_name", "item_name", "form_repeat")]
# Within a form, only items with a changed review state are updated and
# contain the new (current) time stamp.
updated_rows_db <- updated_rows_db[
updated_rows_db$timestamp == review_row$timestamp[1],
]

review_row_db <- unique(updated_rows_db[names(review_row)])
if(identical(review_row_db, review_row)){
cat("Update review data and status in app\n")
r$review_data <- r$review_data |>
dplyr::rows_update(review_row, by = c("subject_id", "item_group"))
dplyr::rows_update(
updated_rows_db,
by = c("subject_id", "item_group", "event_name", "item_name", "form_repeat")
)
}

review_row_memory <- review_row |>
dplyr::left_join(r$review_data, by = names(review_row))
review_row_memory <- unique(review_row_memory[names(review_row)])
updated_items_memory <- sort(with(r$review_data, item_name[
reviewer == review_row$reviewer[1] & timestamp == review_row$timestamp[1]
]))
updated_items_db <- sort(updated_rows_db$item_name)

review_save_error(any(
!identical(review_row_db, review_row),
!identical(review_row_memory, review_row_db)
!identical(updated_items_db, updated_items_memory)
))

if(review_save_error()){
2 changes: 1 addition & 1 deletion man/app_server.Rd

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

2 changes: 1 addition & 1 deletion man/get_base_value.Rd

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

Binary file modified tests/testthat/fixtures/testdb.sqlite
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/testthat/test-mod_report.R
Original file line number Diff line number Diff line change
@@ -279,7 +279,7 @@ describe(
app$click("test-report-create_report")
app$wait_for_idle(800)
app$set_inputs("test-report-include_from_date" = "2023-01-01")
app$wait_for_idle()
app$wait_for_idle(800)
app$expect_values()

pdf_report_path <- app$get_download("test-report-report")
22 changes: 9 additions & 13 deletions tests/testthat/test-mod_review_forms.R
Original file line number Diff line number Diff line change
@@ -94,19 +94,13 @@ describe(
)

session$setInputs(form_reviewed = TRUE, save_review = 1)
db_reviewdata <- db_temp_connect(db_path, {
dplyr::tbl(con, "all_review_data") |>
dplyr::collect()
})
db_reviewlogdata <- db_temp_connect(db_path, {
dplyr::tbl(con, "all_review_data_log") |>
dplyr::collect()
})
db_reviewdata <- db_get_table(db_path)
db_reviewlogdata <- db_get_table(db_path, "all_review_data_log")

expect_equal(r$review_data, db_get_table(db_path))
# new process expects the app data to be equal to DB data
expect_equal(r$review_data, db_reviewdata, ignore_attr = TRUE)
# app data should be equal to DB data
expect_equal(r$review_data, db_reviewdata)
# review table should only have one row in the DB containing the new reviewed = "Yes"
# for the item 'Cystitis'
expect_equal(
with(db_reviewdata, reviewed[subject_id == "885" & item_name == "Cystitis"]),
"Yes"
@@ -290,7 +284,7 @@ describe(
r$review_data, subject_id == "885",
item_group == "Adverse events",
edit_date_time == max(edit_date_time)
) |>
) |>
dplyr::select(subject_id, item_group, edit_date_time, reviewed, comment, status)
)
expect_equal(review_data_active()$item_group, "Adverse events")
@@ -370,7 +364,8 @@ describe(
ns <- session$ns
active_form("no_data_form")
data_before_saving <- r$review_data
db_before_save <- db_get_table(db_path)
db_before_saving <- db_get_table(db_path)

session$setInputs(save_review = 1)
expect_error(output[["save_review_error"]], "Nothing to review")
expect_equal(r$review_data, data_before_saving)
@@ -499,6 +494,7 @@ describe(
db_before_saving <- db_get_table(db_path)
session$setInputs(form_reviewed = TRUE, save_review = 1)
db_after_saving <- db_get_table(db_path)

expect_true(review_save_error())
expect_equal(r$review_data, rev_data)
expect_equal(db_after_saving, db_before_saving)
Binary file modified vignettes/test_results.rds
Binary file not shown.