config_file.Rmd
The configuration YML file provides the wiring instructions for generating the shinyapp R files. Hence, it is important for the app developer to pay attention and understand this file . By default the file is named config.yml
you can change this name to suit to your needs.
The information below describes the config.yml
structure and defaults.
Property and default value | Details |
---|---|
dashboard_template: bs4_dash | At this time on bs4_dash is only supported |
template_file: !expr system.file(“bs4/bs4_standard.mst” , package = “shinyspring”) |
Supports |
code_gen_location: ‘.’ | where will the code be created |
dummy_test.mod_name: dummy_mod dummy_test.weird_param: dummy | Leave this as it is. It is there to overcome a bug |
shinyspring_config : config.yml | Recommendation to keep config.yml . If you change take care to change all defaults downstream in build chain |
preload_dataset: true | At this only only true works. Future support will give option to turn this off |
source_file_onstartup: on_startup.R | names the the file that needs to be sourced before shinyapp launches. If you change take care to change all defaults downstream in build chain |
Shown below is a basic example of loading 3 datasets into the shinyspring environment
all datasets follow the convention of ds.[ds_name].[ds_param]
all datasets need to atleast have the ds_params of a type
and connection
defined.
For type
We currently support csv
, rds
, feather
, parque
, custom
custom
calls the functions you specify. This provides an approach to load any dataset. In example below read_product_map()
will be called at startup time.
ds.product_map.type: custom
ds.product_map.connection: read_product_map()
ds_info (optional) is a neat way of providing meta information for dataset. You can change colnames , change data types for columns , provide readable colnames (pretty names) , validate NA threshholds via ds_info . ds_info as two ds_params
ds_info_type
options can be csv , google and excel. Refer Sample for defining ds_info .
ds_info_url
connection info for CSV(local) , googlesheet(URL https) , excel (local) Sample here [TODO]
Other optional ds_params :
subset
limit the dataset to a subset number of rows. Eg: 1000
pretty_names
provide readable colnames that can be used in UI
ds.mexico.subset: 100
ds.mexico.pretty_names: !expr c("plaintiff" , "type" , "y96", "y97")
Modules are defined with the pattern [module name].[module property]: value
. Structure sample below
custom_mod.mod_name: dummy_mod
custom_mod.ui_function: dummy_mod_ui
custom_mod.server_function: dummy_mod_server
custom_mod.onload_function: dummy_mod_onLoad
custom_mod.param1: param 1
custom_mod.param2: param 2
[module name]
can be tab name in menus (typically) , or any module you want (rare). You can reference the module properties in code by calling mod_registry$params_for_mod(mod_name)
in your code
Modules are two types
Published : Formal package based modules published on github and registered in module registry
. For these modules most of the default properties are already set and as app developer you need to wire the mandatory and maybe the optional params. Refer Mod Registry concepts here
Custom : This is the module you are writing this
Authentication support is based on shinymanager package It is not fully developed. You can try the preview version with the following in configuration file
basic_auth: true