Skip to contents

Runs the element code and updates the dataset

Usage

DM_run_code(state, element, session)

Arguments

state

DM state from DM_fetch_state()

element

Element list from DM_fetch_current_element()

session

Shiny session variable

Value

DM element with code updated

DM element with code updated and the `res$run_code` field with the following elements:

  • isgood: Return status of the function.

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

  • ds: Dataset if reading was successful and NULL if not.

Examples

# This creates a testing environment
sess_res = DM_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
#> → DM: including file
#> → DM:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → DM:   dest:   file.path("config","report.docx")
#> → DM: including file
#> → DM:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → DM:   dest:   file.path("config","report.pptx")
#> → DM: including file
#> → DM:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → DM:   dest:   file.path("config","report.yaml")
#> → DM: module checksum updated: 441abbd92e02d893eb5136ccdfcc717d
#> → DM: State initialized
#> → DM: ds checksum updated: 641fcbc6616d24d05acded4317a3bb12
#> → DM: module checksum updated: 5c077c5702479f330bf233040eb4a51b
#> → DM: adding preload sources
#> → DM:  - file added: TEST_DATA.xlsx
#> → DM: added: TEST_DATA.xlsx
#> → DM:  - url added: https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_PC.csv
#> → DM: url added: https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_PC.csv
#> → DM:  - url added: https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_EX.csv
#> → DM: url added: https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_EX.csv
#> → DM:  - url added: https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_DM.csv
#> → DM: url added: https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_DM.csv
#> → DM: loading element idx: 1
#> → DM: ds checksum updated: 90805ca6c41a39696e1572d9b0a75868
#> → DM: module checksum updated: e23d5c825540acc0ebc26cb74c8b151a
#> → DM: added element idx: 1
#> → DM: loading element idx: 2
#> → DM: ds checksum updated: e4d51c5268ef9dab693fefa8f061bab6
#> → DM: module checksum updated: 9e6c1c03763c704545cd95e5077048d2
#> → DM: added element idx: 2
#> → DM: loading element idx: 3
#> → DM: ds checksum updated: 639e0c4bdae520edf5eb02d8968de944
#> → DM: module checksum updated: 144bded65dfc97015fa9c67b35e44652
#> → DM: added element idx: 3
#> → DM: loading element idx: 4
#> → DM: ds checksum updated: 6bb316510764de523b9030d9a5424b0b
#> → DM: module checksum updated: 1741ac39f2f147b60ac85d9d2dbf1d36
#> → DM: added element idx: 4
#> → DM: module isgood: TRUE
#> → # preload_complete is good: TRUE ------------------------------------------
session = sess_res$session
input   = sess_res$input
state   = sess_res$state

# Next we delete all the elements that are currently defined
ele_ids =  names(state[["DM"]][["elements"]])
while(state[["DM"]][["current_element"]] %in% ele_ids){
  state =  suppressMessages(DM_del_current_element(state))
}

# This will delete all the pre-defined sources
sources_df = state[["DM"]][["defined_sources"]]
source_ids = sources_df$ID
for(source_id in source_ids){
  state = suppressMessages(DM_delete_source(state = state, id = source_id))
}

# Adding a file as a resource
DM_add_file(
  state     = state,
  file_name = "TEST_DATA.xlsx",
  file_path = system.file(package="formods", "test_data", "TEST_DATA.xlsx"),
  load_ID   = 10)
