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: 1e924d8c354e5881cf2db63a1c57051d
#> → MB: module checksum updated:f6c1ff30af12212efb50175ba6cdcc2c
#>  
#>  
#>  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: c4f4c0e5f965b6780527ecaf0bdc6a7b
#> → MB: module checksum updated:bb6c5bd94ce46aaa92a8f7c7d73115c4
#> → 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: 143e2f39cdb719b827868e2073738ed9
#> → MB: module checksum updated:5ce8afe00778e3abb9a192e0bb1ba486
#> → 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: 242afba7ae59c34d2d94f5efe5d4a624
#> → MB: module checksum updated:5b4841c73ccec46970c5be49425d63c0
#> → 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: a26e2d7eb14693a61d0c258527111e32
#> → MB: module checksum updated:6acb2ac77bb1f60a7852deeac479aa86
#> → MB: added element idx: 2
#> → MB: module isgood: TRUE
state = sess_res$state

mdls = MB_fetch_mdl(state)

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