Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeReviewRequest] #6

Open
AlysY opened this issue Aug 28, 2021 · 1 comment
Open

[CodeReviewRequest] #6

AlysY opened this issue Aug 28, 2021 · 1 comment
Labels
Code_Review Request a code review

Comments

@AlysY
Copy link

AlysY commented Aug 28, 2021

Author: AlysY
Repo: https://github.com/menzies-hotspots/AMR-HOTspots
Aim: I have 2 main queries. How could I set up the structure of having multiple scripts to be clearer to other people? I haven't collaborated on scripts before so improving the readibility and logic is important to me. Secondly, if anyone has experience with shiny then how I could simplify the code, for example using modules?
File Info: This repo creates a shiny app here https://anti-microbe-res.shinyapps.io/hotspots/ displaying information regarding antimicrobial resistance in Australia. The shiny code and app are in the app.R file. This file sources 5 other files: 1_functions.R , 2_load_data.R , 3_edit_this.R , 4_aesthetics.R , and 5_shiny_code.R . I usually lump all my code into one file, so this is my first time trying to split it logically.

@AlysY AlysY added the Code_Review Request a code review label Aug 28, 2021
@egouldo
Copy link
Member

egouldo commented Sep 2, 2021

Hey @AlysY, I'll speak to your first query, and leave the shiny question to shiny experts.

I would suggest trying to use the targets package to streamline your pipeline. The core idea is that you modularise your code into functions, and then call these functions within a Yaml file which runs the whole analysis pipeline. The logic can easily be communicated to others in the targets.yml file that specifies and drives the whole pipeline, and there are functions to visualise the workflow for when it starts to get complicated. Here's an example from one of my projects that I'm working on:
image
You can also run the whole pipeline with a single command: tar_make(). It caches the outputs from previous runs and checks to see if your scripts have changed, and therefore only executes the parts that have changed and any dependencies when you go to re-run things. If you work with a lot of big objects, then this caching functionality could be really helpful so you don't have to sit around for hours or days waiting for parts to re-run.

Here's the user manual and some documentation on getting started. It took about half a day for me to get it up and running once I figured out the basics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code_Review Request a code review
Projects
None yet
Development

No branches or pull requests

2 participants