Skip to contents

Loops through each specified module ID or all modules if no ID was specified. For each ID, an attempt will be made to extract any models available.

Usage

FM_fetch_mdl(state, session, ids = NULL)

Arguments

state

Current module state after yaml file has been read

session

Shiny session variable

ids

Vector of ID strings for the modules containing models or NULL for all modules with models available.

Value

list containing the current dataset with the following format:

  • isgood: General logical indicator of successfully.

  • hasmdl: Logical indicating if at least one model was found.

  • modules: List of module checksums.

  • mdl: Result of MM_fetch_mdl, see vignette("making_modules", package = "formods")

  • catalog: Dataframe containing the a tabular catalog of the models found.

    • 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 of timescale information for the system and details of other timescales (list(system="weeks", details = list(days=list(verb="days", conv=86400))))

    • ts_obj_name: The object name that holds the timescale for this model.

    • 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 and a Shiny session variable
# to use this function:
sess_res = UD_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
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → UD:   dest:   file.path("config","report.docx")
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → UD:   dest:   file.path("config","report.pptx")
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → UD:   dest:   file.path("config","report.yaml")
#> → UD: State initialized
#> → UD: module checksum updated:897d952fecbc804999396a96f9df4b20
#> → UD: module isgood: TRUE
session = sess_res$session
state   = sess_res$state
mdl = FM_fetch_mdl(state, session)
mdl$catalog
#> NULL