Git Product home page Git Product logo

tidymodules's Introduction

tidymodules

build status lifecycle

The {tidymodules} R package is built on top of shiny module using {R6} to provide a new object-oriented programming (OOP) approach for module development, new module interface using input/output ports and a set of tidy operators for handling cross-module communication.

The main features of tidymodules and its comparison with conventional Shiny modules are presented in the table below.

Features tidymodules Conventional modules
Programming style - {R6} OOP *
- Semantic reference
Functional
Namespace management - automatic/generated
- ID based lookup
- Grouping
- manual management
- must match between ui and server
Module communication - new module input/output port structure
- module ports linked via tidy operators
- automatic network diagram
- parameter passing via module server()
- challenging to manage for complex app
Inheritance - class inheritance
- port inheritance for nested modules
NA
Session management - flexible user session management
- Caching of modules coming soon
NA

* OOP = Object Oriented Programming

Installation

You can install the most recent version of {tidymodules} from GitHub with:

library(devtools)
install_github("Novartis/tidymodules")

Examples

You can quickly launch an example after installing the R package by running the following.

tidymodules::showExamples(4)

Some examples have been deployed on shinyapp.io, such as:

Learning More

Please review the Get Started page for a high level introduction to {tidymodules} and its usage in developing Shiny apps.

If you are interested to develop modules using {tidymodules}, we recommend reading the vignettes under “Articles”.

Code of Conduct

Please note that the {tidymodules} is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Acknowledgment

  • The SCC team members @ NVS for their valuable feedbacks
  • 2019 Summer interns (Marzi, Stephen and Renan) for contributing to testing the framework and implementing the demo example 4 listed above.
  • Eric Nantz for accepting to introduce tidymodules in his e-poster @ rstudio::conf 2020

Licence

Copyright 2020 Novartis AG

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

tidymodules's People

Contributors

divadnojnarg avatar jonas-hag avatar m-l-1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tidymodules's Issues

Unable to install {tidymodules} from the repo

When I run devtools::install_github("Novartis/tidymodules") I get the following error:

WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo Novartis/tidymodules@HEAD
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_BasePlot.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_BasePlot.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_BoxPlot.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_BoxPlot.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_ClosablePanel.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_ClosablePanel.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_ColSelector.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_ColSelector.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_DataFilter.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_DataFilter.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_DatasetSelector.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_DatasetSelector.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_LinePlot.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_LinePlot.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_Panel.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_Panel.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_PlotGenerator.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_PlotGenerator.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_Scatter3DPlot.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_Scatter3DPlot.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/mod_ScatterPlot.R: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\mod_ScatterPlot.R'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/www/ERD.svg: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\www\\ERD.svg'
Novartis-tidymodules-ac434da/inst/shiny/examples/4_communication/www/ports.svg: Can't create '\\\\?\\C:\\Users\\ismai\\AppData\\Local\\Temp\\RtmpAfBT2i\\remotes98746ec21166\\Novartis-tidymodules-ac434da\\inst\\shiny\\examples\\4_communication\\www\\ports.svg'
tar.exe: Error exit delayed from previous errors.

image

Add testthat !!!

To make sure that {tidymodules} is behaving. List of test:

  • basic namespace
  • nested modules
  • port definition
  • inheritance of ports, function....
  • so many things....

Appears incompatible with 64 bit integers

When inputting a dataframe containing an int64 column from data.table's fread() the data gets mangled severely. 16134824562 for example becomes 0.0...0797166251775974 with 313 zeroes after the decimal place. This seems to cause downstream effects like hanging and/or crashing the R session, at least when prototyping in RStudio.

Add-in to facilitate module design/creation

Should have the following fields/features

  • Set class name
  • Inheritance: Allow to pick parent {tidymodules} class from the env
  • Propose methods to overwrite from all the parents. Not all methods should overwritable in TidyModule, find a way to filter those out...
  • Add extra fields like nested module
  • Add new function
  • Button to define and add ports (input/output)
  • Functionality to manage nested mods communication?
  • Any features for the UI? something related to the explode UI function....

Port inheritance with deeply nested modules

What I noticed:

  • If a parent module has 1 child, all its input ports are copied (by default) to the child input ports (unless we specify inherit = FALSE during the nested module initialisation). This is what we expect
  • Now we create a nested module in the child module. In the meantime, we decide to add a new input port to the child module. Then the nested module (grand child) will only inherit from the direct parent and not from the grand parent + the parent

There are a lot of use case where it would be convenient to inherit from multiple layers.

This feature should be included with the ability to choose whether to inherit from the direct parent, the whole chain or maybe a given number of parents (if n is 2, we inherit from the parent and the grand parent)...

Do you have comments @xni7 and @m-l-1 ?

I also might have missed something

Links in readme don't work

In the readme, the link to get started does not work. Also, in the table there are no clickable icons.
It seems that the html pages are now in docs/articles instead of articles.

Object 'rLog' not found

Hi,

I'm trying to get started using tidymodules, and when I do a simple test it fails to initialize.

Here's my code:

tidymodules::add_module("Test")
source("tm_Test.R")
Test$new()

And here's the error:

Error in .subset2(x, "impl")$get(.subset2(x, "ns")(name)) : object 'rLog' not found

I'm running 64-bit R 3.6.1 on Windows.

Any help would be greatly appreciated!

Thanks

Example 4 does not work

I downloaded the folder 4_communication on my pc and run it in local.
The app seems to work but when I click on "add plot" (+ button), the new panel appears but without any plot rendered.
Can you please check if everything is ok?
Also, I noticed that the example code in shinyapps.io is different from the code in this repo.
Thanks for your attention

Giada

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.