Skip to contents

Fetches the models contained in the module.

Usage

MB_fetch_mdl(state)

Arguments

state

MB state from MB_fetch_state()

Value

list containing the following elements

  • isgood: Return status of the function.

  • hasmdl: Boolean indicator if the module has any models

  • msgs: Messages to be passed back to the user.

  • mdl: List with models. Each list element has the name of the R-object for that dataset. Each element has the following structure:

    • label: Text label for the model (e.g. one-compartment model).

    • MOD_TYPE: Type of module.

    • id: Module ID.

    • rx_obj: The rxode2 object.

    • rx_obj_name: The rxode2 object name that holds the model.

    • ts_obj List with elements system and details

    • ts_obj_name: The object name that holds the model time scale information.

    • fcn_def: Text to define the model

    • MDLMETA: Notes about the model.

    • code: Code to generate the model.

    • checksum: Module checksum.

    • MDLchecksum: Model checksum.

Examples

# We need a module state:
sess_res = MB_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: da8cab4fa1a04c8b3a1aefb4fd043058
#> → MB: module checksum updated:9ed7e30de632da9867993e99d8ed5afe
#>  
#>  
#>  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: ee9e0e07c9a1d804142a1be31582caf4
#> → MB: module checksum updated:e5b33b35c446df06a1bf09816d82bdc1
#> → 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: 86b89fb2c07767a78b063d379486f1d5
#> → MB: module checksum updated:ad2f9317d834acd9ac45f5dbfb8e531a
#> → 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: 9deaf67974af4491fd54b8f298aa859b
#> → MB: module checksum updated:ba0df32ee19c4212d1ae176b05803b1f
#> → 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: b83b755c7351b7a04f65a54c23120f9d
#> → MB: module checksum updated:22225e59b9337e7af80109e4fb7fc01c
#> → MB: added element idx: 2
#> → MB: module isgood: TRUE
#> → # preload_complete is good: TRUE ------------------------------------------
state = sess_res$state

mdls = MB_fetch_mdl(state)

names(mdls)
#> [1] "hasmdl"     "isgood"     "ts_details" "msgs"       "mdl"