Reads in the app state from yaml files.
Value
list with the following elements
isgood: Boolean indicating the exit status of the function.
msgs: Messages to be passed back to the user.
yaml_list: Lists with preload components.
Examples
# \donttest{
sess_res = CTS_test_mksession()
#> → ASM: including file
#> → ASM: source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → ASM: dest: file.path("config","report.docx")
#> → ASM: including file
#> → ASM: source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → ASM: dest: file.path("config","report.pptx")
#> → ASM: including file
#> → ASM: source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → ASM: dest: file.path("config","report.yaml")
#> → ASM: State initialized
#> → ASM: setting word placeholders:
#> → ASM: -> setting docx ph: HEADERLEFT = left header
#> → ASM: -> setting docx ph: HEADERRIGHT = right header
#> → ASM: -> setting docx ph: FOOTERLEFT = left footer
#> → ASM: module isgood: TRUE
#> → 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:f7de2055542d3ff1b085fafc2d30a1f8
#> → MB: State initialized
#> → MB: loading model idx: 1
#>
#>
#> ℹ 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: 8a57a89282760a5837456e37436b5500
#> → MB: module checksum updated:f3ae208d745aa75466752b2da37cefee
#>
#>
#> ℹ 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: 21d55fb9cac5e66f89b4e256b8c97b8e
#> → MB: module checksum updated:13102f8946cb4c45f6b88a58a0752d5e
#> → MB: -> setting name: One compartment model
#> → MB: -> setting time scale: hours
#> → MB: -> setting base from: user
#> → MB: -> setting catalog selection:
#> → MB: -> setting base model id: manual
#> → MB: -> setting base model name: manual
#> → MB: model checksum updated: ded531c34025aa43a2155fe86bdc6bd8
#> → MB: module checksum updated:0d0644a00919bf96cbf7214118ba9245
#> → MB: added element idx: 1
#> → MB: loading model idx: 2
#>
#>
#> ℹ 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: ef43f03ca0ecc23eef128783121b26c9
#> → MB: module checksum updated:7fd7cc53a60f81bf4155e5e464f95a05
#> → MB: -> setting name: PK Biomarker
#> → MB: -> setting time scale: days
#> → MB: -> setting base from: user
#> → MB: -> setting catalog selection:
#> → MB: -> setting base model id: manual
#> → MB: -> setting base model name: manual
#> → MB: model checksum updated: e7192253477fb2cb76acdd9cbd514471
#> → MB: module checksum updated:4515b5761c6ce70d2552537372e3b5b8
#> → MB: added element idx: 2
#> → MB: module isgood: TRUE
#> → 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: 379c50eaa2d6857e372cff3c58f93250
#> → CTS: module checksum updated: 71f63fa526c676a0bc2b5f619013e521
#> → CTS: State initialized
#> → CTS: loading element idx: 1
#> → CTS: setting cohort name: Single dose
#> → CTS: setting model source: MB_obj_1_rx
#> → CTS: setting trial options:
#> → CTS: - nsub: 3
#> → CTS: - visit_times: 0
#> → CTS: - trial_end: 100
#> → CTS: - fpage: 1
#> → CTS: - dvcols: Cc
#> → CTS: - time_scale:
#> → CTS: - tc_dim: d2x4
#> → CTS: - evplot: 1
#> → CTS: - cts_config_atol: 1e-8
#> → CTS: - cts_config_rtol: 1e-6
#> → CTS: - cts_config_sigdig: NULL
#> → CTS: - cts_config_seed: 5446
#> → CTS: - cts_config_nsteps: 5
#> → CTS: - cts_config_preamble:
#> → CTS: cohort checksum updated: bc6fdf09720a3d22efd88da417be3fff
#> → CTS: module checksum updated: f4df2ae0aa8b82dfdacbfefc7ef27c95
#> → CTS: adding rule: first_dose
#> → CTS: add rule success
#> → CTS: rule added
#> → CTS: cohort checksum updated: e3366f0c989a97c3fd5eaa8a9757c0dc
#> → CTS: module checksum updated: 9c882d9c6649f796e4a719778a81911f
#>
#>
#> using C compiler: ‘Apple clang version 16.0.0 (clang-1600.0.26.6)’
#> using SDK: ‘’
#>
#>
#> using C compiler: ‘Apple clang version 16.0.0 (clang-1600.0.26.6)’
#> using SDK: ‘’
#> Warning: multi-subject simulation without without 'omega'
#> → CTS: CTS_simulate_element()
#> → CTS:
#> → CTS: # Setting the random seeds
#> → CTS: set.seed(5446)
#> → CTS: rxode2::rxSetSeed(5446)
#> → CTS:
#> → CTS: # Define the number of subjects to simulate for this cohort
#> → CTS: CTS_obj_1_nsub = 3
#> → CTS:
#> → CTS: # User defined functions used in the simulations
#> → CTS: CTS_obj_1_preamble = ""
#> → CTS:
#> → CTS: # Fetching the system information
#> → CTS: CTS_obj_1_rx_details = fetch_rxinfo(MB_obj_1_rx)
#> → CTS:
#> → CTS: # Defining covariates
#> → CTS: CTS_obj_1_cov = list()
#> → CTS:
#> → CTS: # Generating the subjects
#> → CTS: CTS_obj_1_subs = mk_subjects(object = MB_obj_1_rx,
#> → CTS: nsub = CTS_obj_1_nsub,
#> → CTS: covs = CTS_obj_1_cov)
#> → CTS:
#> → CTS: # Creating rules
#> → CTS: CTS_obj_1_rules = list()
#> → CTS:
#> → CTS: CTS_obj_1_rules[["first_dose"]] =
#> → CTS: list(condition = "time == 0", action = list(type = "dose", state = "central",
#> → CTS: values = "c(1)", times = "c(0)", durations = "c(0)"))
#> → CTS:
#> → CTS: # rxSolve options
#> → CTS: CTS_obj_1_rxopts = list(
#> → CTS: atol = 1e-8,
#> → CTS: rtol = 1e-6,
#> → CTS: sigdig = NULL)
#> → CTS:
#> → CTS: # Output times
#> → CTS: CTS_obj_1_output_times = formods::linspace(0,100,5)
#> → CTS:
#> → CTS: # Running simulation
#> → CTS: CTS_obj_1_simres =
#> → CTS: simulate_rules(object = MB_obj_1_rx,
#> → CTS: subjects = CTS_obj_1_subs[["subjects"]],
#> → CTS: eval_times = c(0),
#> → CTS: output_times = CTS_obj_1_output_times,
#> → CTS: time_scales = MB_obj_1_ts,
#> → CTS: preamble = CTS_obj_1_preamble,
#> → CTS: rules = CTS_obj_1_rules,
#> → CTS: rx_options = CTS_obj_1_rxopts)
#> → CTS:
#> → CTS: # Collecting the simulation and event history values
#> → CTS: CTS_obj_1_sim_tc = CTS_obj_1_simres[["simall"]]
#> → CTS: CTS_obj_1_sim_ev = CTS_obj_1_simres[["ev_history"]]
#> → CTS: message: could not find function "model"
#> → CTS: call: model
#> → CTS: call: object
#> → CTS: call: { depot(0) = 0 }
#> → CTS: simulate failed
#> → CTS: CTS_plot_element()
#> → CTS: # Plotting timecourse
#> → CTS: CTS_obj_1_fgtc =
#> → CTS: plot_sr_tc(sro = CTS_obj_1_simres,
#> → CTS: xcol = "time",
#> → CTS: xlab_str = "Time",
#> → CTS: fncol = 4,
#> → CTS: fnrow = 2,
#> → CTS: dvcols = "Cc",
#> → CTS: fpage = 1)
#> → CTS:
#> → CTS: # Plotting events
#> → CTS: CTS_obj_1_fgev =
#> → CTS: plot_sr_ev(sro = CTS_obj_1_simres,
#> → CTS: xcol = "time",
#> → CTS: xlab_str = "Time",
#> → CTS: fncol = 4,
#> → CTS: fnrow = 2,
#> → CTS: evplot = 1,
#> → CTS: fpage = 1)
#> → CTS: There was a problem with the simulation.
#> → CTS: simulate failed
#> → CTS: cohort checksum updated: 80693b8c4eedb668a42942b7736b1599
#> → CTS: module checksum updated: ec3df1c94a4e10caa78158e420d52be3
#> → CTS: module isgood: FALSE
#> ✖ Failure to preload module ID: CTS
#> ✖ failed to add element idx: 1
#> ✖ simulation failed
#> ✖ message: could not find function "model"
#> ✖ call: model
#> ✖ call: object
#> ✖ call: { depot(0) = 0 }
#> ✖ plot failed
#> ✖ There was a problem with the simulation.
#> → # preload_complete is good: FALSE -----------------------------------------
#> → # failed to add element idx: 1
#> → # simulation failed
#> → # message: could not find function "model"
#> → # call: model
#> → # call: object
#> → # call: { depot(0) = 0 }
#> → # plot failed
#> → # There was a problem with the simulation.
state = sess_res$state
res = CTS_mk_preload(state)
#> → CTS: saving element (1) Single dose
#> → CTS: -> rule dose
#> → CTS: mk_preload isgood: TRUE
# }
