--- title: "Adding new TLGs to the package" description: > Learn how to add a new TLG to the package. output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Adding new TLGs to the package} %\VignetteEngine{knitr::knitr} %\VignetteEncoding{UTF-8} --- This is an in-depth guide on contributing to the package. In order to get started with contributing, please read our [contributing guide](https://pharmaverse.github.io/aNCA/CONTRIBUTING.html) # Adding new Tables, Listing and Graphs In order to add new TLGs, two things are needed: - a TLG definition specified in the [tlg.yaml](https://github.com/pharmaverse/aNCA/blob/main/inst/shiny/tlg.yaml) file - an implementation function that is responsible for generating an entry (table, list, graph). ## TLG definition Specified in [tlg.yaml](https://github.com/pharmaverse/aNCA/blob/main/inst/shiny/tlg.yaml) file. Entry in that file is responsible for providing some metadata regarding the TLG (like name, descriptions, links), a function reference for creating the resulting TLG and options, taken as arguments by the generating function, that allow for quick and easy definition of widgets to be rendered in the application interface. This then allows the user to customize plots in accordance to their needs. ### General format The entry should have the following format. Identifying keys (wrapped in `<>`) should be provided by the creator and be unique within their scope (indentation level). ```yaml # unique identifier for given entry : # true / false whether TLG should be included as default is_default: # type of the TLG, in this case must be Graph type: # name of the dataset dataset: # standarized id of the TLG, e.g. pkcg01 pkid: # short label to be displayed as tab name label: # longer descriptions, to be displayed in the order table description: # link to the documentation of the TLG link: # name of the function exported by the package, responsible for generating TLG, must return a list of plots to be displayed fun: # options that can be passed as arguments to the function, will generate an editing widget on the TLG page options: # see below mor more information on options template: # You can also specify template definitions. This is a character string with id of another TLG definition. All options will be copied over from template id. Any provided parameters will be a) overwritten if existing in the template or b) added as new. ``` ### Options Options should be passable as arguments into the implementation function. Each provided option will generate a widget for the user to provide customized values. This is the main interface to allow the users to customize their reports. Options should be identified by a unique `option_id`, that is the same as the named argument provided to the implementation function. In example, if the implementation function allows to specify `xaxis_label` as an argument, the `option_id` should be the same. There are several types of input widgets that you can specify. #### text Standard shiny `textInput`. ```yaml # option id, the same as the argument that is passed to the rendering function, must be unique in the scope of the TLG entry