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

Enhancement: setup system for TLG (plots) #124

Merged
merged 103 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
a74289d
feat, wip: simple DEMO of tlg implementation
m-kolomanski Nov 15, 2024
c2b903a
feat: tlg_plot cleans up user input, adjusted to functions returning …
m-kolomanski Nov 21, 2024
19f519b
feat: working page selection
m-kolomanski Nov 28, 2024
d4c24e0
feat, wip: basic implementation of pckg01 plot
m-kolomanski Nov 28, 2024
db1304d
feat: support for numeric and text values
m-kolomanski Nov 28, 2024
923fafa
feat: added support for custom labels for inputs
m-kolomanski Nov 28, 2024
393152f
feat: support for select options
m-kolomanski Nov 28, 2024
5888be7
fix: axis units
m-kolomanski Nov 28, 2024
7249999
fix: footnote
m-kolomanski Nov 28, 2024
4f86ffe
fix: all plots showing static reference titles and captions
m-kolomanski Nov 28, 2024
db56b27
feat: smaller left selection panel
m-kolomanski Nov 28, 2024
b40e0b0
feat: converted ggplot to plotly
m-kolomanski Nov 28, 2024
cafd11e
refactor: renamed opts to options
m-kolomanski Dec 12, 2024
17cd533
feat: added target=_blank to links in the tlg table
m-kolomanski Dec 12, 2024
829e664
refactor: better tlg talbe generation
m-kolomanski Dec 12, 2024
d0ac1f6
fix: plot module crashing
m-kolomanski Dec 12, 2024
4479fe7
refactor: removed mixing patterns
m-kolomanski Dec 12, 2024
0f06819
docs: updated documentation
m-kolomanski Dec 12, 2024
785d459
feat: implemented keyword for selecting choices from data column
m-kolomanski Dec 12, 2024
9fd3c3a
feat: added ability to specify defaults
m-kolomanski Dec 12, 2024
cfda424
docs: added comments, fixed spelling
m-kolomanski Dec 12, 2024
0f9700d
feat: added ability to provide grouping labels for the widgets
m-kolomanski Dec 12, 2024
49793d5
chore: added missing deps
m-kolomanski Dec 12, 2024
3826e49
feat: added ability to specify number of plots per page
m-kolomanski Dec 13, 2024
8506181
feat, wip: simple DEMO of tlg implementation
m-kolomanski Nov 15, 2024
235f30f
feat: tlg_plot cleans up user input, adjusted to functions returning …
m-kolomanski Nov 21, 2024
9369ab0
feat: working page selection
m-kolomanski Nov 28, 2024
4f32176
feat, wip: basic implementation of pckg01 plot
m-kolomanski Nov 28, 2024
b03ad40
feat: support for numeric and text values
m-kolomanski Nov 28, 2024
c6aeddf
feat: added support for custom labels for inputs
m-kolomanski Nov 28, 2024
0df4e44
feat: support for select options
m-kolomanski Nov 28, 2024
fedea42
fix: axis units
m-kolomanski Nov 28, 2024
35a8c62
fix: footnote
m-kolomanski Nov 28, 2024
58feff7
fix: all plots showing static reference titles and captions
m-kolomanski Nov 28, 2024
3e72b63
feat: smaller left selection panel
m-kolomanski Nov 28, 2024
5ac2b65
feat: converted ggplot to plotly
m-kolomanski Nov 28, 2024
a0fa727
refactor: renamed opts to options
m-kolomanski Dec 12, 2024
4d2e4ff
feat: added target=_blank to links in the tlg table
m-kolomanski Dec 12, 2024
c64f3b4
refactor: better tlg talbe generation
m-kolomanski Dec 12, 2024
7016063
fix: plot module crashing
m-kolomanski Dec 12, 2024
1db1998
refactor: removed mixing patterns
m-kolomanski Dec 12, 2024
7041c64
docs: updated documentation
m-kolomanski Dec 12, 2024
8ef873a
feat: implemented keyword for selecting choices from data column
m-kolomanski Dec 12, 2024
6be6958
feat: added ability to specify defaults
m-kolomanski Dec 12, 2024
76bce03
docs: added comments, fixed spelling
m-kolomanski Dec 12, 2024
fb61e02
feat: added ability to provide grouping labels for the widgets
m-kolomanski Dec 12, 2024
d0eb63b
chore: added missing deps
m-kolomanski Dec 12, 2024
f52ee39
feat: added ability to specify number of plots per page
m-kolomanski Dec 13, 2024
1dcd56e
Merge branch 'enhancement/setup-tlg-plots' of github.com:pharmaverse/…
m-kolomanski Dec 16, 2024
8620321
chore: set all plots on page as default
m-kolomanski Dec 16, 2024
922435a
fix: R CMD check
m-kolomanski Dec 16, 2024
bb7ec92
fix: invalid arguments to filter_breaks()
m-kolomanski Dec 16, 2024
c7a6c73
refactor: changed order of plot widgets
m-kolomanski Dec 16, 2024
bf3cd10
feat: option to reset widgets to defaults
m-kolomanski Dec 16, 2024
b7694da
feat: auto change tabs after submitting order; added logs
m-kolomanski Dec 16, 2024
bca9858
refactor: created global data reactive for easy access across modules
m-kolomanski Dec 16, 2024
f63dda6
chore: updated definition for g_pkconc_ind_lin plot
m-kolomanski Dec 16, 2024
caf1e47
feat: added templating options
m-kolomanski Dec 16, 2024
5cd2df9
Merge branch 'main' into enhancement/setup-tlg-plots
m-kolomanski Dec 16, 2024
8ee522d
refactor: rendering widgets, added debounce
m-kolomanski Dec 16, 2024
e618aa3
refactor: removed yvar from pkcg01 definition
m-kolomanski Dec 16, 2024
6330c69
refactor: migrated UI to bslib
m-kolomanski Dec 16, 2024
f1febc6
docs: added documentation for creating tlgs
m-kolomanski Dec 16, 2024
c838ccb
feat, wip: dynamic title and subtitle; fix: footnote working with plotly
m-kolomanski Dec 17, 2024
de14e39
docs: roxygen update
m-kolomanski Dec 17, 2024
0c8d876
refactor: changed column name keyword denominator to $
m-kolomanski Dec 18, 2024
dc2da30
feat: function for parsing annotation text
m-kolomanski Dec 18, 2024
8f351ea
feat: implemented working dynamic titles and subtitles with column re…
m-kolomanski Dec 18, 2024
c2858ca
feat: Help widget
m-kolomanski Dec 18, 2024
b9c7d02
refactor: nicer button styling
m-kolomanski Dec 19, 2024
2a7cf65
fix: explicit widget id warning
m-kolomanski Dec 19, 2024
554373a
fix: app crashing when no data is available
m-kolomanski Dec 19, 2024
7e16c7a
fix: geom_logicts warning
m-kolomanski Dec 19, 2024
12a5dc6
fix: labels being an expression instead of a character vector
m-kolomanski Dec 19, 2024
eab6781
fix: log scale in plotly
m-kolomanski Dec 19, 2024
774c36d
fix: spellcheck
m-kolomanski Dec 19, 2024
75dcc76
fix: automatic subtitle overflowing with group variables
m-kolomanski Dec 19, 2024
4417a4c
Merge branch 'main' into enhancement/setup-tlg-plots
m-kolomanski Dec 19, 2024
68e5acc
docs: roxygen update
m-kolomanski Dec 19, 2024
4f025fb
fix: R CMD check, roxygen docs
m-kolomanski Dec 19, 2024
8ae9581
fix: labels getting lost on table mutations
m-kolomanski Dec 20, 2024
4c4d7f3
tests: added unit tests for pkcg01
m-kolomanski Dec 20, 2024
005feb3
fix: automatic tab switching
m-kolomanski Dec 20, 2024
c2f0212
fix: auto changing tabs
m-kolomanski Jan 2, 2025
84ffcca
chore: add loading spinner to the tlg plot output
Gotfrid Jan 8, 2025
ab8e227
refactor: removed fake wait before switching tabs
m-kolomanski Jan 8, 2025
290956f
fix: prevent plots from initially loading twice
m-kolomanski Jan 8, 2025
d1eb925
feat: added btn-page class to buttons in accordance to #157
m-kolomanski Jan 8, 2025
8530694
fix: modules breaking after the order is submitted for a second time
m-kolomanski Jan 8, 2025
31f979e
refactor: moved style to footer
m-kolomanski Jan 8, 2025
a33e87d
style: remove whitespace
m-kolomanski Jan 10, 2025
fec4594
docs: being more direct about keys/ids that the user should provide
m-kolomanski Jan 10, 2025
4b78d4a
refactor: using localized data() object
m-kolomanski Jan 10, 2025
90d34ea
refactor: avoid nesting rendering functions inside observers
m-kolomanski Jan 10, 2025
901049a
refactor: removed redundant isolate()
m-kolomanski Jan 10, 2025
57a67e8
refactor: moved parsing tlg definitions to separate function, added t…
m-kolomanski Jan 10, 2025
b91f87d
fix: axis limits being ignored by plotly
m-kolomanski Jan 13, 2025
846f8b7
fix: handle rendering function error
m-kolomanski Jan 13, 2025
f89cdcb
Merge branch 'main' into enhancement/setup-tlg-plots
m-kolomanski Jan 13, 2025
b957c99
chore: removed deprecated file
m-kolomanski Jan 13, 2025
252876a
deps: added missing dependencies
m-kolomanski Jan 13, 2025
ccbacfe
fix: R CMD check not finding root of the project
m-kolomanski Jan 13, 2025
ac13ab9
chore: removed debug print statement
m-kolomanski Jan 13, 2025
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
64 changes: 64 additions & 0 deletions .github/contributing/adding-tlg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Adding new Tables, Listing and Graphs
In order to add new TLGs, two things are needed:
### TLG definition
Specified in [tlg.yaml](../../inst/shiny/tlg.yaml) file. Entry in that file is responsible for providing some metadata regarding the TLG (like name, descriptions, links), a function reference for creating the resulting TLG and options, taken as arguments by the generating function, that allow for quick and easy definition of widgets to be rendered in the application UI. This then allows the user to customize plots in accordance to their needs.