#> → DM:  - file added: TEST_DATA.xlsx
#> $yaml
#> $yaml$FM
#> $yaml$FM$include
#> $yaml$FM$include$files
#> $yaml$FM$include$files[[1]]
#> $yaml$FM$include$files[[1]]$file
#> $yaml$FM$include$files[[1]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.docx\")"
#> 
#> $yaml$FM$include$files[[1]]$file$dest
#> [1] "file.path(\"config\",\"report.docx\")"
#> 
#> 
#> 
#> $yaml$FM$include$files[[2]]
#> $yaml$FM$include$files[[2]]$file
#> $yaml$FM$include$files[[2]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.pptx\")"
#> 
#> $yaml$FM$include$files[[2]]$file$dest
#> [1] "file.path(\"config\",\"report.pptx\")"
#> 
#> 
#> 
#> $yaml$FM$include$files[[3]]
#> $yaml$FM$include$files[[3]]$file
#> $yaml$FM$include$files[[3]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.yaml\")"
#> 
#> $yaml$FM$include$files[[3]]$file$dest
#> [1] "file.path(\"config\",\"report.yaml\")"
#> 
#> 
#> 
#> 
#> 
#> $yaml$FM$deployed
#> [1] FALSE
#> 
#> $yaml$FM$code
#> $yaml$FM$code$theme
#> [1] "vibrant_ink"
#> 
#> $yaml$FM$code$showLineNumbers
#> [1] TRUE
#> 
#> $yaml$FM$code$gen_file
#> [1] "run_analysis.R"
#> 
#> $yaml$FM$code$gen_preamble
#> [1] "# formods automated output ------------------------------------------------\n# https://formods.ubiquity.tools/\nrm(list=ls())"
#> 
#> $yaml$FM$code$packages
#> [1] "onbrand" "rio"    
#> 
#> 
#> $yaml$FM$notifications
#> $yaml$FM$notifications$config
#> $yaml$FM$notifications$config$success
#> $yaml$FM$notifications$config$success$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$success$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$success$background
#> [1] "#5bb85b"
#> 
#> 
#> $yaml$FM$notifications$config$failure
#> $yaml$FM$notifications$config$failure$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$failure$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$failure$background
#> [1] "#d9534f"
#> 
#> 
#> $yaml$FM$notifications$config$info
#> $yaml$FM$notifications$config$info$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$info$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$info$background
#> [1] "#5bc0de"
#> 
#> 
#> $yaml$FM$notifications$config$warning
#> $yaml$FM$notifications$config$warning$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$warning$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$warning$background
#> [1] "#f0ac4d"
#> 
#> 
#> 
#> 
#> $yaml$FM$reporting
#> $yaml$FM$reporting$enabled
#> [1] TRUE
#> 
#> $yaml$FM$reporting$content_init
#> $yaml$FM$reporting$content_init$xlsx
#> [1] "rpt = list(summary = NULL,\n           sheets  = list())"
#> 
#> $yaml$FM$reporting$content_init$docx
#> [1] "rpt  = onbrand::read_template(\n  template = file.path(\"config\", \"report.docx\"),\n  mapping  = file.path(\"config\", \"report.yaml\"))"
#> 
#> $yaml$FM$reporting$content_init$pptx
#> [1] "rpt  = onbrand::read_template(\n  template = file.path(\"config\", \"report.pptx\"),\n  mapping  = file.path(\"config\", \"report.yaml\"))"
#> 
#> 
#> $yaml$FM$reporting$phs
#> $yaml$FM$reporting$phs[[1]]
#> $yaml$FM$reporting$phs[[1]]$name
#> [1] "HEADERLEFT"
#> 
#> $yaml$FM$reporting$phs[[1]]$location
#> [1] "header"
#> 
#> $yaml$FM$reporting$phs[[1]]$value
#> [1] ""
#> 
#> $yaml$FM$reporting$phs[[1]]$tooltip
#> [1] "left header text"
#> 
#> 
#> $yaml$FM$reporting$phs[[2]]
#> $yaml$FM$reporting$phs[[2]]$name
#> [1] "HEADERRIGHT"
#> 
#> $yaml$FM$reporting$phs[[2]]$location
#> [1] "header"
#> 
#> $yaml$FM$reporting$phs[[2]]$value
#> [1] ""
#> 
#> $yaml$FM$reporting$phs[[2]]$tooltip
#> [1] "right header text"
#> 
#> 
#> $yaml$FM$reporting$phs[[3]]
#> $yaml$FM$reporting$phs[[3]]$name
#> [1] "FOOTERLEFT"
#> 
#> $yaml$FM$reporting$phs[[3]]$location
#> [1] "footer"
#> 
#> $yaml$FM$reporting$phs[[3]]$value
#> [1] ""
#> 
#> $yaml$FM$reporting$phs[[3]]$tooltip
#> [1] "left footer text"
#> 
#> 
#> 
#> $yaml$FM$reporting$phs_formatting
#> $yaml$FM$reporting$phs_formatting$width
#> [1] "100%"
#> 
#> $yaml$FM$reporting$phs_formatting$tt_position
#> [1] "left"
#> 
#> $yaml$FM$reporting$phs_formatting$tt_size
#> [1] "medium"
#> 
#> 
#> 
#> $yaml$FM$ui
#> $yaml$FM$ui$button_style
#> [1] "fill"
#> 
#> $yaml$FM$ui$select_size
#> [1] 10
#> 
#> $yaml$FM$ui$color_green
#> [1] "#00BB8A"
#> 
#> $yaml$FM$ui$color_red
#> [1] "#FF475E"
#> 
#> $yaml$FM$ui$color_blue
#> [1] "#0088FF"
#> 
#> $yaml$FM$ui$color_purple
#> [1] "#bd2cf4"
#> 
#> $yaml$FM$ui$color_orange
#> [1] "#FEC108"
#> 
#> $yaml$FM$ui$color_yellow
#> [1] "#FFE447"
#> 
#> 
#> $yaml$FM$data_meta
#> $yaml$FM$data_meta$data_header
#> [1] "<span style='color:===COLOR==='><b>===NAME===</b><br/><font size='-3'>===LABEL===</font></span>"
#> 
#> $yaml$FM$data_meta$subtext
#> [1] "===LABEL===: ===RANGE==="
#> 
#> $yaml$FM$data_meta$many_sep
#> [1] ",...,"
#> 
#> $yaml$FM$data_meta$data_types
#> $yaml$FM$data_meta$data_types$character
#> $yaml$FM$data_meta$data_types$character$color
#> [1] "#DD4B39"
#> 
#> $yaml$FM$data_meta$data_types$character$label
#> [1] "text"
#> 
#> 
#> $yaml$FM$data_meta$data_types$double
#> $yaml$FM$data_meta$data_types$double$color
#> [1] "#3C8DBC"
#> 
#> $yaml$FM$data_meta$data_types$double$label
#> [1] "num"
#> 
#> 
#> $yaml$FM$data_meta$data_types$integer
#> $yaml$FM$data_meta$data_types$integer$color
#> [1] "#3C8DBC"
#> 
#> $yaml$FM$data_meta$data_types$integer$label
#> [1] "num"
#> 
#> 
#> $yaml$FM$data_meta$data_types$other
#> $yaml$FM$data_meta$data_types$other$color
#> [1] "black"
#> 
#> $yaml$FM$data_meta$data_types$other$label
#> [1] "other"
#> 
#> 
#> 
#> 
#> $yaml$FM$workflows
#> $yaml$FM$workflows$example
#> $yaml$FM$workflows$example$group
#> [1] "Examples"
#> 
#> $yaml$FM$workflows$example$desc
#> [1] "Example Workflow"
#> 
#> $yaml$FM$workflows$example$require_ds
#> [1] TRUE
#> 
#> $yaml$FM$workflows$example$preload
#> [1] "file.path('.', 'example.yaml')"
#> 
#> 
#> 
#> $yaml$FM$labels
#> $yaml$FM$labels$ui_label
#> [1] "put labels here"
#> 
#> 
#> $yaml$FM$user_files
#> $yaml$FM$user_files$use_tmpdir
#> [1] TRUE
#> 
#> 
#> $yaml$FM$logging
#> $yaml$FM$logging$enabled
#> [1] TRUE
#> 
#> $yaml$FM$logging$timestamp
#> [1] TRUE
#> 
#> $yaml$FM$logging$timestamp_fmt
#> [1] "%Y-%m-%d %H:%M:%S"
#> 
#> $yaml$FM$logging$log_file
#> [1] "formods_log.txt"
#> 
#> $yaml$FM$logging$console
#> [1] TRUE
#> 
#> 
#> 
#> 
#> $MC
#> $MC$module
#> $MC$module$description
#> [1] "Data Managment"
#> 
#> $MC$module$type
#> [1] "DM"
#> 
#> $MC$module$depends
#> $MC$module$depends$id_ASM
#> [1] "ASM"
#> 
#> 
#> 
#> $MC$element_object_name
#> [1] "DM_obj"
#> 
#> $MC$code
#> $MC$code$packages
#> [1] "rio"     "janitor"
#> 
#> $MC$code$readOnly
#> [1] TRUE
#> 
#> $MC$code$mode
#> [1] "r"
#> 
#> 
#> $MC$compact
#> $MC$compact$code
#> [1] TRUE
#> 
#> $MC$compact$clip
#> [1] TRUE
#> 
#> 
#> $MC$reporting
#> $MC$reporting$enabled
#> [1] TRUE
#> 
#> $MC$reporting$priority
#> [1] 1
#> 
#> 
#> $MC$formatting
#> $MC$formatting$clean_ds
#> $MC$formatting$clean_ds$default
#> [1] TRUE
#> 
#> $MC$formatting$clean_ds$tooltip
#> [1] "Clean the data set columns (remove space, special characters, etc) when loading"
#> 
#> $MC$formatting$clean_ds$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$code
#> $MC$formatting$code$width
#> [1] 800
#> 
#> $MC$formatting$code$height
#> [1] 300
#> 
#> 
#> $MC$formatting$current_element
#> $MC$formatting$current_element$width
#> [1] "200px"
#> 
#> $MC$formatting$current_element$tooltip
#> [1] "Highlighted data sets indicate a problem (e.g. the data source not defined, deleted, etc.)"
#> 
#> $MC$formatting$current_element$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$source_id
#> $MC$formatting$source_id$width
#> [1] "200px"
#> 
#> 
#> $MC$formatting$ds_sheet
#> $MC$formatting$ds_sheet$width
#> [1] "200px"
#> 
#> 
#> $MC$formatting$source_url
#> $MC$formatting$source_url$width
#> [1] "200px"
#> 
#> $MC$formatting$source_url$placeholder
#> [1] "https://adomain.com/file.csv"
#> 
#> 
#> $MC$formatting$res_label
#> $MC$formatting$res_label$width
#> [1] "75px"
#> 
#> $MC$formatting$res_label$placeholder
#> [1] "PK"
#> 
#> $MC$formatting$res_label$tooltip
#> [1] "Optional label should be unique and map to expected labels in workflows"
#> 
#> $MC$formatting$res_label$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$res_label_val
#> $MC$formatting$res_label_val$val_good
#> [1] "icon(\"check\", style=\"color: #00BB8A\")"
#> 
#> $MC$formatting$res_label_val$val_bad
#> [1] "icon(\"xmark\", style=\"color: #FF475E\")"
#> 
#> $MC$formatting$res_label_val$tooltip_good
#> [1] "Label is good, no conflicts."
#> 
#> $MC$formatting$res_label_val$tooltip_bad
#> [1] "Label conflcts with the following data sets: ===CONFLICTS==="
#> 
#> $MC$formatting$res_label_val$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$element_name
#> $MC$formatting$element_name$width
#> [1] "200px"
#> 
#> 
#> $MC$formatting$preview
#> $MC$formatting$preview$resources_tab
#> $MC$formatting$preview$resources_tab$label
#> [1] "Resources"
#> 
#> $MC$formatting$preview$resources_tab$icon
#> [1] "server"
#> 
#> 
#> $MC$formatting$preview$ds_tab
#> $MC$formatting$preview$ds_tab$label
#> [1] "Datasets"
#> 
#> $MC$formatting$preview$ds_tab$icon
#> [1] "table"
#> 
#> 
#> $MC$formatting$preview$width
#> [1] 800
#> 
#> $MC$formatting$preview$height
#> [1] 500
#> 
#> 
#> $MC$formatting$input
#> NULL
#> 
#> $MC$formatting$button_clk_run
#> $MC$formatting$button_clk_run$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_run$block
#> [1] TRUE
#> 
#> 
#> $MC$formatting$button_clk_del
#> $MC$formatting$button_clk_del$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_del$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_del$tooltip
#> [1] "Delete the current data source."
#> 
#> $MC$formatting$button_clk_del$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_save
#> $MC$formatting$button_clk_save$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_save$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_save$tooltip
#> [1] "Save the name for the current data source."
#> 
#> $MC$formatting$button_clk_save$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_get_url
#> $MC$formatting$button_clk_get_url$width
#> [1] "200px"
#> 
#> $MC$formatting$button_clk_get_url$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_get_url$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_get_url$tooltip
#> [1] "Fetch the data source in the url."
#> 
#> $MC$formatting$button_clk_get_url$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_clip
#> $MC$formatting$button_clk_clip$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_clip$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_clip$tooltip
#> [1] "Copy the code to generate the current data source to the clipboard."
#> 
#> $MC$formatting$button_clk_clip$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_copy
#> $MC$formatting$button_clk_copy$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_copy$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_copy$tooltip
#> [1] "Make a copy of the current data source."
#> 
#> $MC$formatting$button_clk_copy$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_new
#> $MC$formatting$button_clk_new$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_new$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_new$tooltip
#> [1] "Create a new data source."
#> 
#> $MC$formatting$button_clk_new$tooltip_position
#> [1] "right"
#> 
#> $MC$formatting$button_clk_new$width
#> [1] 100
#> 
#> 
#> $MC$formatting$file_upload
#> $MC$formatting$file_upload$width
#> [1] 600
#> 
#> 
#> $MC$formatting$ot_files
#> $MC$formatting$ot_files$width
#> [1] 250
#> 
#> 
#> 
#> $MC$labels
#> $MC$labels$current_element
#> [1] "Current data source"
#> 
#> $MC$labels$source_id
#> [1] "Select data source"
#> 
#> $MC$labels$ds_sheet
#> [1] "Select sheet"
#> 
#> $MC$labels$source_url
#> [1] "Web address"
#> 
#> $MC$labels$res_label
#> [1] "Label"
#> 
#> $MC$labels$clean_ds
#> [1] "Clean dataset columns"
#> 
#> $MC$labels$element_name
#> NULL
#> 
#> $MC$labels$save_btn
#> [1] "Save"
#> 
#> $MC$labels$get_url_btn
#> [1] "Attach URL"
#> 
#> $MC$labels$clip_btn
#> [1] "Code"
#> 
#> $MC$labels$copy_btn
#> [1] "Copy"
#> 
#> $MC$labels$del_btn
#> [1] "Delete"
#> 
#> $MC$labels$new_btn
#> [1] "New"
#> 
#> $MC$labels$file_upload
#> [1] "Upload file(s)"
#> 
#> $MC$labels$resources_header
#> [1] "tags$h2('Define new resources')"
#> 
#> $MC$labels$dataset_header
#> [1] "tags$h2('Current dataset')"
#> 
#> 
#> $MC$errors
#> $MC$errors$code_gen_failed
#> [1] "Code generation failed"
#> 
#> $MC$errors$run_code_failed
#> [1] "Unable to load dataset"
#> 
#> $MC$errors$add_url_failed
#> [1] "Unable to fetch url"
#> 
#> $MC$errors$add_url_success
#> [1] "URL successfully fetched"
#> 
#> $MC$errors$no_ds
#> [1] "Data source not available"
#> 
#> $MC$errors$no_code
#> [1] "# There are no data sources yet defined"
#> 
#> $MC$errors$no_files
#> [1] "No resources (files uploaded, urls, etc) defined."
#> 
#> $MC$errors$no_files_mkres
#> [1] "To define datasets you must first Upload/create resources."
#> 
#> 
#> $MC$tooltips
#> $MC$tooltips$include
#> [1] TRUE
#> 
#> $MC$tooltips$elements
#> [1] "Show data source components"
#> 
#> $MC$tooltips$show_code
#> [1] "Show data source code"
#> 
#> $MC$tooltips$components
#> $MC$tooltips$components$input_tip
#> [1] "My tool tip"
#> 
#> 
#> 
#> $MC$ui_ids
#> $MC$ui_ids$module
#> [1] "element_selection" "DM_hot_resources"  "source_url"       
#> 
#> $MC$ui_ids$element
#> [1] "element_name" "source_id"    "ds_sheet"     "res_label"    "clean_ds"    
#> 
#> $MC$ui_ids$buttons
#> [1] "button_clk_save"    "button_clk_clip"    "button_clk_del"    
#> [4] "button_clk_copy"    "button_clk_new"     "button_clk_get_url"
#> [7] "button_file_upload"
#> 
#> 
#> 
#> $DM
#> $DM$button_counters
#> $DM$button_counters$button_clk_save
#> [1] 0
#> 
#> $DM$button_counters$button_clk_clip
#> [1] 0
#> 
#> $DM$button_counters$button_clk_del
#> [1] 0
#> 
#> $DM$button_counters$button_clk_copy
#> [1] 0
#> 
#> $DM$button_counters$button_clk_new
#> [1] 0
#> 
#> $DM$button_counters$button_clk_get_url
#> [1] 0
#> 
#> $DM$button_counters$button_file_upload
#> [1] 0
#> 
#> 
#> $DM$ui_hold
#> $DM$ui_hold$button_clk_save
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_clip
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_del
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_copy
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_new
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_get_url
#> [1] TRUE
#> 
#> $DM$ui_hold$button_file_upload
#> [1] TRUE
#> 
#> $DM$ui_hold$element_name
#> [1] TRUE
#> 
#> $DM$ui_hold$source_id
#> [1] TRUE
#> 
#> $DM$ui_hold$ds_sheet
#> [1] TRUE
#> 
#> $DM$ui_hold$res_label
#> [1] TRUE
#> 
#> $DM$ui_hold$clean_ds
#> [1] TRUE
#> 
#> $DM$ui_hold$element_selection
#> [1] TRUE
#> 
#> $DM$ui_hold$DM_hot_resources
#> [1] TRUE
#> 
#> $DM$ui_hold$source_url
#> [1] TRUE
#> 
#> 
#> $DM$ui_ids
#>  [1] "button_clk_save"    "button_clk_clip"    "button_clk_del"    
#>  [4] "button_clk_copy"    "button_clk_new"     "button_clk_get_url"
#>  [7] "button_file_upload" "element_name"       "source_id"         
#> [10] "ds_sheet"           "res_label"          "clean_ds"          
#> [13] "element_selection"  "DM_hot_resources"   "source_url"        
#> 
#> $DM$isgood
#> [1] TRUE
#> 
#> $DM$ui_ele
#> [1] "element_name" "source_id"    "ds_sheet"     "res_label"    "clean_ds"    
#> 
#> $DM$element_cntr
#> [1] 6
#> 
#> $DM$data_dir_full
#> [1] "/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T//RtmpG4soaD/non_shiny/FM/data/DM"
#> 
#> $DM$data_dir_rel
#> [1] "data/DM"
#> 
#> $DM$defined_sources
#>   ID       Resource      file_name
#> 1 10 TEST_DATA.xlsx TEST_DATA.xlsx
#>                                                                                          full_path
#> 1 /var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T//RtmpG4soaD/non_shiny/FM/data/DM/TEST_DATA.xlsx
#>                 rel_path   Size size_num url source_type Delete excel_file
#> 1 data/DM/TEST_DATA.xlsx 1.2 Mb  1227933            file  FALSE       TRUE
#>                           checksum
#> 1 c47b5f1a7bc17978f90644c1d1405794
#> 
#> $DM$resource_cntr
#> [1] 5
#> 
#> $DM$elements
#> $DM$elements$element_6
#> $DM$elements$element_6$isgood
#> [1] FALSE
#> 
#> $DM$elements$element_6$objs
#> $DM$elements$element_6$objs$element_object_name
#> [1] "DM_obj_6"
#> 
#> 
#> $DM$elements$element_6$ui
#> $DM$elements$element_6$ui$element_name
#> [1] "Dataset 6"
#> 
#> $DM$elements$element_6$ui$source_id
#> [1] ""
#> 
#> $DM$elements$element_6$ui$res_label
#> [1] ""
#> 
#> $DM$elements$element_6$ui$clean_ds
#> [1] TRUE
#> 
#> 
#> $DM$elements$element_6$id
#> [1] "element_6"
#> 
#> $DM$elements$element_6$idx
#> [1] 6
#> 
#> $DM$elements$element_6$code_previous
#> [1] ""
#> 
#> $DM$elements$element_6$components_table
#> NULL
#> 
#> $DM$elements$element_6$checksum
#> [1] "2ddabaa6458824ac56b200cd178f779b"
#> 
#> $DM$elements$element_6$code
#> NULL
#> 
#> $DM$elements$element_6$code_ele_only
#> NULL
#> 
#> 
#> 
#> $DM$current_element
#> [1] "element_6"
#> 
#> $DM$checksum
#> [1] "fff3550eeab2bf88e3a88dbb8f5eeb67"
#> 
#> $DM$mod_deps
#> $DM$mod_deps$mod_ids
#> [1] "DM"
#> 
#> $DM$mod_deps$packages
#> NULL
#> 
#> $DM$mod_deps$package_code
#> NULL
#> 
#> 
#> $DM$ui
#> $DM$ui$button_clk_save
#> [1] 0
#> 
#> $DM$ui$button_clk_clip
#> [1] 0
#> 
#> $DM$ui$button_clk_del
#> [1] 0
#> 
#> $DM$ui$button_clk_copy
#> [1] 0
#> 
#> $DM$ui$button_clk_new
#> [1] 0
#> 
#> $DM$ui$button_clk_get_url
#> [1] 0
#> 
#> $DM$ui$button_file_upload
#> [1] 0
#> 
#> $DM$ui$element_name
#> [1] ""
#> 
#> $DM$ui$source_id
#> [1] ""
#> 
#> $DM$ui$ds_sheet
#> [1] ""
#> 
#> $DM$ui$res_label
#> [1] ""
#> 
#> $DM$ui$clean_ds
#> [1] ""
#> 
#> $DM$ui$element_selection
#> [1] "element_5"
#> 
#> $DM$ui$DM_hot_resources
#> [1] ""
#> 
#> $DM$ui$source_url
#> [1] ""
#> 
#> 
#> $DM$ui_old
#> $DM$ui_old$button_clk_save
#> [1] 0
#> 
#> $DM$ui_old$button_clk_clip
#> [1] 0
#> 
#> $DM$ui_old$button_clk_del
#> [1] 0
#> 
#> $DM$ui_old$button_clk_copy
#> [1] 0
#> 
#> $DM$ui_old$button_clk_new
#> [1] 0
#> 
#> $DM$ui_old$button_clk_get_url
#> [1] 0
#> 
#> $DM$ui_old$button_file_upload
#> [1] 0
#> 
#> $DM$ui_old$element_name
#> [1] "STDM DM (url)"
#> 
#> $DM$ui_old$source_id
#> [1] 4
#> 
#> $DM$ui_old$ds_sheet
#> [1] ""
#> 
#> $DM$ui_old$res_label
#> [1] "DM"
#> 
#> $DM$ui_old$clean_ds
#> [1] TRUE
#> 
#> $DM$ui_old$element_selection
#> [1] "element_5"
#> 
#> $DM$ui_old$DM_hot_resources
#> [1] ""
#> 
#> $DM$ui_old$source_url
#> [1] ""
#> 
#> 
#> $DM$res
#> $DM$res$add_file
#> $DM$res$add_file$isgood
#> [1] TRUE
#> 
#> $DM$res$add_file$msgs
#> [1] "added: TEST_DATA.xlsx"
#> 
#> 
#> $DM$res$add_url
#> $DM$res$add_url$isgood
#> [1] TRUE
#> 
#> $DM$res$add_url$msgs
#> [1] "url added: https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_DM.csv"
#> 
#> 
#> $DM$res$del_file
#> $DM$res$del_file$isgood
#> [1] TRUE
#> 
#> $DM$res$del_file$msgs
#> [1] "file:  deleted"
#> 
#> 
#> 
#> 
#> $MOD_TYPE
#> [1] "DM"
#> 
#> $id
#> [1] "DM"
#> 
#> $FM_yaml_file
#> [1] "/private/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T/RtmpDAGmOc/temp_libpath3c052c79679a/formods/templates/formods.yaml"
#> 
#> $MOD_yaml_file
#> [1] "/private/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T/RtmpDAGmOc/temp_libpath3c052c79679a/formods/templates/DM.yaml"
#> 
#> $shiny_token
#> [1] "non_shiny"
#> 


