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: a543101a70f40a8eff0529d82698c1bc
#> → MB: module checksum updated:63fff7897ef4a799a577bb192819b838
#>  
#>  
#>  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: bc6d6388344f93e2ef182158365cfa2c
#> → MB: module checksum updated:7a9f6d44cd01df537f00069843458a02
#> → 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: 5bff10708c5ea5af163998802097985f
#> → MB: module checksum updated:b663b8449f51cc38f968a47bcdbaedc8
#> → 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: f8056874dafab1591f98ac775c8085ac
#> → MB: module checksum updated:dd7239ae6fd7e5e0c9ff73aeb799f2f9
#> → 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: c6410535ff7e6fdfce110e4dbd5c602c
#> → MB: module checksum updated:10a54f7598b03eb185f1bd9443d64633
#> → 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"