3

I ask for any advice how to do documentaion / auto-documentation for larger shiny applications.

R packages have roxygen2, but are there any equivalents of auto-documentation for shiny server and ui code?

I'm working on a developing project of +15k lines of code and we push as much as possible to packages with roxygen2 docs, however all of the observes and reacts in central server script and its subscripts are not auto-documented. I also use git of course.

I have tried to tag every observe, reactive, module etc in source code with a unique ID and draw a diagram manually with corresponding IDs. The diagram describe what type of sub-element and topic. Later I would add all triggers etc. This process is very manual though. Maybe I could use "the reactive log" https://shiny.rstudio.com/articles/debugging.html to autogenerate such documentation?

enter image description here

...update 1: I have tried ShinyTester which reads through source code and try to predict a network of sub-element interactions. It did not handle sourcing of external files, but with a little debug I manage to get the below diagram. Unfortunately, only 5% of elements and interactions were discovered hereby. Maybe ShinyTester could need some contributions. : enter image description here

Soren Havelund Welling
  • 1,823
  • 1
  • 16
  • 23
  • 1
    Personally I think an app with 15k lines is too large, you should try to break it into smaller apps, there are too many points of failure. – Pork Chop Nov 19 '18 at 12:15
  • I guess the alternative would be another frame work. We are very ambitious with the result and it is doing something comprehensive and works really well so far. We cannot make the server code much smaller than 1800 lines and it does contain ~50 sub elements. All other code +12000 is CSS, R, Cpp functions in 3 R packages within project. Also some javascript code here and there. Two of the packages have been pushed to github, forks: https://github.com/sorhawell/familyR, https://github.com/sorhawell/ShinyTreeMenu We have also worked with splitting into shiny modules. – Soren Havelund Welling Nov 19 '18 at 12:30
  • the sub-elements (oberves, updates etc.) behavior is very neatly designed so not much unpredicted behaviour and debugging is fine, however I just need to document it accurately for those maintainers to join the project later – Soren Havelund Welling Nov 19 '18 at 12:33

0 Answers0