Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
298 commits
Select commit Hold shift + click to select a range
431eb06
Remove duplicate module server
LDSamson Nov 28, 2025
f667c0d
add logic to restrict querying ans closing queries according to the .…
LDSamson Nov 29, 2025
cb44897
Make warnign for missing role less dramatic
LDSamson Nov 29, 2025
a19aca0
Update config.yml
LDSamson Nov 29, 2025
e771806
Make mock data reproducible
LDSamson Dec 1, 2025
89ab446
Make fig_timeseries more robust for edge cases (missing id_to_highlight)
LDSamson Dec 1, 2025
f5358dd
Add tests for fig_timeseries
LDSamson Dec 1, 2025
4775736
Add tests for new switches for figures
LDSamson Dec 1, 2025
c272594
Update .png snapshots with the new figure default
LDSamson Dec 1, 2025
b02a067
Chore: Update metadata docs
LDSamson Dec 1, 2025
60c3dd5
rewrite get_static_overview_data so that it can be used in multiple p…
LDSamson Dec 1, 2025
70fc2b9
Rewrite mod_header_widgets to remove dependency on filtered_tables
LDSamson Dec 1, 2025
eb3c185
Use static overview data in mod_navigate_participants instead of tabl…
LDSamson Dec 1, 2025
4971534
Rewrite get_timeline_data to only use AE table data
LDSamson Dec 1, 2025
9d08933
Phase out filtered_tables
LDSamson Dec 1, 2025
9e16fb7
Fix some tests. Add tests for new helper function
LDSamson Dec 2, 2025
0c22c75
Remove unused lines
LDSamson Dec 2, 2025
e335220
Ensure expected columns are always available for timeline data
LDSamson Dec 2, 2025
4442478
Make compact timeline script bit more robust for edge cases
LDSamson Dec 2, 2025
3060af1
Oops
LDSamson Dec 2, 2025
f1f029b
fix mod_review_config tests
LDSamson Dec 2, 2025
42d96da
Fix mod_timeline tests
LDSamson Dec 2, 2025
604cc4a
Fix snapshot of get_available_data
LDSamson Dec 2, 2025
e27fe25
Fix test for static overview data
LDSamson Dec 2, 2025
97dd2af
Update docs
LDSamson Dec 2, 2025
8d74c79
Update mod_common_forms test
LDSamson Dec 2, 2025
4fe8661
Update docs
LDSamson Dec 2, 2025
a3e7766
Fix test
LDSamson Dec 2, 2025
68e1442
More functional function argument verifications
LDSamson Dec 2, 2025
1544f01
Fix test
LDSamson Dec 2, 2025
a616b31
Update docs
LDSamson Dec 2, 2025
be48515
Bump version and add news.
LDSamson Dec 2, 2025
789edbc
improve get_timeline_data
LDSamson Dec 3, 2025
49f4ea9
Update docs
LDSamson Dec 3, 2025
813143e
move timeline_data to old location
LDSamson Dec 3, 2025
f063955
Convert timeline_data to a standard data frame instead of a reactive
LDSamson Dec 5, 2025
dc708ef
Ensure all_ids never has duplicated ids
LDSamson Dec 6, 2025
9d51f21
Ensure item names are never converted to factor level numbers
LDSamson Dec 6, 2025
a47479e
Ensure no errors are thrown in edge cases when using get_available_data
LDSamson Dec 6, 2025
82dc224
remove commented out code used for development
LDSamson Dec 6, 2025
c38dd4a
Bit easier to follow logic
LDSamson Dec 6, 2025
9306a41
Update standard user role privileges
LDSamson Dec 9, 2025
896a28b
Add toggle to enable multi-linel table rows in common forms
LDSamson Nov 22, 2025
99f4095
Update toggle text
LDSamson Nov 22, 2025
287ccef
Also enable toggle in study forms
LDSamson Dec 9, 2025
f57a33b
Update inputid to enable_text_wrap for consistency
LDSamson Dec 9, 2025
59a514b
Do not allow text wrap in form review mode
LDSamson Dec 9, 2025
87c9026
Apply line clamping to appropriate table column names
jthompson-arcus Dec 9, 2025
0e53099
Update test snapshots
jthompson-arcus Dec 9, 2025
ed69f97
Update version and NEWS
jthompson-arcus Dec 9, 2025
fadb525
Use base R and HTML escaping
jthompson-arcus Dec 10, 2025
a9b03ae
Add `escape` to list of parameters to `datatable_custom()`
jthompson-arcus Dec 10, 2025
9f302d1
Add additional buttons to navigate between common events and study data
LDSamson Dec 12, 2025
29ef155
detach timeline from common_forms
LDSamson Dec 12, 2025
e4d251d
Merge pull request #253 from openpharma/jt-line_clamp
LDSamson Dec 12, 2025
5875346
Merge remote-tracking branch 'origin/dev' into ls_improve_efficiency
LDSamson Dec 12, 2025
99d586f
Bump version
LDSamson Dec 12, 2025
a35513e
Merge remote-tracking branch 'origin/dev' into ls_improve_figs
LDSamson Dec 12, 2025
ffb2996
Merge remote-tracking branch 'origin/dev' into ls_224_add_table_text_…
LDSamson Dec 12, 2025
9a41bc4
Fix snaps for app feature 3, make them more focused
LDSamson Dec 12, 2025
f06c392
Update snaps for mod_study_forms
LDSamson Dec 12, 2025
348e3e7
Merge remote-tracking branch 'origin/dev' into ls_additional_navigati…
LDSamson Dec 12, 2025
6388ca1
Update feature 3 snapshot
LDSamson Dec 12, 2025
1ee69b6
Update news
LDSamson Dec 12, 2025
9201e51
Bump version
LDSamson Dec 12, 2025
b228fba
Update news
LDSamson Dec 12, 2025
c353205
Bump version
LDSamson Dec 12, 2025
c9d1e16
Capture table text wrap in feature 1 test
LDSamson Dec 12, 2025
3a0a673
Adjust Feature 3 snapshot
LDSamson Dec 12, 2025
b7bfae7
Create selector for type of data to display
LDSamson Dec 13, 2025
14881ba
Merge branch 'dev' into ls_add_query_role_privilege
LDSamson Dec 13, 2025
7063a06
Merge branch 'dev' into ls_adjust_timeline
LDSamson Dec 13, 2025
a36b884
Add cursor hovers for header widgets to indicate that they are clickable
LDSamson Dec 13, 2025
ed868b8
Revert adding sidebar in mod_timeline
LDSamson Dec 13, 2025
360cb94
Start adding buttons in mod_study_forms and mod_common_forms for cont…
LDSamson Dec 13, 2025
a2819d1
Update logic to only change timeline and not headers
LDSamson Dec 13, 2025
9c63919
update input IDs
LDSamson Dec 13, 2025
8942217
Ùse tagList again around timeline
LDSamson Dec 13, 2025
1889074
Undo aligning changes
LDSamson Dec 13, 2025
99ada9b
Move added code together
LDSamson Dec 13, 2025
1e7cf2f
Hide toggle in form level review
LDSamson Dec 13, 2025
c6a7c76
Move timeline to header
LDSamson Dec 13, 2025
91f9fb1
Use clinsight-config.yml if available
LDSamson Dec 14, 2025
c5cae09
Polish warning messages for roles a bit more
LDSamson Dec 14, 2025
8f87af7
Simplify logic. Adjust config yaml
LDSamson Dec 15, 2025
38ff202
Simplify a bit more
LDSamson Dec 15, 2025
cfda1a4
simnplify names
LDSamson Dec 15, 2025
da73497
Add and adjust tests
LDSamson Dec 15, 2025
878dc9e
Bump version
LDSamson Dec 15, 2025
864db61
Reduce changes to config.yml
LDSamson Dec 15, 2025
75ab3b5
Update feature test snapshot
LDSamson Dec 15, 2025
54f5c5c
Further reduce config file changes
LDSamson Dec 15, 2025
c0a3be9
Update tests
LDSamson Dec 15, 2025
22a551c
Add news item
LDSamson Dec 15, 2025
2219a8d
Update shinyproxy config
LDSamson Dec 15, 2025
1f2781a
Fix expected test message in app_server test
LDSamson Dec 15, 2025
9388c60
Move logic to module
LDSamson Dec 15, 2025
ea0df6c
remove timeline data from mod_common_forms and update docs
LDSamson Dec 15, 2025
b35ea0f
Ensure toggles reactive toggles are always there with default values …
LDSamson Dec 16, 2025
1eaa972
Update test ID for timeline
LDSamson Dec 16, 2025
d00f983
Update tests and snaps
LDSamson Dec 16, 2025
c246eff
Update snaps
LDSamson Dec 16, 2025
3da9bce
Update tests
LDSamson Dec 16, 2025
1faeef4
Bit more robust timeline data
LDSamson Dec 16, 2025
c9fe7e7
Remove scenario in mod_common_forms involving timeline
LDSamson Dec 16, 2025
3af8551
Put navinfo objects together
LDSamson Dec 16, 2025
071431d
Make menu reactive. Hide standardized option if not available
LDSamson Dec 16, 2025
862dddd
Works but too much reactivity
LDSamson Dec 17, 2025
2307b08
Update docs
LDSamson Dec 17, 2025
0695ad9
Simplify logic, make two buttons, rename buttons and inputs
LDSamson Dec 17, 2025
5a6faac
Bump version. Add news item
LDSamson Dec 17, 2025
f83e8bd
Update docs
LDSamson Dec 17, 2025
de09ff7
Update docs
LDSamson Dec 17, 2025
05fdccf
Convert character yvals to numeric for timeseries figures as extra sa…
LDSamson Dec 17, 2025
721083e
Adjust default to none after named update
LDSamson Dec 17, 2025
426c8cb
Remove unneeded logic
LDSamson Dec 17, 2025
9c976ce
Update R/mod_study_forms.R
LDSamson Dec 17, 2025
a183c5c
Update R/mod_common_forms.R
LDSamson Dec 17, 2025
52be518
Use double ampersand instead
LDSamson Dec 17, 2025
c307bbb
Merge pull request #249 from openpharma:ls_improve_figs
jthompson-arcus Dec 17, 2025
0e273b9
Merge branch 'dev' into ls_add_query_role_privilege
LDSamson Dec 18, 2025
1631bbd
Bump version
LDSamson Dec 18, 2025
e131b40
Merge branch 'dev' into ls_224_add_table_text_wrap_toggle
LDSamson Dec 18, 2025
44144cc
Bump version
LDSamson Dec 18, 2025
269986c
Update snaps again
LDSamson Dec 18, 2025
f49a27a
Merge branch 'dev' into ls_add_data_transformation_selection
LDSamson Dec 18, 2025
b1e87ac
Bit more robustness
LDSamson Dec 18, 2025
410ccfc
Adjust tests
LDSamson Dec 18, 2025
e848984
Add back transformation default if value is missing
LDSamson Dec 18, 2025
961cc38
Update snaps
LDSamson Dec 18, 2025
c68afd5
Update tests
LDSamson Dec 18, 2025
ff290b3
Add toggle to show lab limits in tables
LDSamson Dec 19, 2025
28f260c
Only show lab limit toggle when it makes sense
LDSamson Dec 19, 2025
a2b3301
Use correct default
LDSamson Dec 19, 2025
70091af
Also add label for standardized values if applicable
LDSamson Dec 22, 2025
4e4d03c
Hide buttons if no transformations available
LDSamson Dec 22, 2025
873d63e
Make snaps much smaller
LDSamson Dec 22, 2025
f9cc20c
Make snaps much smaller
LDSamson Dec 22, 2025
ded2e39
To convert test app JSON objects
LDSamson Dec 22, 2025
b9d68f9
Update docs
LDSamson Dec 22, 2025
ea9e096
Merge branch 'dev' into ls_improve_efficiency
LDSamson Dec 22, 2025
206aa2c
Bump version
LDSamson Dec 22, 2025
5db5cc6
Merge branch 'dev' into ls_adjust_timeline
LDSamson Dec 22, 2025
1a7d205
Bump version
LDSamson Dec 22, 2025
5fd3a99
Merge branch 'dev' into ls_additional_navigation_btns
LDSamson Dec 22, 2025
793ee0a
Simplify feature 3 snaps
LDSamson Dec 22, 2025
5b50d3e
Add a few clicks on the new buttons in tests
LDSamson Dec 22, 2025
051a2b9
Fix docs
LDSamson Dec 22, 2025
89c9495
Add test for timeline toggle
LDSamson Dec 22, 2025
2c9e82b
Simplify test app
LDSamson Dec 22, 2025
6e4ec78
Fix reactivity
LDSamson Dec 22, 2025
6852e90
Do not error with missing labels
LDSamson Dec 22, 2025
9eabf73
Add test for transformation toggle
LDSamson Dec 22, 2025
f4061e5
Test limit toggle in tables
LDSamson Dec 22, 2025
1152106
Merge pull request #251 from openpharma/ls_improve_efficiency
aclark02-arcus Dec 29, 2025
0a92929
Merge pull request #255 from openpharma/ls_additional_navigation_btns
aclark02-arcus Dec 29, 2025
41374ca
Merge branch 'dev' into ls_add_data_transformation_selection
aclark02-arcus Dec 29, 2025
5078ead
Update snaps
LDSamson Jan 5, 2026
89c9b4c
Remove commented out lines
LDSamson Jan 5, 2026
23bec9c
Bump version
LDSamson Jan 5, 2026
5126991
Add issue numbers in news and removed duplicated news items
LDSamson Jan 5, 2026
9838569
Merge pull request #259 from openpharma/ls_add_data_transformation_se…
LDSamson Jan 5, 2026
b0dd0e3
Merge branch 'dev' into ls_adjust_timeline
LDSamson Jan 5, 2026
1bba2aa
Update CSS for new timeline toggle
LDSamson Jan 5, 2026
5543de9
Merge branch 'dev' into ls_add_query_role_privilege
LDSamson Jan 5, 2026
3f30019
Merge branch 'dev' into ls_224_add_table_text_wrap_toggle
LDSamson Jan 5, 2026
21df1b3
perform more expensive computations on database
LDSamson Jan 5, 2026
21b6fc3
Replace dplyr::case_when with base R alternative
LDSamson Jan 5, 2026
2a20eb2
Rename and document function argument
LDSamson Jan 5, 2026
d6c42c4
Add simple unit test
LDSamson Jan 5, 2026
6e71127
Add news and bump version
LDSamson Jan 5, 2026
edfba6c
Enable pagination again conditionally
LDSamson Jan 5, 2026
267980c
Update snapshot
LDSamson Jan 5, 2026
d662696
Use double ampersand for consistency
LDSamson Jan 5, 2026
e95f72c
Add server side check whether a user is allowed to resolve a query
LDSamson Jan 6, 2026
361daf0
Ensure on the server that query is not yet resolved before adding a F…
LDSamson Jan 6, 2026
da33777
Update clinsight config helper and message
LDSamson Jan 6, 2026
64497c1
Update deployment vignette
LDSamson Jan 6, 2026
fdb420e
Update test
LDSamson Jan 6, 2026
8131866
Simplify summary data function
LDSamson Jan 9, 2026
6c69037
Do not use db_get_summary_data anymore
LDSamson Jan 9, 2026
98899c8
Update tests
LDSamson Jan 9, 2026
e5d8cca
Remove now redundant reactive value
LDSamson Jan 9, 2026
7098964
Remove file changes
LDSamson Jan 9, 2026
6fc08b5
Adjust test
LDSamson Jan 9, 2026
b6b59c4
Merge pull request #256 from openpharma:ls_add_query_role_privilege
jthompson-arcus Jan 9, 2026
7783f3f
Skip xval scaling if no xvals available
LDSamson Jan 12, 2026
c6a8a36
Change switch
LDSamson Jan 12, 2026
07dbe09
Add animation
LDSamson Jan 12, 2026
92c87bb
code styling
LDSamson Jan 12, 2026
2213d54
Merge branch 'dev' into ls_adjust_timeline
LDSamson Jan 12, 2026
6df7975
Bump version
LDSamson Jan 12, 2026
9bf0786
Add news
LDSamson Jan 12, 2026
6e508e5
Add wait time in test to wait for animation
LDSamson Jan 12, 2026
8b575da
Add test to cover bug
LDSamson Jan 12, 2026
cda5a9e
Bump version
LDSamson Jan 12, 2026
7e6ce14
Merge branch 'dev' into ls_refactor_summary_data
LDSamson Jan 12, 2026
528cfbe
Merge branch 'dev' into ls_224_add_table_text_wrap_toggle
LDSamson Jan 12, 2026
2c32914
Delete tooltip warning
LDSamson Jan 12, 2026
1aa7ef0
Enable text wrap toggle in form review mode
LDSamson Jan 12, 2026
3afad81
Add some padding at the bottom of the SAE table
LDSamson Jan 12, 2026
a5fab16
Change standard x limit range to c(0,3)
LDSamson Jan 12, 2026
de3033e
Make sure the toggle works in common_forms for form-level review
LDSamson Jan 12, 2026
a79efb2
Add text wrap option in form level review for study forms
LDSamson Jan 12, 2026
76e6fcf
Toggle text wrap to FALSE when switching to view data from all subjects
LDSamson Jan 12, 2026
41fc195
Switch to native bslib toggles, add icons
LDSamson Jan 12, 2026
0d3a3e0
Fix relative path for icon
LDSamson Jan 12, 2026
93e025c
Merge pull request #266 from openpharma/ls_fix_fig_bug
jthompson-arcus Jan 13, 2026
b875142
Merge branch 'dev' into ls_224_add_table_text_wrap_toggle
LDSamson Jan 14, 2026
4d6a19e
Bump version
LDSamson Jan 14, 2026
bd9139e
Merge branch 'dev' into ls_refactor_summary_data
LDSamson Jan 14, 2026
869e053
Bump version
LDSamson Jan 14, 2026
47f5d65
Merge branch 'dev' into ls_adjust_timeline
LDSamson Jan 14, 2026
c001cb4
Bump version
LDSamson Jan 14, 2026
68b1399
Merge pull request #258 from openpharma/ls_adjust_timeline
jthompson-arcus Jan 21, 2026
3fce029
Merge branch 'dev' into ls_refactor_summary_data
jthompson-arcus Jan 21, 2026
3088936
Bump version
jthompson-arcus Jan 21, 2026
ef9d9a3
Merge pull request #262 from openpharma/ls_refactor_summary_data
jthompson-arcus Jan 21, 2026
edca4e1
Merge branch 'dev' into ls_change_to_bslib_toggles
LDSamson Jan 27, 2026
fa88660
Update icon to toggle lab limits in tables
LDSamson Jan 27, 2026
f4178e5
Remove double escaping in titles
LDSamson Jan 30, 2026
3c0df4e
Bump version
LDSamson Jan 30, 2026
f34b1af
Merge branch 'dev' into ls_224_add_table_text_wrap_toggle
LDSamson Jan 30, 2026
2c0a2e1
Fix pending review records not updating after toggling table wrap.
LDSamson Jan 30, 2026
58511b8
Add test to ensure pending reviews are unaffected from text wrap toggle
LDSamson Jan 30, 2026
56beb89
Merge branch 'ls_224_add_table_text_wrap_toggle' into ls_change_to_bs…
LDSamson Jan 30, 2026
baeb28a
Merge pull request #252 from openpharma/ls_224_add_table_text_wrap_to…
jthompson-arcus Feb 2, 2026
d0f9d3e
Merge branch 'dev' into ls_remove_double_title_escaping
LDSamson Feb 3, 2026
74188d6
Bump version
LDSamson Feb 3, 2026
6c65a3b
Merge branch 'dev' into ls_change_to_bslib_toggles
LDSamson Feb 3, 2026
54bdb60
Bump version
LDSamson Feb 3, 2026
c12ebb6
Add news item
LDSamson Feb 3, 2026
8b72252
Merge pull request #268 from openpharma/ls_change_to_bslib_toggles
LDSamson Feb 3, 2026
92f2d50
Merge branch 'dev' into ls_remove_double_title_escaping
LDSamson Feb 3, 2026
e43ca96
Bump version again
LDSamson Feb 3, 2026
e48ff17
Increment version number to 0.3.0.9015
aclark02-arcus Feb 3, 2026
7839b2f
add origin arg to as.Date() in get_timeline_data()
aclark02-arcus Feb 3, 2026
cc5dad8
Add some wait time for more robust test result
LDSamson Feb 5, 2026
7e037b5
Merge pull request #269 from openpharma/ac-date-origin
LDSamson Feb 5, 2026
6ab1f18
Merge branch 'dev' into ls_remove_double_title_escaping
LDSamson Feb 5, 2026
b57d066
Bump version
LDSamson Feb 5, 2026
3be43aa
Updating .png snapshots to display latest app UI
LDSamson Feb 5, 2026
df2db87
Clean NEWS
LDSamson Feb 5, 2026
30cbb45
Bump version
LDSamson Feb 5, 2026
87aad2d
Update documentation
LDSamson Feb 5, 2026
52390d6
Update wording
LDSamson Feb 5, 2026
c457c3f
Update test report
LDSamson Feb 5, 2026
1f82a32
Add new features to test report
LDSamson Feb 5, 2026
4cf999a
Merge pull request #267 from openpharma/ls_remove_double_title_escaping
LDSamson Feb 9, 2026
f6055b3
Merge remote-tracking branch 'origin/dev' into rc_0.4.0
LDSamson Feb 9, 2026
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
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Package: clinsight
Title: ClinSight
Version: 0.3.0
Version: 0.4.0
Authors@R: c(
person("Leonard Daniël", "Samson", , "lsamson@gcp-service.com", role = c("cre", "aut"),
comment = c(ORCID = "0000-0002-6252-7639")),
person("Aaron", "Clark", , "aclark02@arcusbio.com", role = "ctb",
person("Aaron", "Clark", , "aclark02@arcusbio.com", role = "aut",
comment = c(ORCID = "0000-0002-0123-0970")),
person("Jeff", "Thompson", , "jthompson@arcusbio.com", role = "ctb",
person("Jeff", "Thompson", , "jthompson@arcusbio.com", role = "aut",
comment = c(ORCID = "0009-0007-3640-1075")),
person("GCP-Service International Ltd.& Co. KG", role = "fnd")
)
Expand Down Expand Up @@ -49,6 +49,7 @@ Imports:
Suggests:
base64enc,
chromote,
jsonlite,
kableExtra,
knitr,
pkgload,
Expand Down
34 changes: 34 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# clinsight 0.4.0

## Changed

- Implemented a `line-clamp` on table column names that wrap to more than 6 lines (#253).
- Added a toggle to switch data transformation (#110, #261).
- Added functionality to show data transformed to standard values so that all are shown in the same unit (#110, #261).
- Figures now also show patient-specific lab limits in the figures when data is not transformed (if available) (#249).
- Improved the time-series on-hover label so that limits and significance are also shown (#249).
- Added a toggle to enable/disable background patterns in figures (#249).
- Added a toggle to enable hover labels of background patterns in the figures (#249).
- Added additional navigation buttons next to more easily navigate between between common forms and study forms (#255).
- Added a toggle to enable text wrapping in tables (#252).
- Added a toggle to show laboratory limits in the tables (#110).
- The timeline is now available in all forms and can be toggled on or off (#258).
- Visually updated table and figure switches to native `bslib` switches and added icons to them (#268).

## Bug fixes

- [fix_multiple_choice_vars()] now also fixes long-format multiple choice variables that end with a number (#247).
- Added date origin to `as.Date()` in `get_timeline_data()` that Posit Connect couldn't handle without (#269).
- Switched to server-side table downloads to ensure that always all data is included in the table (#240, #241, #250).
- Data from before baseline events (which is counted as day zero) are now also shown in figures. Now the baseline event can for example be set on the first treatment day, and the screening data will show as a negative day in the figures (#242).

## Developer notes

- Updated role of long-term contributors to co-authors in Description field (#246).
- Refactored some functions so that it is no longer needed to create an `apptables` object when starting the application, improving start up efficiency (#251).
- Refactored function to retrieve summary data to improve efficiency (#263).
- Replaced `dplyr::case_when()` with `ifelse()` in the row review status calculation for efficiency (#243).
- `ClinSight` now also looks for a `clinsight-config.yml` file in the current working directory and uses it as custom configuration (#256).
- Added better control of role privileges - `allowed_to_review` and `allowed_to_query` can now be set per role in the `config.yml` file (#17, #256).
- Several test snapshots are now much smaller, with better focus on the feature being tested so that they are easier to maintain (#259).

# clinsight 0.3.0

## Developer notes
Expand Down
141 changes: 87 additions & 54 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ app_server <- function(

app_data <- get_appdata(merged_data, meta = meta)
app_vars <- get_meta_vars(data = app_data, meta = meta)
app_tables <- lapply(
setNames(names(app_data), names(app_data)), \(x){
create_table(app_data[[x]], expected_columns = names(app_vars$items[[x]]))
})
check_appdata(app_data, meta)

session$userData$pending_review_records <- reactiveValues()
Expand All @@ -45,8 +41,6 @@ app_server <- function(
# For query item selector drop-down menus:
available_data <- get_available_data(
data = app_data,
tables = app_tables,
all_forms = app_vars$all_forms,
form_repeat_name = with(
meta[["table_names"]],
table_name[raw_name == "form_repeat"]
Expand All @@ -57,17 +51,25 @@ app_server <- function(
# For summary review data:
static_overview_data <- get_static_overview_data(
data = app_data,
available_data = available_data,
expected_general_columns = unique(
with(meta$items_expanded, item_name[item_group == "General"])
)
)

# For timeline data
timeline_data <-get_timeline_data(
app_data,
available_data = available_data,
treatment_label = meta$settings$treatment_label %||% "\U1F48A T\U2093"
)

# think of using the pool package, but functions such as row_update are not yet supported.
r <- reactiveValues(
review_data = do.call(reactiveValues, split_review_data(user_db, forms = app_vars$all_forms$form)),
query_data = collect_query_data(user_db),
filtered_subjects = app_vars$subject_id,
filtered_data = app_data,
filtered_tables = app_tables,
subject_id = app_vars$subject_id[1]
)

Expand All @@ -84,27 +86,25 @@ app_server <- function(
user_error("No valid user name provided. ")
}
if(r$user_role == ""){
user_error(paste0(user_error(), "No valid user role provided. "))
user_error(paste0(user_error(), "No user role assigned. "))
}
if(!is.null(user_error())){
user_error(
paste0(
user_error(),
"Functionality is limited. ",
"Please contact the administrator to resolve this issue."
"If this is unexpected, please contact the administrator."
)
)
}
})

forms_to_review_data <- app_vars$form_level_data[c("item_group", "review_required")]

observeEvent(user_error(), {
showNotification(
user_error(),
id = "user_error",
type = "error",
duration = NULL
type = "warning",
duration = 5
)
})

Expand All @@ -116,34 +116,30 @@ app_server <- function(
observeEvent(rev_sites(), {
req(!all(rev_sites() %in% app_vars$Sites$site_code))
r <- filter_data(r, rev_sites(), subject_ids = app_vars$subject_id,
appdata = app_data, apptables = app_tables)
appdata = app_data)
})

navinfo <- reactiveValues(
active_form = app_vars$all_forms$form[1],
active_tab = "Start",
trigger_page_change = 1
trigger_page_change = 1,
cf_toggle_timeline = reactive({input$cf_toggle_timeline}),
sf_toggle_timeline = reactive({input$sf_toggle_timeline})
)

start_page_summary_vars <- c("subject_status", "WHO.classification", "Age", "Sex", "event_name")
forms_to_review <- with(app_vars$form_level_data, item_group[review_required])
rev_data <- reactiveValues(
summary = reactive({
req(forms_to_review_data)
r$review_data |>
reactiveValuesToList() |>
do.call(what = rbind) |>
dplyr::left_join(forms_to_review_data, by = "item_group") |>
dplyr::filter(
reviewed != "Yes",
review_required,
subject_id %in% r$filtered_subjects
) |>
summarize_review_data() |>
dplyr::select(subject_id, "Form" = item_group, "Event" = event_name,
"Edit date" = edit_date_time, status, reviewed)
req(forms_to_review)
reactiveValuesToList(r$review_data)[forms_to_review] |>
dplyr::bind_rows() |>
subset(reviewed != "Yes" & subject_id %in% r$filtered_subjects) |>
summarize_review_data()
}),
overview = reactive({
static_overview_data |>
dplyr::filter(subject_id %in% r$filtered_subjects) |>
with(static_overview_data, static_overview_data[subject_id %in% r$filtered_subjects, ]) |>
dplyr::select(tidyr::all_of("subject_id"), tidyr::any_of(start_page_summary_vars)) |>
dplyr::mutate(
needs_review = subject_id %in% unique(rev_data$summary()$subject_id)
) |>
Expand Down Expand Up @@ -206,14 +202,6 @@ app_server <- function(
identical(session$userData$review_type(), "form")
})
outputOptions(output, "form_level_review", suspendWhenHidden = FALSE)

timeline_data <- reactive({
get_timeline_data(
r$filtered_data,
r$filtered_tables,
treatment_label = meta$settings$treatment_label %||% "\U1F48A T\U2093"
)
})

###### Load common form tabs in UI and server:
common_forms <- with(app_vars$all_forms, form[main_tab == "Common events"])
Expand All @@ -224,6 +212,10 @@ app_server <- function(
select = (i == common_forms[1])
)
})
bslib::nav_insert(
id = "common_data_tabs",
nav = bslib::nav_item(actionLink("go_to_study_data", ">", class="nav-link px-3"))
)
lapply(common_forms, \(x){
mod_common_forms_server(
id = paste0("cf_", simplify_string(x)),
Expand All @@ -232,14 +224,17 @@ app_server <- function(
form_review_data = reactive(r$review_data[[x]]),
form_items = app_vars$items[[x]],
active_subject = reactive(r$subject_id),
table_names = app_vars$table_names,
timeline_data = timeline_data
table_names = app_vars$table_names
)
}) |>
unlist(recursive = FALSE)

###### Load study form tabs in UI and server:
study_forms <- with(app_vars$all_forms, form[main_tab == "Study data"])
bslib::nav_insert(
id = "study_data_tabs",
nav = bslib::nav_item(actionLink("go_to_common_events", "<", class="nav-link px-3"))
)
lapply(study_forms, \(i){
bslib::nav_insert(
id = "study_data_tabs",
Expand All @@ -248,6 +243,7 @@ app_server <- function(
select = (i == study_forms[1])
)
})

lapply(study_forms, \(x){
mod_study_forms_server(
id = paste0("sf_", simplify_string(x)),
Expand All @@ -262,16 +258,59 @@ app_server <- function(
}) |>
unlist(recursive = FALSE)

bslib::nav_insert(
id = "common_data_tabs",
bslib::nav_item(
class = "ms-auto mb-0",
bslib::input_switch(
id = "cf_toggle_timeline",
label = span(icon("timeline"), "Timeline"),
value = TRUE,
width = "auto"
) |>
htmltools::tagAppendAttributes(class = "mb-0")
)
)

bslib::nav_insert(
id = "study_data_tabs",
bslib::nav_item(
class = "ms-auto",
bslib::input_switch(
id = "sf_toggle_timeline",
label = span(icon("timeline"), "Timeline"),
value = FALSE,
width = "auto"
) |>
htmltools::tagAppendAttributes(class = "mb-0")
)
)

observeEvent(session$userData$review_type(), {
subject_level_review <- identical(session$userData$review_type(), "subject")
shinyjs::toggleElement("cf_toggle_timeline", subject_level_review)
shinyjs::toggleElement("sf_toggle_timeline", subject_level_review)
})


observeEvent(input$go_to_study_data, {
bslib::nav_select(id = "main_tabs", selected = "Study data")
})
observeEvent(input$go_to_common_events, {
bslib::nav_select(id = "main_tabs", selected = "Common events")
})

mod_start_page_server("start_page_1", r, rev_data, navinfo, app_vars$all_forms,
app_vars$table_names)
mod_header_widgets_server(
id = "header_widgets_1",
r = r,
rev_data = rev_data,
navinfo = navinfo
navinfo = navinfo,
timeline_data = timeline_data,
available_data = available_data
)


# Only initiate the sidebar after successful login, because it contains a
# modal that pops up if data is out of synch. Modals interfere with shinymanager.
observeEvent(r$user_name, {
Expand All @@ -298,26 +337,16 @@ app_server <- function(
id = "main_sidebar_1",
r = r,
app_data = app_data,
app_tables = app_tables,
app_vars = app_vars,
navinfo,
forms_to_review = reactive({
with(rev_data$summary(), Form[subject_id == r$subject_id])
with(rev_data$summary(), item_group[subject_id == r$subject_id])
}),
db_path = user_db,
available_data = available_data
)
})

mod_review_config_server(
"review_config_1",
r = r,
app_data = app_data,
app_tables = app_tables,
sites = app_vars$Sites,
subject_ids = app_vars$subject_id
)

mod_queries_server(
"queries_1",
r = r,
Expand All @@ -329,7 +358,11 @@ app_server <- function(
mod_report_server("report_1", r = r, rev_data, db_path = user_db,
table_names = app_vars$table_names)

mod_navigate_participants_server("navigate_participants_1", r)
mod_navigate_participants_server(
"navigate_participants_1",
r,
static_overview_data
)

mod_navigate_review_server(
"navigate_review_1",
Expand Down
2 changes: 1 addition & 1 deletion R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ app_ui <- function(request){
),
bslib::nav_panel(
title = "Common events",
bslib::navset_tab(id = "common_data_tabs")
bslib::navset_tab(id = "common_data_tabs")
),
bslib::nav_panel(
"Study data",
Expand Down
Loading