FM_fetch_ds: Fetches Datasets from Modules in the App

View source: R/formods.R

FM_fetch_dsR Documentation

Fetches Datasets from Modules in the App

Description

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 datasets available.

Usage

FM_fetch_ds(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 the datasets or NULL for all datasets available.

Value

list containing the current dataset with the following format:

  • isgood: Boolean indicating the whether a dataset was found (FALSE)

  • ds: List of datasets with element names corresponding to the R object name for that dataset. This has the following format

    • label: Text label for the dataset (used to display to the user)

    • DS: Data frame with the dataset

    • DSMETA: Data frame with metadata about the colunns of the dataset in DS. The data frame should have the following columns:

      • col1: column 1

    • code: Code to generate the dataset.

    • checksum: Module checksum when the dataset was pulled

    • DSchecksum: Checksum of the dataframe in DS

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

    • label: Text label

    • object: Name of the R Object containing the data frame

    • MOD_TYPE: Short name of the type of module

    • id: Module ID

    • checksum: Module checksum

    • DSchecksum: Checksum of the dataset

    • code: Code to generate the dataset

  • modules: List with an entry for each module. The element name is the short name. Each of these is a list with an entry that is the shiny module ID. For each of these there is a checksum. For example to access the checksum of a DW module with a module ID of 'my_id', you would use the following: res$modules$DW$my_id.

Examples

# We need a module state and a Shiny session variable
# to use this function:
id="UD"
sess_res = UD_test_mksession(session=list(), id=id)
session = sess_res$session
state   = sess_res$state
ds = FM_fetch_ds(state, session)
ds$catalog

formods documentation built on May 29, 2024, 4:58 a.m.