Merges default app options with the changes made in the UI
Usage
CTS_fetch_state(
id,
id_ASM,
id_MB,
input,
session,
FM_yaml_file,
MOD_yaml_file,
react_state
)
Arguments
- id
Shiny module ID
- id_ASM
ID string for the app state management module used to save and load app states
- id_MB
An ID string that corresponds with the ID used to call the MB modules
- input
Shiny input variable
- session
Shiny session variable
- FM_yaml_file
App configuration file with FM as main section.
- MOD_yaml_file
Module configuration file with MC as main section.
- react_state
Variable passed to server to allow reaction outside of module (
NULL
)
Value
list containing the current state of the app including default values from the yaml file as well as any changes made by the user. The list has the following structure:
yaml: Full contents of the supplied yaml file.
MC: Module components of the yaml file.
CTS:
isgood: Boolean object indicating if the file was successfully loaded.
checksum: This is an MD5 sum of the contents element and can be used to detect changes in the state.
MOD_TYPE: Character data containing the type of module
"CTS"
id: Character data containing the module id module in the session variable.
FM_yaml_file: App configuration file with FM as main section.
MOD_yaml_file: Module configuration file with MC as main section.
Examples
# Within shiny both session and input variables will exist,
# this creates examples here for testing purposes:
sess_res = MB_test_mksession(session=list(), full_session=FALSE)
#> → MB: including file
#> → MB: source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → MB: dest: file.path("config","report.docx")
#> → MB: including file
#> → MB: source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → MB: dest: file.path("config","report.pptx")
#> → MB: including file
#> → MB: source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → MB: dest: file.path("config","report.yaml")
#> ! MB: User-defined model: /Users/jmh/projects/ruminate/github/ruminate/docs/reference/user_model.R not found (skipping)
#> ! MB: User-defined model: /Users/jmh/projects/ruminate/github/ruminate/docs/reference/user_model.ctl not found (skipping)
#> → MB: module checksum updated:24933f86b657b9503f22440e8c4d3cac
#> → MB: State initialized
#> ! MB: User-defined model: /Users/jmh/projects/ruminate/github/ruminate/docs/reference/user_model.R not found (skipping)
#> ! MB: User-defined model: /Users/jmh/projects/ruminate/github/ruminate/docs/reference/user_model.ctl not found (skipping)
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> → MB: model checksum updated: cc37b764ee3c117dfce1f1d7bd0e6e12
#> → MB: module checksum updated:2ae8d3386b5fee38596e0104e04bc151
session = sess_res$session
input = sess_res$input
# Configuration files
FM_yaml_file = system.file(package = "formods", "templates", "formods.yaml")
MOD_yaml_file = system.file(package = "ruminate", "templates", "CTS.yaml")
# Creating an empty state object
state = CTS_fetch_state(id = "CTS",
id_ASM = "ASM",
id_MB = "MB",
input = input,
session = session,
FM_yaml_file = FM_yaml_file,
MOD_yaml_file = MOD_yaml_file,
react_state = NULL)
#> → CTS: including file
#> → CTS: source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → CTS: dest: file.path("config","report.docx")
#> → CTS: including file
#> → CTS: source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → CTS: dest: file.path("config","report.pptx")
#> → CTS: including file
#> → CTS: source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → CTS: dest: file.path("config","report.yaml")
#> → CTS: source model change detected
#> → CTS: > covariates reset
#> → CTS: cohort checksum updated: 98890dc17c3d5a8008f5fd879ab1368c
#> → CTS: module checksum updated: 875396d76b918e9df1255e19976d2034
#> → CTS: State initialized