# Because CRAN won't let you have lines longer than 100 chars we have to 
# build the string then pass it to the function below:
tmp_url       = paste0('https://raw.githubusercontent.com/john-harrold', '/', 
                       'formods/refs/heads/master/inst/test_data/SDTM_DM.csv')
# Adding a url as a resource
DM_add_url(
  state     = state,
  url       = tmp_url,
  load_ID   = 11)
#> → DM:  - url added: https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_DM.csv
#> $yaml
#> $yaml$FM
#> $yaml$FM$include
#> $yaml$FM$include$files
#> $yaml$FM$include$files[[1]]
#> $yaml$FM$include$files[[1]]$file
#> $yaml$FM$include$files[[1]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.docx\")"
#> 
#> $yaml$FM$include$files[[1]]$file$dest
#> [1] "file.path(\"config\",\"report.docx\")"
#> 
#> 
#> 
#> $yaml$FM$include$files[[2]]
#> $yaml$FM$include$files[[2]]$file
#> $yaml$FM$include$files[[2]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.pptx\")"
#> 
#> $yaml$FM$include$files[[2]]$file$dest
#> [1] "file.path(\"config\",\"report.pptx\")"
#> 
#> 
#> 
#> $yaml$FM$include$files[[3]]
#> $yaml$FM$include$files[[3]]$file
#> $yaml$FM$include$files[[3]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.yaml\")"
#> 
#> $yaml$FM$include$files[[3]]$file$dest
#> [1] "file.path(\"config\",\"report.yaml\")"
#> 
#> 
#> 
#> 
#> 
#> $yaml$FM$deployed
#> [1] FALSE
#> 
#> $yaml$FM$code
#> $yaml$FM$code$theme
#> [1] "vibrant_ink"
#> 
#> $yaml$FM$code$showLineNumbers
#> [1] TRUE
#> 
#> $yaml$FM$code$gen_file
#> [1] "run_analysis.R"
#> 
#> $yaml$FM$code$gen_preamble
#> [1] "# formods automated output ------------------------------------------------\n# https://formods.ubiquity.tools/\nrm(list=ls())"
#> 
#> $yaml$FM$code$packages
#> [1] "onbrand" "rio"    
#> 
#> 
#> $yaml$FM$notifications
#> $yaml$FM$notifications$config
#> $yaml$FM$notifications$config$success
#> $yaml$FM$notifications$config$success$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$success$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$success$background
#> [1] "#5bb85b"
#> 
#> 
#> $yaml$FM$notifications$config$failure
#> $yaml$FM$notifications$config$failure$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$failure$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$failure$background
#> [1] "#d9534f"
#> 
#> 
#> $yaml$FM$notifications$config$info
#> $yaml$FM$notifications$config$info$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$info$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$info$background
#> [1] "#5bc0de"
#> 
#> 
#> $yaml$FM$notifications$config$warning
#> $yaml$FM$notifications$config$warning$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$warning$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$warning$background
#> [1] "#f0ac4d"
#> 
#> 
#> 
#> 
#> $yaml$FM$reporting
#> $yaml$FM$reporting$enabled
#> [1] TRUE
#> 
#> $yaml$FM$reporting$content_init
#> $yaml$FM$reporting$content_init$xlsx
#> [1] "rpt = list(summary = NULL,\n           sheets  = list())"
#> 
#> $yaml$FM$reporting$content_init$docx
#> [1] "rpt  = onbrand::read_template(\n  template = file.path(\"config\", \"report.docx\"),\n  mapping  = file.path(\"config\", \"report.yaml\"))"
#> 
#> $yaml$FM$reporting$content_init$pptx
#> [1] "rpt  = onbrand::read_template(\n  template = file.path(\"config\", \"report.pptx\"),\n  mapping  = file.path(\"config\", \"report.yaml\"))"
#> 
#> 
#> $yaml$FM$reporting$phs
#> $yaml$FM$reporting$phs[[1]]
#> $yaml$FM$reporting$phs[[1]]$name
#> [1] "HEADERLEFT"
#> 
#> $yaml$FM$reporting$phs[[1]]$location
#> [1] "header"
#> 
#> $yaml$FM$reporting$phs[[1]]$value
#> [1] ""
#> 
#> $yaml$FM$reporting$phs[[1]]$tooltip
#> [1] "left header text"
#> 
#> 
#> $yaml$FM$reporting$phs[[2]]
#> $yaml$FM$reporting$phs[[2]]$name
#> [1] "HEADERRIGHT"
#> 
#> $yaml$FM$reporting$phs[[2]]$location
#> [1] "header"
#> 
#> $yaml$FM$reporting$phs[[2]]$value
#> [1] ""
#> 
#> $yaml$FM$reporting$phs[[2]]$tooltip
#> [1] "right header text"
#> 
#> 
#> $yaml$FM$reporting$phs[[3]]
#> $yaml$FM$reporting$phs[[3]]$name
#> [1] "FOOTERLEFT"
#> 
#> $yaml$FM$reporting$phs[[3]]$location
#> [1] "footer"
#> 
#> $yaml$FM$reporting$phs[[3]]$value
#> [1] ""
#> 
#> $yaml$FM$reporting$phs[[3]]$tooltip
#> [1] "left footer text"
#> 
#> 
#> 
#> $yaml$FM$reporting$phs_formatting
#> $yaml$FM$reporting$phs_formatting$width
#> [1] "100%"
#> 
#> $yaml$FM$reporting$phs_formatting$tt_position
#> [1] "left"
#> 
#> $yaml$FM$reporting$phs_formatting$tt_size
#> [1] "medium"
#> 
#> 
#> 
#> $yaml$FM$ui
#> $yaml$FM$ui$button_style
#> [1] "fill"
#> 
#> $yaml$FM$ui$select_size
#> [1] 10
#> 
#> $yaml$FM$ui$color_green
#> [1] "#00BB8A"
#> 
#> $yaml$FM$ui$color_red
#> [1] "#FF475E"
#> 
#> $yaml$FM$ui$color_blue
#> [1] "#0088FF"
#> 
#> $yaml$FM$ui$color_purple
#> [1] "#bd2cf4"
#> 
#> $yaml$FM$ui$color_orange
#> [1] "#FEC108"
#> 
#> $yaml$FM$ui$color_yellow
#> [1] "#FFE447"
#> 
#> 
#> $yaml$FM$data_meta
#> $yaml$FM$data_meta$data_header
#> [1] "<span style='color:===COLOR==='><b>===NAME===</b><br/><font size='-3'>===LABEL===</font></span>"
#> 
#> $yaml$FM$data_meta$subtext
#> [1] "===LABEL===: ===RANGE==="
#> 
#> $yaml$FM$data_meta$many_sep
#> [1] ",...,"
#> 
#> $yaml$FM$data_meta$data_types
#> $yaml$FM$data_meta$data_types$character
#> $yaml$FM$data_meta$data_types$character$color
#> [1] "#DD4B39"
#> 
#> $yaml$FM$data_meta$data_types$character$label
#> [1] "text"
#> 
#> 
#> $yaml$FM$data_meta$data_types$double
#> $yaml$FM$data_meta$data_types$double$color
#> [1] "#3C8DBC"
#> 
#> $yaml$FM$data_meta$data_types$double$label
#> [1] "num"
#> 
#> 
#> $yaml$FM$data_meta$data_types$integer
#> $yaml$FM$data_meta$data_types$integer$color
#> [1] "#3C8DBC"
#> 
#> $yaml$FM$data_meta$data_types$integer$label
#> [1] "num"
#> 
#> 
#> $yaml$FM$data_meta$data_types$other
#> $yaml$FM$data_meta$data_types$other$color
#> [1] "black"
#> 
#> $yaml$FM$data_meta$data_types$other$label
#> [1] "other"
#> 
#> 
#> 
#> 
#> $yaml$FM$workflows
#> $yaml$FM$workflows$example
#> $yaml$FM$workflows$example$group
#> [1] "Examples"
#> 
#> $yaml$FM$workflows$example$desc
#> [1] "Example Workflow"
#> 
#> $yaml$FM$workflows$example$require_ds
#> [1] TRUE
#> 
#> $yaml$FM$workflows$example$preload
#> [1] "file.path('.', 'example.yaml')"
#> 
#> 
#> 
#> $yaml$FM$labels
#> $yaml$FM$labels$ui_label
#> [1] "put labels here"
#> 
#> 
#> $yaml$FM$user_files
#> $yaml$FM$user_files$use_tmpdir
#> [1] TRUE
#> 
#> 
#> $yaml$FM$logging
#> $yaml$FM$logging$enabled
#> [1] TRUE
#> 
#> $yaml$FM$logging$timestamp
#> [1] TRUE
#> 
#> $yaml$FM$logging$timestamp_fmt
#> [1] "%Y-%m-%d %H:%M:%S"
#> 
#> $yaml$FM$logging$log_file
#> [1] "formods_log.txt"
#> 
#> $yaml$FM$logging$console
#> [1] TRUE
#> 
#> 
#> 
#> 
#> $MC
#> $MC$module
#> $MC$module$description
#> [1] "Data Managment"
#> 
#> $MC$module$type
#> [1] "DM"
#> 
#> $MC$module$depends
#> $MC$module$depends$id_ASM
#> [1] "ASM"
#> 
#> 
#> 
#> $MC$element_object_name
#> [1] "DM_obj"
#> 
#> $MC$code
#> $MC$code$packages
#> [1] "rio"     "janitor"
#> 
#> $MC$code$readOnly
#> [1] TRUE
#> 
#> $MC$code$mode
#> [1] "r"
#> 
#> 
#> $MC$compact
#> $MC$compact$code
#> [1] TRUE
#> 
#> $MC$compact$clip
#> [1] TRUE
#> 
#> 
#> $MC$reporting
#> $MC$reporting$enabled
#> [1] TRUE
#> 
#> $MC$reporting$priority
#> [1] 1
#> 
#> 
#> $MC$formatting
#> $MC$formatting$clean_ds
#> $MC$formatting$clean_ds$default
#> [1] TRUE
#> 
#> $MC$formatting$clean_ds$tooltip
#> [1] "Clean the data set columns (remove space, special characters, etc) when loading"
#> 
#> $MC$formatting$clean_ds$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$code
#> $MC$formatting$code$width
#> [1] 800
#> 
#> $MC$formatting$code$height
#> [1] 300
#> 
#> 
#> $MC$formatting$current_element
#> $MC$formatting$current_element$width
#> [1] "200px"
#> 
#> $MC$formatting$current_element$tooltip
#> [1] "Highlighted data sets indicate a problem (e.g. the data source not defined, deleted, etc.)"
#> 
#> $MC$formatting$current_element$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$source_id
#> $MC$formatting$source_id$width
#> [1] "200px"
#> 
#> 
#> $MC$formatting$ds_sheet
#> $MC$formatting$ds_sheet$width
#> [1] "200px"
#> 
#> 
#> $MC$formatting$source_url
#> $MC$formatting$source_url$width
#> [1] "200px"
#> 
#> $MC$formatting$source_url$placeholder
#> [1] "https://adomain.com/file.csv"
#> 
#> 
#> $MC$formatting$res_label
#> $MC$formatting$res_label$width
#> [1] "75px"
#> 
#> $MC$formatting$res_label$placeholder
#> [1] "PK"
#> 
#> $MC$formatting$res_label$tooltip
#> [1] "Optional label should be unique and map to expected labels in workflows"
#> 
#> $MC$formatting$res_label$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$res_label_val
#> $MC$formatting$res_label_val$val_good
#> [1] "icon(\"check\", style=\"color: #00BB8A\")"
#> 
#> $MC$formatting$res_label_val$val_bad
#> [1] "icon(\"xmark\", style=\"color: #FF475E\")"
#> 
#> $MC$formatting$res_label_val$tooltip_good
#> [1] "Label is good, no conflicts."
#> 
#> $MC$formatting$res_label_val$tooltip_bad
#> [1] "Label conflcts with the following data sets: ===CONFLICTS==="
#> 
#> $MC$formatting$res_label_val$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$element_name
#> $MC$formatting$element_name$width
#> [1] "200px"
#> 
#> 
#> $MC$formatting$preview
#> $MC$formatting$preview$resources_tab
#> $MC$formatting$preview$resources_tab$label
#> [1] "Resources"
#> 
#> $MC$formatting$preview$resources_tab$icon
#> [1] "server"
#> 
#> 
#> $MC$formatting$preview$ds_tab
#> $MC$formatting$preview$ds_tab$label
#> [1] "Datasets"
#> 
#> $MC$formatting$preview$ds_tab$icon
#> [1] "table"
#> 
#> 
#> $MC$formatting$preview$width
#> [1] 800
#> 
#> $MC$formatting$preview$height
#> [1] 500
#> 
#> 
#> $MC$formatting$input
#> NULL
#> 
#> $MC$formatting$button_clk_run
#> $MC$formatting$button_clk_run$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_run$block
#> [1] TRUE
#> 
#> 
#> $MC$formatting$button_clk_del
#> $MC$formatting$button_clk_del$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_del$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_del$tooltip
#> [1] "Delete the current data source."
#> 
#> $MC$formatting$button_clk_del$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_save
#> $MC$formatting$button_clk_save$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_save$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_save$tooltip
#> [1] "Save the name for the current data source."
#> 
#> $MC$formatting$button_clk_save$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_get_url
#> $MC$formatting$button_clk_get_url$width
#> [1] "200px"
#> 
#> $MC$formatting$button_clk_get_url$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_get_url$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_get_url$tooltip
#> [1] "Fetch the data source in the url."
#> 
#> $MC$formatting$button_clk_get_url$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_clip
#> $MC$formatting$button_clk_clip$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_clip$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_clip$tooltip
#> [1] "Copy the code to generate the current data source to the clipboard."
#> 
#> $MC$formatting$button_clk_clip$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_copy
#> $MC$formatting$button_clk_copy$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_copy$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_copy$tooltip
#> [1] "Make a copy of the current data source."
#> 
#> $MC$formatting$button_clk_copy$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_new
#> $MC$formatting$button_clk_new$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_new$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_new$tooltip
#> [1] "Create a new data source."
#> 
#> $MC$formatting$button_clk_new$tooltip_position
#> [1] "right"
#> 
#> $MC$formatting$button_clk_new$width
#> [1] 100
#> 
#> 
#> $MC$formatting$file_upload
#> $MC$formatting$file_upload$width
#> [1] 600
#> 
#> 
#> $MC$formatting$ot_files
#> $MC$formatting$ot_files$width
#> [1] 250
#> 
#> 
#> 
#> $MC$labels
#> $MC$labels$current_element
#> [1] "Current data source"
#> 
#> $MC$labels$source_id
#> [1] "Select data source"
#> 
#> $MC$labels$ds_sheet
#> [1] "Select sheet"
#> 
#> $MC$labels$source_url
#> [1] "Web address"
#> 
#> $MC$labels$res_label
#> [1] "Label"
#> 
#> $MC$labels$clean_ds
#> [1] "Clean dataset columns"
#> 
#> $MC$labels$element_name
#> NULL
#> 
#> $MC$labels$save_btn
#> [1] "Save"
#> 
#> $MC$labels$get_url_btn
#> [1] "Attach URL"
#> 
#> $MC$labels$clip_btn
#> [1] "Code"
#> 
#> $MC$labels$copy_btn
#> [1] "Copy"
#> 
#> $MC$labels$del_btn
#> [1] "Delete"
#> 
#> $MC$labels$new_btn
#> [1] "New"
#> 
#> $MC$labels$file_upload
#> [1] "Upload file(s)"
#> 
#> $MC$labels$resources_header
#> [1] "tags$h2('Define new resources')"
#> 
#> $MC$labels$dataset_header
#> [1] "tags$h2('Current dataset')"
#> 
#> 
#> $MC$errors
#> $MC$errors$code_gen_failed
#> [1] "Code generation failed"
#> 
#> $MC$errors$run_code_failed
#> [1] "Unable to load dataset"
#> 
#> $MC$errors$add_url_failed
#> [1] "Unable to fetch url"
#> 
#> $MC$errors$add_url_success
#> [1] "URL successfully fetched"
#> 
#> $MC$errors$no_ds
#> [1] "Data source not available"
#> 
#> $MC$errors$no_code
#> [1] "# There are no data sources yet defined"
#> 
#> $MC$errors$no_files
#> [1] "No resources (files uploaded, urls, etc) defined."
#> 
#> $MC$errors$no_files_mkres
#> [1] "To define datasets you must first Upload/create resources."
#> 
#> 
#> $MC$tooltips
#> $MC$tooltips$include
#> [1] TRUE
#> 
#> $MC$tooltips$elements
#> [1] "Show data source components"
#> 
#> $MC$tooltips$show_code
#> [1] "Show data source code"
#> 
#> $MC$tooltips$components
#> $MC$tooltips$components$input_tip
#> [1] "My tool tip"
#> 
#> 
#> 
#> $MC$ui_ids
#> $MC$ui_ids$module
#> [1] "element_selection" "DM_hot_resources"  "source_url"       
#> 
#> $MC$ui_ids$element
#> [1] "element_name" "source_id"    "ds_sheet"     "res_label"    "clean_ds"    
#> 
#> $MC$ui_ids$buttons
#> [1] "button_clk_save"    "button_clk_clip"    "button_clk_del"    
#> [4] "button_clk_copy"    "button_clk_new"     "button_clk_get_url"
#> [7] "button_file_upload"
#> 
#> 
#> 
#> $DM
#> $DM$button_counters
#> $DM$button_counters$button_clk_save
#> [1] 0
#> 
#> $DM$button_counters$button_clk_clip
#> [1] 0
#> 
#> $DM$button_counters$button_clk_del
#> [1] 0
#> 
#> $DM$button_counters$button_clk_copy
#> [1] 0
#> 
#> $DM$button_counters$button_clk_new
#> [1] 0
#> 
#> $DM$button_counters$button_clk_get_url
#> [1] 0
#> 
#> $DM$button_counters$button_file_upload
#> [1] 0
#> 
#> 
#> $DM$ui_hold
#> $DM$ui_hold$button_clk_save
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_clip
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_del
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_copy
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_new
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_get_url
#> [1] TRUE
#> 
#> $DM$ui_hold$button_file_upload
#> [1] TRUE
#> 
#> $DM$ui_hold$element_name
#> [1] TRUE
#> 
#> $DM$ui_hold$source_id
#> [1] TRUE
#> 
#> $DM$ui_hold$ds_sheet
#> [1] TRUE
#> 
#> $DM$ui_hold$res_label
#> [1] TRUE
#> 
#> $DM$ui_hold$clean_ds
#> [1] TRUE
#> 
#> $DM$ui_hold$element_selection
#> [1] TRUE
#> 
#> $DM$ui_hold$DM_hot_resources
#> [1] TRUE
#> 
#> $DM$ui_hold$source_url
#> [1] TRUE
#> 
#> 
#> $DM$ui_ids
#>  [1] "button_clk_save"    "button_clk_clip"    "button_clk_del"    
#>  [4] "button_clk_copy"    "button_clk_new"     "button_clk_get_url"
#>  [7] "button_file_upload" "element_name"       "source_id"         
#> [10] "ds_sheet"           "res_label"          "clean_ds"          
#> [13] "element_selection"  "DM_hot_resources"   "source_url"        
#> 
#> $DM$isgood
#> [1] TRUE
#> 
#> $DM$ui_ele
#> [1] "element_name" "source_id"    "ds_sheet"     "res_label"    "clean_ds"    
#> 
#> $DM$element_cntr
#> [1] 6
#> 
#> $DM$data_dir_full
#> [1] "/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T//RtmpG4soaD/non_shiny/FM/data/DM"
#> 
#> $DM$data_dir_rel
#> [1] "data/DM"
#> 
#> $DM$defined_sources
#>   ID
#> 1 11
#>                                                                                              Resource
#> 1 https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_DM.csv
#>                file_name
#> 1 FM_DM_94a6476a0655.csv
#>                                                                             full_path
#> 1 /var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T//RtmpG4soaD/FM_DM_94a6476a0655.csv
#>                                                                              rel_path
#> 1 /var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T//RtmpG4soaD/FM_DM_94a6476a0655.csv
#>      Size size_num
#> 1 11.4 Kb    11681
#>                                                                                                   url
#> 1 https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_DM.csv
#>   source_type Delete excel_file                         checksum
#> 1         url  FALSE      FALSE 7fe631c09b05791f98697027ca7952df
#> 
#> $DM$resource_cntr
#> [1] 5
#> 
#> $DM$elements
#> $DM$elements$element_6
#> $DM$elements$element_6$isgood
#> [1] FALSE
#> 
#> $DM$elements$element_6$objs
#> $DM$elements$element_6$objs$element_object_name
#> [1] "DM_obj_6"
#> 
#> 
#> $DM$elements$element_6$ui
#> $DM$elements$element_6$ui$element_name
#> [1] "Dataset 6"
#> 
#> $DM$elements$element_6$ui$source_id
#> [1] ""
#> 
#> $DM$elements$element_6$ui$res_label
#> [1] ""
#> 
#> $DM$elements$element_6$ui$clean_ds
#> [1] TRUE
#> 
#> 
#> $DM$elements$element_6$id
#> [1] "element_6"
#> 
#> $DM$elements$element_6$idx
#> [1] 6
#> 
#> $DM$elements$element_6$code_previous
#> [1] ""
#> 
#> $DM$elements$element_6$components_table
#> NULL
#> 
#> $DM$elements$element_6$checksum
#> [1] "2ddabaa6458824ac56b200cd178f779b"
#> 
#> $DM$elements$element_6$code
#> NULL
#> 
#> $DM$elements$element_6$code_ele_only
#> NULL
#> 
#> 
#> 
#> $DM$current_element
#> [1] "element_6"
#> 
#> $DM$checksum
#> [1] "fff3550eeab2bf88e3a88dbb8f5eeb67"
#> 
#> $DM$mod_deps
#> $DM$mod_deps$mod_ids
#> [1] "DM"
#> 
#> $DM$mod_deps$packages
#> NULL
#> 
#> $DM$mod_deps$package_code
#> NULL
#> 
#> 
#> $DM$ui
#> $DM$ui$button_clk_save
#> [1] 0
#> 
#> $DM$ui$button_clk_clip
#> [1] 0
#> 
#> $DM$ui$button_clk_del
#> [1] 0
#> 
#> $DM$ui$button_clk_copy
#> [1] 0
#> 
#> $DM$ui$button_clk_new
#> [1] 0
#> 
#> $DM$ui$button_clk_get_url
#> [1] 0
#> 
#> $DM$ui$button_file_upload
#> [1] 0
#> 
#> $DM$ui$element_name
#> [1] ""
#> 
#> $DM$ui$source_id
#> [1] ""
#> 
#> $DM$ui$ds_sheet
#> [1] ""
#> 
#> $DM$ui$res_label
#> [1] ""
#> 
#> $DM$ui$clean_ds
#> [1] ""
#> 
#> $DM$ui$element_selection
#> [1] "element_5"
#> 
#> $DM$ui$DM_hot_resources
#> [1] ""
#> 
#> $DM$ui$source_url
#> [1] ""
#> 
#> 
#> $DM$ui_old
#> $DM$ui_old$button_clk_save
#> [1] 0
#> 
#> $DM$ui_old$button_clk_clip
#> [1] 0
#> 
#> $DM$ui_old$button_clk_del
#> [1] 0
#> 
#> $DM$ui_old$button_clk_copy
#> [1] 0
#> 
#> $DM$ui_old$button_clk_new
#> [1] 0
#> 
#> $DM$ui_old$button_clk_get_url
#> [1] 0
#> 
#> $DM$ui_old$button_file_upload
#> [1] 0
#> 
#> $DM$ui_old$element_name
#> [1] "STDM DM (url)"
#> 
#> $DM$ui_old$source_id
#> [1] 4
#> 
#> $DM$ui_old$ds_sheet
#> [1] ""
#> 
#> $DM$ui_old$res_label
#> [1] "DM"
#> 
#> $DM$ui_old$clean_ds
#> [1] TRUE
#> 
#> $DM$ui_old$element_selection
#> [1] "element_5"
#> 
#> $DM$ui_old$DM_hot_resources
#> [1] ""
#> 
#> $DM$ui_old$source_url
#> [1] ""
#> 
#> 
#> $DM$res
#> $DM$res$add_file
#> $DM$res$add_file$isgood
#> [1] TRUE
#> 
#> $DM$res$add_file$msgs
#> [1] "added: TEST_DATA.xlsx"
#> 
#> 
#> $DM$res$add_url
#> $DM$res$add_url$isgood
#> [1] TRUE
#> 
#> $DM$res$add_url$msgs
#> [1] "url added: https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_DM.csv"
#> 
#> 
#> $DM$res$del_file
#> $DM$res$del_file$isgood
#> [1] TRUE
#> 
#> $DM$res$del_file$msgs
#> [1] "file:  deleted"
#> 
#> 
#> 
#> 
#> $MOD_TYPE
#> [1] "DM"
#> 
#> $id
#> [1] "DM"
#> 
#> $FM_yaml_file
#> [1] "/private/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T/RtmpDAGmOc/temp_libpath3c052c79679a/formods/templates/formods.yaml"
#> 
#> $MOD_yaml_file
#> [1] "/private/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T/RtmpDAGmOc/temp_libpath3c052c79679a/formods/templates/DM.yaml"
#> 
#> $shiny_token
#> [1] "non_shiny"
#> 