### `R` function
The code that creates the actual results.

## Listings
Currently not implemented.

## Tables
Currently not implemented

## Graphs
### yaml
The `Graph` entry should have the following format. Identifying keys (wrapped in `<>`) should be provided by the creator and be unique within their scope (indentation level).
```yaml
# unique identifier for given entry
<entry id>:
# true / false whether TLG should be included as default
is_default:
# type of the TLG, in this case must be Graph
type:
# name of the dataset
dataset:
# standarized id of the TLG, e.g. pkcg01
pkid:
# short label to be displayed as tab name
label:
# longer descriptions, to be displayed in the order table
description:
# link to the documentation of the TLG
link:
# name of the function exported by the package, responsible for generating TLG, must return a list of plots to be displayed
fun:
# options that can be passed as arguments to the function
options:
# option id, the same as the argument that is passed to the rendering function, must be unique in the scope of the TLG entry
<option id>:
# type of the option/widget, one of: text, numeric, select
type:
# label to be displayed in the editing widget
label:
# default value to be provided in the field;
# if provided, will overwrite function argument defaults;
# if left empty, function defaults will be applied;
# if type is 'select', '.all' keyword can be applied to select all choices;
default:
# applicable to 'select' type, whether to allow for multiple values to be selected
multiple:
# applicable to 'select' type, choices to pick from the dropdown, either specified outright or using a special keyword:
# - '.colnames' keyword will pull the choices from the data column names
# - '$COLUMN_NAME' keyword will pull choices from values of a specific column
choices:
# will create a label to help visually group related widgets; should be a character string; N should be replaced with an integer to uniquely identify the keyword
.group_label_N:

template:
# You can also specify template definitions. This is a character string with id of another TLG definition. All options will be copied over from template id. Any provided parameters will be a) overwritten if existing in the template or b) added as new.
```

