I removed year in scripts, slack channel name, zapier zap, and google sheets name so that no need to update these steps (except configuration.R
) for a new year.
https://github.com/Big-Bio/MultiLabLeaderboard
Do the following steps.
- Change date in
configuration.R
. - Do "Run App" to file
server.R
. - Run
deploy_MultiLabLeaderboard.R
.
- Run
initial_setup.R
line-by-line. - Change date in
configuration.R
. - Do "Run App" to file
server.R
. - Run
deploy_MultiLabLeaderboard.R
.
initial_setup.R
- When do
gs4_auth()
, remember to check the perssion "allow ... to edit, delete ...". - No files in
~/.R/gargle/gargle-oauth
. - Package
filesstrings
doesn't matter, as only functionfile.move
uses this pck, and this function actually is useless. - As long as
gs4_has_token()
givesTRUE
, everything about token, permission, google sheets, is fine.
configuration.R
- Remember to check the
default_current_campaign
to be the first quarter, by default "Fall 2021".
server.R
- Something went wrong with pck
rcrossref
, so I needed to update pckcrul
byremotes::install_github("FlukeAndFeather/crul", ref = "enc_detect")
back then (Dec 2021). Also use the most updatedrcrossref
bydevtools::install_github("ropensci/rcrossref")
.
deploy_MultiLabLeaderboard.R
- To see what went wrong, run
rsconnect::showLogs()
.
-
folder
secretsDONOTSHARE
Automatically generated after running
initial_setup.R
. -
folder
rsconnect
Automatically generated after configuring Shiny app like section.
See below for the orignal guideline of deploying the app
This is a paper reading tracker app for multiple labs to compare their average reading
The first version of this leaderboard was written by Harold Pimentel. He blogs about it here!
https://haroldpimentel.wordpress.com/2019/10/02/leaderboard/
and here is the original github repo he made
https://github.com/pimentel/leaderboard
Unfortunately the googlesheets API he used no longer works. So, here I have updated the API and added multi-lab competition capabilities. I have also removed the need to have a paid zapier account. So implementing this should be free.
This current version was updated by Robert Brown (@robpbrown), with help debugging and developing the README by Tommer Schwarz (@tommerschwarz).
Now, let's get to setting it up!
This will work if you are using R 3.4.1, with 3.6.1 we know it does not work and does not through an error. Hopefully this will get fixed with R in the near future since this is a known "feature".
- Clone the repo to your computer
- In the initial_setup.R script 2a) for 'YOURemail' type your gmail that is associated with your google drive that you will be using 2b) for 'labname' create a one-word, no-space, no-special characters lab name (e.g. "SriramLab") in the initial_setup.R. This lab name will also be used for lab competitions. 2c) for 'PIname' type the handle that your PI uses on slack (or the handle of whoever you are trying to beat as a lab) change the working directory to be inside the repo, open the server.R file and set the working directory there as well to be inside the repo. 2d) update the working directory such that it points to inside of the file where the repo files are stored
- Open R and run the "initial_setup.R" script, do it line by line, if for some reason you may have to do it twice -> this script will create a key for Google Sheets, DO NOT SHARE THIS KEY EVER -> this script will also create two new google sheets in your google drive, these serve as databases
- ***If you ran this multiple times, you will have multiple identically named google sheets in your drive, delete them all and do this again so that you only have one set of the two sheets it creates.
- In your lab's slack account, create a new channel called "paper_reading_hook"
- Send the following message to the Slack channel you just created (you can delete this later from the database):
https://doi.org/10.1534/genetics.117.300489 yes a method for detecting polygenic adaptation.
- Get a Zapier account (zapier.com), a free account is fine
- Click the "Make a Zap!" button
- Find and select the Slack app
- Choose Trigger should be set to "New Message Posted to Channel"
- Follow the prompts to choose the appropriate slack account and channel ("paper_reading_hook")
- set Trigger for Bot Messages to no
- at the find data section, push "Test & Continue"
- find and select the data entry that contains the message you posted to the slack channel
- scroll down to the next be block that says "Do this ..." and click on it, Do NOT hit the plus button
- Select Google Sheets
- Select "Create a spreadsheet row"
- Leave the Drive field empty, the default will be your Google Drive
- For Spreadsheet, select DB-Leaderboard that was created with the "initial_setup.R"
- For Worksheet, select "raw_data"
- For "handle(optional)" look to the right side of the field, and there is a lines with plus symbol, hit that and select the "User Name" line, it should have your username in it
- For "Data(optional)", same idea as in 15, but selec the "Ts" field that has a big number in it
- For "Text (optional)", same idea as in 15, select "Raw Text"
- Up at the top, you can name the Zap anything you want, but I will call it "PaperReadingZap"
- Turn on your Zap!!
- Test it out, post new entries to the reading hook and see if they appear in the raw data sheet of the DB-leaderboard, entries are formatted there must be a comment of some time, even if just a "."
- Open the DB-leaderboard google sheet, go to the "raw_data" sheet. Delete the 2nd row that is full of "na"s. Nothing will work if you do not do this at this point. There must be an initializing entry (which you can delete later), but it needs to be a real entry, if you are entering things into slack, there should be entries here.
- Open the server.R script. You should have already updated the working directory and the labname.
- In the top right there is a button that says "Run App" press it. Cross your fingers!
- If it does not run, then... well, have fun debugging
- Open the DB-leaderboard google sheet, and delete the rows that are full of "na"s in the "read" and "read_only_doi" tabs.
- Right now you should have your lab name for lab competitions. If you don't want to setup lab competitions, you can move onto deploying your app now. You can also come back to this step in the future and set up competitions, if you do that, you will just need to redeploy the app once you add competing labs.
- Contact whoever at the lab you want to compete with is hosting the google sheets used for their instance of this reading leaderboard. Ask them to "read-only" share with you their "DB-leaderboard-metrics" google sheet. ****The must input into the share screen your email address that is associated with your google drive! So provide them with the correct email to invite you!
- You will be sent a link to their sheet, from the link, follow the link. Then, identify the sheet ID from the URL. (https://stackoverflow.com/questions/36061433/how-to-do-i-locate-a-google-spreadsheet-id)
- In the secretsDONOTSHARE folder that was made in the repo directory, open the file called "comp_SheetIDs.txt. On a new line (don't leave blank lines, add a one-word, no-space, no-special characters lab name of your choosing for the lab that you will compete with, then put a comma, then put the sheet ID you found from the link they shared. Do not use any spaces when doing this. This file will be read as a CSV file. Save the file.
- Exit Rstudio, then start it again, go to the server.R file, then push Run App again. Hopefully it should work and will add a lab in the competition graphs!
- you will need to re-deploy the app to shinyapps (ignore this if you have not deployed yet).
- follow the directions here to set up an account and link to to Rstudio https://shiny.rstudio.com/articles/shinyapps.html
- comment out the setwd() command in your server.R file
- deploy your app to shinyapps!
- Go tell your PI how cool you are!
- In lab meeting propose a food based reward for achieving some reading metric!
- Reach out to other labs to start competing!