# Attaching a file to dataset element:
current_ele  = DM_fetch_current_element(state)
current_ele[["ui"]][["source_id"]] = "10"
current_ele[["ui"]][["ds_sheet"]]  = "DATA"

#This will pull out the source details for an element:
fsres = DM_fetch_source(state=state, element=current_ele)

# Rebuilding the code to attach the file:
current_ele = DM_update_element_code(state = state, element=current_ele, session)
#> → DM: DM_update_element_code()

# Running the attachment code:
current_ele = DM_run_code(state = state, element=current_ele)

# Saving the element:
DM_set_current_element(
  state   = state,
  element = current_ele)
#> → DM: ds checksum updated: 7de2dfcd8a34f52686e5f00c2aa41161
#> → DM: module checksum updated: 9569c2c836464a11a579d288b961626a
#> $yaml
#> $yaml$FM
#> $yaml$FM$include
#> $yaml$FM$include$files
#> $yaml$FM$include$files[[1]]
#> $yaml$FM$include$files[[1]]$file
#> $yaml$FM$include$files[[1]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.docx\")"
#> 
#> $yaml$FM$include$files[[1]]$file$dest
#> [1] "file.path(\"config\",\"report.docx\")"
#> 
#> 
#> 
#> $yaml$FM$include$files[[2]]
#> $yaml$FM$include$files[[2]]$file
#> $yaml$FM$include$files[[2]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.pptx\")"
#> 
#> $yaml$FM$include$files[[2]]$file$dest
#> [1] "file.path(\"config\",\"report.pptx\")"
#> 
#> 
#> 
#> $yaml$FM$include$files[[3]]
#> $yaml$FM$include$files[[3]]$file
#> $yaml$FM$include$files[[3]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.yaml\")"
#> 
#> $yaml$FM$include$files[[3]]$file$dest
#> [1] "file.path(\"config\",\"report.yaml\")"
#> 
#> 
#> 
#> 
#> 
#> $yaml$FM$deployed
#> [1] FALSE
#> 
#> $yaml$FM$code
#> $yaml$FM$code$theme
#> [1] "vibrant_ink"
#> 
#> $yaml$FM$code$showLineNumbers
#> [1] TRUE
#> 
#> $yaml$FM$code$gen_file
#> [1] "run_analysis.R"
#> 
#> $yaml$FM$code$gen_preamble
#> [1] "# formods automated output ------------------------------------------------\n# https://formods.ubiquity.tools/\nrm(list=ls())"
#> 
#> $yaml$FM$code$packages
#> [1] "onbrand" "rio"    
#> 
#> 
#> $yaml$FM$notifications
#> $yaml$FM$notifications$config
#> $yaml$FM$notifications$config$success
#> $yaml$FM$notifications$config$success$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$success$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$success$background
#> [1] "#5bb85b"
#> 
#> 
#> $yaml$FM$notifications$config$failure
#> $yaml$FM$notifications$config$failure$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$failure$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$failure$background
#> [1] "#d9534f"
#> 
#> 
#> $yaml$FM$notifications$config$info
#> $yaml$FM$notifications$config$info$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$info$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$info$background
#> [1] "#5bc0de"
#> 
#> 
#> $yaml$FM$notifications$config$warning
#> $yaml$FM$notifications$config$warning$useFontAwesome
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$warning$useIcon
#> [1] FALSE
#> 
#> $yaml$FM$notifications$config$warning$background
#> [1] "#f0ac4d"
#> 
#> 
#> 
#> 
#> $yaml$FM$reporting
#> $yaml$FM$reporting$enabled
#> [1] TRUE
#> 
#> $yaml$FM$reporting$content_init
#> $yaml$FM$reporting$content_init$xlsx
#> [1] "rpt = list(summary = NULL,\n           sheets  = list())"
#> 
#> $yaml$FM$reporting$content_init$docx
#> [1] "rpt  = onbrand::read_template(\n  template = file.path(\"config\", \"report.docx\"),\n  mapping  = file.path(\"config\", \"report.yaml\"))"
#> 
#> $yaml$FM$reporting$content_init$pptx
#> [1] "rpt  = onbrand::read_template(\n  template = file.path(\"config\", \"report.pptx\"),\n  mapping  = file.path(\"config\", \"report.yaml\"))"
#> 
#> 
#> $yaml$FM$reporting$phs
#> $yaml$FM$reporting$phs[[1]]
#> $yaml$FM$reporting$phs[[1]]$name
#> [1] "HEADERLEFT"
#> 
#> $yaml$FM$reporting$phs[[1]]$location
#> [1] "header"
#> 
#> $yaml$FM$reporting$phs[[1]]$value
#> [1] ""
#> 
#> $yaml$FM$reporting$phs[[1]]$tooltip
#> [1] "left header text"
#> 
#> 
#> $yaml$FM$reporting$phs[[2]]
#> $yaml$FM$reporting$phs[[2]]$name
#> [1] "HEADERRIGHT"
#> 
#> $yaml$FM$reporting$phs[[2]]$location
#> [1] "header"
#> 
#> $yaml$FM$reporting$phs[[2]]$value
#> [1] ""
#> 
#> $yaml$FM$reporting$phs[[2]]$tooltip
#> [1] "right header text"
#> 
#> 
#> $yaml$FM$reporting$phs[[3]]
#> $yaml$FM$reporting$phs[[3]]$name
#> [1] "FOOTERLEFT"
#> 
#> $yaml$FM$reporting$phs[[3]]$location
#> [1] "footer"
#> 
#> $yaml$FM$reporting$phs[[3]]$value
#> [1] ""
#> 
#> $yaml$FM$reporting$phs[[3]]$tooltip
#> [1] "left footer text"
#> 
#> 
#> 
#> $yaml$FM$reporting$phs_formatting
#> $yaml$FM$reporting$phs_formatting$width
#> [1] "100%"
#> 
#> $yaml$FM$reporting$phs_formatting$tt_position
#> [1] "left"
#> 
#> $yaml$FM$reporting$phs_formatting$tt_size
#> [1] "medium"
#> 
#> 
#> 
#> $yaml$FM$ui
#> $yaml$FM$ui$button_style
#> [1] "fill"
#> 
#> $yaml$FM$ui$select_size
#> [1] 10
#> 
#> $yaml$FM$ui$color_green
#> [1] "#00BB8A"
#> 
#> $yaml$FM$ui$color_red
#> [1] "#FF475E"
#> 
#> $yaml$FM$ui$color_blue
#> [1] "#0088FF"
#> 
#> $yaml$FM$ui$color_purple
#> [1] "#bd2cf4"
#> 
#> $yaml$FM$ui$color_orange
#> [1] "#FEC108"
#> 
#> $yaml$FM$ui$color_yellow
#> [1] "#FFE447"
#> 
#> 
#> $yaml$FM$data_meta
#> $yaml$FM$data_meta$data_header
#> [1] "<span style='color:===COLOR==='><b>===NAME===</b><br/><font size='-3'>===LABEL===</font></span>"
#> 
#> $yaml$FM$data_meta$subtext
#> [1] "===LABEL===: ===RANGE==="
#> 
#> $yaml$FM$data_meta$many_sep
#> [1] ",...,"
#> 
#> $yaml$FM$data_meta$data_types
#> $yaml$FM$data_meta$data_types$character
#> $yaml$FM$data_meta$data_types$character$color
#> [1] "#DD4B39"
#> 
#> $yaml$FM$data_meta$data_types$character$label
#> [1] "text"
#> 
#> 
#> $yaml$FM$data_meta$data_types$double
#> $yaml$FM$data_meta$data_types$double$color
#> [1] "#3C8DBC"
#> 
#> $yaml$FM$data_meta$data_types$double$label
#> [1] "num"
#> 
#> 
#> $yaml$FM$data_meta$data_types$integer
#> $yaml$FM$data_meta$data_types$integer$color
#> [1] "#3C8DBC"
#> 
#> $yaml$FM$data_meta$data_types$integer$label
#> [1] "num"
#> 
#> 
#> $yaml$FM$data_meta$data_types$other
#> $yaml$FM$data_meta$data_types$other$color
#> [1] "black"
#> 
#> $yaml$FM$data_meta$data_types$other$label
#> [1] "other"
#> 
#> 
#> 
#> 
#> $yaml$FM$workflows
#> $yaml$FM$workflows$example
#> $yaml$FM$workflows$example$group
#> [1] "Examples"
#> 
#> $yaml$FM$workflows$example$desc
#> [1] "Example Workflow"
#> 
#> $yaml$FM$workflows$example$require_ds
#> [1] TRUE
#> 
#> $yaml$FM$workflows$example$preload
#> [1] "file.path('.', 'example.yaml')"
#> 
#> 
#> 
#> $yaml$FM$labels
#> $yaml$FM$labels$ui_label
#> [1] "put labels here"
#> 
#> 
#> $yaml$FM$user_files
#> $yaml$FM$user_files$use_tmpdir
#> [1] TRUE
#> 
#> 
#> $yaml$FM$logging
#> $yaml$FM$logging$enabled
#> [1] TRUE
#> 
#> $yaml$FM$logging$timestamp
#> [1] TRUE
#> 
#> $yaml$FM$logging$timestamp_fmt
#> [1] "%Y-%m-%d %H:%M:%S"
#> 
#> $yaml$FM$logging$log_file
#> [1] "formods_log.txt"
#> 
#> $yaml$FM$logging$console
#> [1] TRUE
#> 
#> 
#> 
#> 
#> $MC
#> $MC$module
#> $MC$module$description
#> [1] "Data Managment"
#> 
#> $MC$module$type
#> [1] "DM"
#> 
#> $MC$module$depends
#> $MC$module$depends$id_ASM
#> [1] "ASM"
#> 
#> 
#> 
#> $MC$element_object_name
#> [1] "DM_obj"
#> 
#> $MC$code
#> $MC$code$packages
#> [1] "rio"     "janitor"
#> 
#> $MC$code$readOnly
#> [1] TRUE
#> 
#> $MC$code$mode
#> [1] "r"
#> 
#> 
#> $MC$compact
#> $MC$compact$code
#> [1] TRUE
#> 
#> $MC$compact$clip
#> [1] TRUE
#> 
#> 
#> $MC$reporting
#> $MC$reporting$enabled
#> [1] TRUE
#> 
#> $MC$reporting$priority
#> [1] 1
#> 
#> 
#> $MC$formatting
#> $MC$formatting$clean_ds
#> $MC$formatting$clean_ds$default
#> [1] TRUE
#> 
#> $MC$formatting$clean_ds$tooltip
#> [1] "Clean the data set columns (remove space, special characters, etc) when loading"
#> 
#> $MC$formatting$clean_ds$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$code
#> $MC$formatting$code$width
#> [1] 800
#> 
#> $MC$formatting$code$height
#> [1] 300
#> 
#> 
#> $MC$formatting$current_element
#> $MC$formatting$current_element$width
#> [1] "200px"
#> 
#> $MC$formatting$current_element$tooltip
#> [1] "Highlighted data sets indicate a problem (e.g. the data source not defined, deleted, etc.)"
#> 
#> $MC$formatting$current_element$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$source_id
#> $MC$formatting$source_id$width
#> [1] "200px"
#> 
#> 
#> $MC$formatting$ds_sheet
#> $MC$formatting$ds_sheet$width
#> [1] "200px"
#> 
#> 
#> $MC$formatting$source_url
#> $MC$formatting$source_url$width
#> [1] "200px"
#> 
#> $MC$formatting$source_url$placeholder
#> [1] "https://adomain.com/file.csv"
#> 
#> 
#> $MC$formatting$res_label
#> $MC$formatting$res_label$width
#> [1] "75px"
#> 
#> $MC$formatting$res_label$placeholder
#> [1] "PK"
#> 
#> $MC$formatting$res_label$tooltip
#> [1] "Optional label should be unique and map to expected labels in workflows"
#> 
#> $MC$formatting$res_label$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$res_label_val
#> $MC$formatting$res_label_val$val_good
#> [1] "icon(\"check\", style=\"color: #00BB8A\")"
#> 
#> $MC$formatting$res_label_val$val_bad
#> [1] "icon(\"xmark\", style=\"color: #FF475E\")"
#> 
#> $MC$formatting$res_label_val$tooltip_good
#> [1] "Label is good, no conflicts."
#> 
#> $MC$formatting$res_label_val$tooltip_bad
#> [1] "Label conflcts with the following data sets: ===CONFLICTS==="
#> 
#> $MC$formatting$res_label_val$tooltip_position
#> [1] "top"
#> 
#> 
#> $MC$formatting$element_name
#> $MC$formatting$element_name$width
#> [1] "200px"
#> 
#> 
#> $MC$formatting$preview
#> $MC$formatting$preview$resources_tab
#> $MC$formatting$preview$resources_tab$label
#> [1] "Resources"
#> 
#> $MC$formatting$preview$resources_tab$icon
#> [1] "server"
#> 
#> 
#> $MC$formatting$preview$ds_tab
#> $MC$formatting$preview$ds_tab$label
#> [1] "Datasets"
#> 
#> $MC$formatting$preview$ds_tab$icon
#> [1] "table"
#> 
#> 
#> $MC$formatting$preview$width
#> [1] 800
#> 
#> $MC$formatting$preview$height
#> [1] 500
#> 
#> 
#> $MC$formatting$input
#> NULL
#> 
#> $MC$formatting$button_clk_run
#> $MC$formatting$button_clk_run$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_run$block
#> [1] TRUE
#> 
#> 
#> $MC$formatting$button_clk_del
#> $MC$formatting$button_clk_del$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_del$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_del$tooltip
#> [1] "Delete the current data source."
#> 
#> $MC$formatting$button_clk_del$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_save
#> $MC$formatting$button_clk_save$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_save$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_save$tooltip
#> [1] "Save the name for the current data source."
#> 
#> $MC$formatting$button_clk_save$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_get_url
#> $MC$formatting$button_clk_get_url$width
#> [1] "200px"
#> 
#> $MC$formatting$button_clk_get_url$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_get_url$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_get_url$tooltip
#> [1] "Fetch the data source in the url."
#> 
#> $MC$formatting$button_clk_get_url$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_clip
#> $MC$formatting$button_clk_clip$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_clip$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_clip$tooltip
#> [1] "Copy the code to generate the current data source to the clipboard."
#> 
#> $MC$formatting$button_clk_clip$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_copy
#> $MC$formatting$button_clk_copy$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_copy$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_copy$tooltip
#> [1] "Make a copy of the current data source."
#> 
#> $MC$formatting$button_clk_copy$tooltip_position
#> [1] "right"
#> 
#> 
#> $MC$formatting$button_clk_new
#> $MC$formatting$button_clk_new$size
#> [1] "sm"
#> 
#> $MC$formatting$button_clk_new$block
#> [1] TRUE
#> 
#> $MC$formatting$button_clk_new$tooltip
#> [1] "Create a new data source."
#> 
#> $MC$formatting$button_clk_new$tooltip_position
#> [1] "right"
#> 
#> $MC$formatting$button_clk_new$width
#> [1] 100
#> 
#> 
#> $MC$formatting$file_upload
#> $MC$formatting$file_upload$width
#> [1] 600
#> 
#> 
#> $MC$formatting$ot_files
#> $MC$formatting$ot_files$width
#> [1] 250
#> 
#> 
#> 
#> $MC$labels
#> $MC$labels$current_element
#> [1] "Current data source"
#> 
#> $MC$labels$source_id
#> [1] "Select data source"
#> 
#> $MC$labels$ds_sheet
#> [1] "Select sheet"
#> 
#> $MC$labels$source_url
#> [1] "Web address"
#> 
#> $MC$labels$res_label
#> [1] "Label"
#> 
#> $MC$labels$clean_ds
#> [1] "Clean dataset columns"
#> 
#> $MC$labels$element_name
#> NULL
#> 
#> $MC$labels$save_btn
#> [1] "Save"
#> 
#> $MC$labels$get_url_btn
#> [1] "Attach URL"
#> 
#> $MC$labels$clip_btn
#> [1] "Code"
#> 
#> $MC$labels$copy_btn
#> [1] "Copy"
#> 
#> $MC$labels$del_btn
#> [1] "Delete"
#> 
#> $MC$labels$new_btn
#> [1] "New"
#> 
#> $MC$labels$file_upload
#> [1] "Upload file(s)"
#> 
#> $MC$labels$resources_header
#> [1] "tags$h2('Define new resources')"
#> 
#> $MC$labels$dataset_header
#> [1] "tags$h2('Current dataset')"
#> 
#> 
#> $MC$errors
#> $MC$errors$code_gen_failed
#> [1] "Code generation failed"
#> 
#> $MC$errors$run_code_failed
#> [1] "Unable to load dataset"
#> 
#> $MC$errors$add_url_failed
#> [1] "Unable to fetch url"
#> 
#> $MC$errors$add_url_success
#> [1] "URL successfully fetched"
#> 
#> $MC$errors$no_ds
#> [1] "Data source not available"
#> 
#> $MC$errors$no_code
#> [1] "# There are no data sources yet defined"
#> 
#> $MC$errors$no_files
#> [1] "No resources (files uploaded, urls, etc) defined."
#> 
#> $MC$errors$no_files_mkres
#> [1] "To define datasets you must first Upload/create resources."
#> 
#> 
#> $MC$tooltips
#> $MC$tooltips$include
#> [1] TRUE
#> 
#> $MC$tooltips$elements
#> [1] "Show data source components"
#> 
#> $MC$tooltips$show_code
#> [1] "Show data source code"
#> 
#> $MC$tooltips$components
#> $MC$tooltips$components$input_tip
#> [1] "My tool tip"
#> 
#> 
#> 
#> $MC$ui_ids
#> $MC$ui_ids$module
#> [1] "element_selection" "DM_hot_resources"  "source_url"       
#> 
#> $MC$ui_ids$element
#> [1] "element_name" "source_id"    "ds_sheet"     "res_label"    "clean_ds"    
#> 
#> $MC$ui_ids$buttons
#> [1] "button_clk_save"    "button_clk_clip"    "button_clk_del"    
#> [4] "button_clk_copy"    "button_clk_new"     "button_clk_get_url"
#> [7] "button_file_upload"
#> 
#> 
#> 
#> $DM
#> $DM$button_counters
#> $DM$button_counters$button_clk_save
#> [1] 0
#> 
#> $DM$button_counters$button_clk_clip
#> [1] 0
#> 
#> $DM$button_counters$button_clk_del
#> [1] 0
#> 
#> $DM$button_counters$button_clk_copy
#> [1] 0
#> 
#> $DM$button_counters$button_clk_new
#> [1] 0
#> 
#> $DM$button_counters$button_clk_get_url
#> [1] 0
#> 
#> $DM$button_counters$button_file_upload
#> [1] 0
#> 
#> 
#> $DM$ui_hold
#> $DM$ui_hold$button_clk_save
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_clip
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_del
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_copy
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_new
#> [1] TRUE
#> 
#> $DM$ui_hold$button_clk_get_url
#> [1] TRUE
#> 
#> $DM$ui_hold$button_file_upload
#> [1] TRUE
#> 
#> $DM$ui_hold$element_name
#> [1] TRUE
#> 
#> $DM$ui_hold$source_id
#> [1] TRUE
#> 
#> $DM$ui_hold$ds_sheet
#> [1] TRUE
#> 
#> $DM$ui_hold$res_label
#> [1] TRUE
#> 
#> $DM$ui_hold$clean_ds
#> [1] TRUE
#> 
#> $DM$ui_hold$element_selection
#> [1] TRUE
#> 
#> $DM$ui_hold$DM_hot_resources
#> [1] TRUE
#> 
#> $DM$ui_hold$source_url
#> [1] TRUE
#> 
#> 
#> $DM$ui_ids
#>  [1] "button_clk_save"    "button_clk_clip"    "button_clk_del"    
#>  [4] "button_clk_copy"    "button_clk_new"     "button_clk_get_url"
#>  [7] "button_file_upload" "element_name"       "source_id"         
#> [10] "ds_sheet"           "res_label"          "clean_ds"          
#> [13] "element_selection"  "DM_hot_resources"   "source_url"        
#> 
#> $DM$isgood
#> [1] TRUE
#> 
#> $DM$ui_ele
#> [1] "element_name" "source_id"    "ds_sheet"     "res_label"    "clean_ds"    
#> 
#> $DM$element_cntr
#> [1] 6
#> 
#> $DM$data_dir_full
#> [1] "/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T//RtmpG4soaD/non_shiny/FM/data/DM"
#> 
#> $DM$data_dir_rel
#> [1] "data/DM"
#> 
#> $DM$defined_sources
#>  [1] ID          Resource    file_name   full_path   rel_path    Size       
#>  [7] size_num    url         source_type Delete      excel_file  checksum   
#> <0 rows> (or 0-length row.names)
#> 
#> $DM$resource_cntr
#> [1] 5
#> 
#> $DM$elements
#> $DM$elements$element_6
#> $DM$elements$element_6$isgood
#> [1] FALSE
#> 
#> $DM$elements$element_6$objs
#> $DM$elements$element_6$objs$element_object_name
#> [1] "DM_obj_6"
#> 
#> 
#> $DM$elements$element_6$ui
#> $DM$elements$element_6$ui$element_name
#> [1] "Dataset 6"
#> 
#> $DM$elements$element_6$ui$source_id
#> [1] "10"
#> 
#> $DM$elements$element_6$ui$res_label
#> [1] ""
#> 
#> $DM$elements$element_6$ui$clean_ds
#> [1] TRUE
#> 
#> $DM$elements$element_6$ui$ds_sheet
#> [1] "DATA"
#> 
#> 
#> $DM$elements$element_6$id
#> [1] "element_6"
#> 
#> $DM$elements$element_6$idx
#> [1] 6
#> 
#> $DM$elements$element_6$code_previous
#> [1] ""
#> 
#> $DM$elements$element_6$components_table
#> NULL
#> 
#> $DM$elements$element_6$checksum
#> [1] "7de2dfcd8a34f52686e5f00c2aa41161"
#> 
#> $DM$elements$element_6$code
#> [1] ""
#> 
#> $DM$elements$element_6$code_ele_only
#> [1] "library(\"janitor\")\nlibrary(\"rio\")\n"
#> 
#> $DM$elements$element_6$res
#> $DM$elements$element_6$res$code_update
#> $DM$elements$element_6$res$code_update$isgood
#> [1] FALSE
#> 
#> $DM$elements$element_6$res$code_update$msgs
#> [1] "DM_update_element_code()"
#> 
#> 
#> $DM$elements$element_6$res$run_code
#> $DM$elements$element_6$res$run_code$isgood
#> [1] FALSE
#> 
#> $DM$elements$element_6$res$run_code$msgs
#> [1] "message: object 'DM_obj_6' not found"
#> [2] "call:    get"                        
#> [3] "call:    obj_name"                   
#> 
#> 
#> 
#> $DM$elements$element_6$code_run
#> [1] ""
#> 
#> 
#> 
#> $DM$current_element
#> [1] "element_6"
#> 
#> $DM$checksum
#> [1] "9569c2c836464a11a579d288b961626a"
#> 
#> $DM$mod_deps
#> $DM$mod_deps$mod_ids
#> [1] "DM"
#> 
#> $DM$mod_deps$packages
#> NULL
#> 
#> $DM$mod_deps$package_code
#> NULL
#> 
#> 
#> $DM$ui
#> $DM$ui$button_clk_save
#> [1] 0
#> 
#> $DM$ui$button_clk_clip
#> [1] 0
#> 
#> $DM$ui$button_clk_del
#> [1] 0
#> 
#> $DM$ui$button_clk_copy
#> [1] 0
#> 
#> $DM$ui$button_clk_new
#> [1] 0
#> 
#> $DM$ui$button_clk_get_url
#> [1] 0
#> 
#> $DM$ui$button_file_upload
#> [1] 0
#> 
#> $DM$ui$element_name
#> [1] ""
#> 
#> $DM$ui$source_id
#> [1] ""
#> 
#> $DM$ui$ds_sheet
#> [1] ""
#> 
#> $DM$ui$res_label
#> [1] ""
#> 
#> $DM$ui$clean_ds
#> [1] ""
#> 
#> $DM$ui$element_selection
#> [1] "element_5"
#> 
#> $DM$ui$DM_hot_resources
#> [1] ""
#> 
#> $DM$ui$source_url
#> [1] ""
#> 
#> 
#> $DM$ui_old
#> $DM$ui_old$button_clk_save
#> [1] 0
#> 
#> $DM$ui_old$button_clk_clip
#> [1] 0
#> 
#> $DM$ui_old$button_clk_del
#> [1] 0
#> 
#> $DM$ui_old$button_clk_copy
#> [1] 0
#> 
#> $DM$ui_old$button_clk_new
#> [1] 0
#> 
#> $DM$ui_old$button_clk_get_url
#> [1] 0
#> 
#> $DM$ui_old$button_file_upload
#> [1] 0
#> 
#> $DM$ui_old$element_name
#> [1] "STDM DM (url)"
#> 
#> $DM$ui_old$source_id
#> [1] 4
#> 
#> $DM$ui_old$ds_sheet
#> [1] ""
#> 
#> $DM$ui_old$res_label
#> [1] "DM"
#> 
#> $DM$ui_old$clean_ds
#> [1] TRUE
#> 
#> $DM$ui_old$element_selection
#> [1] "element_5"
#> 
#> $DM$ui_old$DM_hot_resources
#> [1] ""
#> 
#> $DM$ui_old$source_url
#> [1] ""
#> 
#> 
#> $DM$res
#> $DM$res$add_file
#> $DM$res$add_file$isgood
#> [1] TRUE
#> 
#> $DM$res$add_file$msgs
#> [1] "added: TEST_DATA.xlsx"
#> 
#> 
#> $DM$res$add_url
#> $DM$res$add_url$isgood
#> [1] TRUE
#> 
#> $DM$res$add_url$msgs
#> [1] "url added: https://raw.githubusercontent.com/john-harrold/formods/refs/heads/master/inst/test_data/SDTM_DM.csv"
#> 
#> 
#> $DM$res$del_file
#> $DM$res$del_file$isgood
#> [1] TRUE
#> 
#> $DM$res$del_file$msgs
#> [1] "file:  deleted"
#> 
#> 
#> 
#> 
#> $MOD_TYPE
#> [1] "DM"
#> 
#> $id
#> [1] "DM"
#> 
#> $FM_yaml_file
#> [1] "/private/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T/RtmpDAGmOc/temp_libpath3c052c79679a/formods/templates/formods.yaml"
#> 
#> $MOD_yaml_file
#> [1] "/private/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T/RtmpDAGmOc/temp_libpath3c052c79679a/formods/templates/DM.yaml"
#> 
#> $shiny_token
#> [1] "non_shiny"
#>