### function
Function should be defined within `aNCA` package and accept at least a `data` argument for providing results to be plotted. Should return a list of plots (might be just one plot).
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,9 @@ Each pull request must be accepted by at least one reviewer before it can be mer
When the change is done, pull request is open and the description is filled, please move your issue from **In Progress** to **Needs review** status, so it can be picked up by a reviewer. From this point it is up to the contributor and the person validating the change to work out any kinks and lead to merging the changes.

#### For reviewers
When reviewing a pull request, please do try to follow the [conventional comments](https://conventionalcomments.org/) guidelines. Ideas and labels described in that convention can be very helpful in getting your thoughts across and facilitate meaningful cooperation. That said, they are not applicable in every circumstance and you are free to do whatever you feel is suitable, as long as it aims to provide valid discussion.
When reviewing a pull request, please do try to follow the [conventional comments](https://conventionalcomments.org/) guidelines. Ideas and labels described in that convention can be very helpful in getting your thoughts across and facilitate meaningful cooperation. That said, they are not applicable in every circumstance and you are free to do whatever you feel is suitable, as long as it aims to provide valid discussion.

# In-depth guides
Here are some useful links with in-depth documentation regarding specific parts of the pacakage and how to utilise in-build tools to extend the capabilities of the application:

- [Adding TLGs](.github/contributing/adding-tlg.md)
8 changes: 8 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,37 @@ Imports:
dplyr,
DT,
forcats,
ggh4x,
ggplot2,
glue,
haven,
htmlwidgets,
logger,
magrittr,
nestcolor,
PKNCA,
plotly,
purrr,
reactable,
reactable.extras,
rio,
rmarkdown,
scales,
shiny,
shinyBS,
shinycssloaders,
shinyFiles,
shinyjqui,
shinyjs,
shinyWidgets,
stats,
stringi,
stringr,
tern,
tidyr,
tools,
utils,
yaml,
zip
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand Down
18 changes: 18 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ export(create_dose)
export(filter_breaks)
export(flexible_violinboxplot)
export(format_data)
export(g_pkconc_ind_lin)
export(g_pkconc_ind_log)
export(general_lineplot)
export(general_meanplot)
export(geometric_mean)
export(get_label)
export(has_label)
export(lambda_slope_plot)
export(parse_annotation)
export(parse_tlg_definitions)
export(pkcg01)
export(pptestcd_dict)
export(reshape_pknca_results)
export(run_app)
Expand All @@ -40,6 +45,7 @@ importFrom(PKNCA,PKNCAdata)
importFrom(PKNCA,PKNCAdose)
importFrom(PKNCA,pk.nca)
importFrom(PKNCA,pknca_units_table)
importFrom(checkmate,assert_numeric)
importFrom(dplyr,across)
importFrom(dplyr,arrange)
importFrom(dplyr,case_when)
Expand All @@ -48,14 +54,17 @@ importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(dplyr,n)
importFrom(dplyr,pull)
importFrom(dplyr,rename)
importFrom(dplyr,rename_with)
importFrom(dplyr,rowwise)
importFrom(dplyr,select)
importFrom(dplyr,slice)
importFrom(dplyr,summarise)
importFrom(dplyr,ungroup)
importFrom(dplyr,where)
importFrom(ggh4x,scale_y_facet)
importFrom(ggplot2,aes)
importFrom(ggplot2,facet_wrap)
importFrom(ggplot2,geom_errorbar)
Expand All @@ -65,6 +74,8 @@ importFrom(ggplot2,ggplot)
importFrom(ggplot2,ggplot_build)
importFrom(ggplot2,ggplot_gtable)
importFrom(ggplot2,labs)
importFrom(ggplot2,scale_x_continuous)
importFrom(glue,glue)
importFrom(grid,convertUnit)
importFrom(htmlwidgets,JS)
importFrom(logger,log_debug)
Expand All @@ -73,10 +84,12 @@ importFrom(logger,log_fatal)
importFrom(logger,log_info)
importFrom(logger,log_trace)
importFrom(logger,log_warn)
importFrom(magrittr,`%>%`)
importFrom(plotly,event_data)
importFrom(plotly,plotlyOutput)
importFrom(plotly,plotly_build)
importFrom(plotly,renderPlotly)
importFrom(purrr,imap)
importFrom(reactable,colDef)
importFrom(reactable,getReactableState)
importFrom(reactable,reactable)
Expand All @@ -87,19 +100,24 @@ importFrom(reactable.extras,dropdown_extra)
importFrom(reactable.extras,text_extra)
importFrom(rio,export_list)
importFrom(rmarkdown,render)
importFrom(scales,breaks_log)
importFrom(scales,label_log)
importFrom(shinyBS,bsModal)
importFrom(shinyFiles,shinyDirChoose)
importFrom(shinyWidgets,dropdown)
importFrom(shinyWidgets,pickerInput)
importFrom(shinyWidgets,switchInput)
importFrom(shinyWidgets,updatePickerInput)
importFrom(shinycssloaders,withSpinner)
importFrom(shinyjqui,orderInput)
importFrom(shinyjqui,updateOrderInput)
importFrom(stats,sd)
importFrom(stringi,stri_rand_strings)
importFrom(tern,g_ipp)
importFrom(tidyr,pivot_longer)
importFrom(tidyr,pivot_wider)
importFrom(tools,file_ext)
importFrom(utils,read.csv)
importFrom(utils,write.csv)
importFrom(yaml,read_yaml)
importFrom(zip,zipr)
Loading
Loading