A program written in R to create monthly reports of eResearch Analyst activities for the benefit of reporting to members.
Standard execution:
Rscript era_report.R
The program will run looping over all eRAs and generating a report for each. The reports are created for the previous month of work.
Rscript era_report.R MM YYYY
The program can take arguments for a specific month and year for the specific month you want the report to capture. This ability means that the program can be run retrospective or, e.g., even in a loop of months across a whole year.
You can also give a third argument which is optional, if you want to run the script for just one person. This is how it would look:
Rscript era_report.R MM YYYY era@intersect.org.au
Please read the advice on using your calendar before doing anything else: calendar_advice
For all other variables (e.g., your name, institution, etc), the program goes off an authority file on Intershare. Please make sure you have updated your details there.
If you are going to be the designated "report runner", there's a few things you'll need to do to get set up.
- Clone this repository
- Make sure you have all the required packages, including the correct versions. All dependencies are in
set_up.R - Make sure to go through the authentication process below.
- Finally ensure you have added anyone needing a report to your Google Calendar, so they are visible to you.
- Go to console.developers.google.com and create a Project (top drop-down)
- Go into the project and click on
Enable APIs and Services EnabletheGoogle Calendar API,Gmail API,Google Sheets APIandGoogle Drive APIfor this Project- Back at the dashboard, go to
Credentialsand click onCreate credentialsand selectCreate OAuth client ID - Select
Other. - Fill in the details for
Name. - You'll be presented with the OAuth client id and secret. Just press "OK"
- Go to the credentials just created in the list and click on the download symbol. Download this file to the
era_reportdirectory and make sure its name starts withclient_secret.
You will have to interactively authenticate the program the first time you run it. This effectively just means that you have to press a few buttons in the web browser as it pops up.
To do this, run:
Rscript authing.R
- Navigate to the
R/directory holding the program in the terminal - Then run the standard execution for the
era_report.Rscript.
If you wish to set this up as a cron job, then you can use the run_report.sh script. Running this script will record the time for each runs in log.txt.
2.0 now does this for all eRAs and adds the monthly events to a running datasheet that can be used for MVR quarterly and annual reports. 1.0 was designed to only run for one eRA at a time.
Both 1.0 and 2.0 can be run the same way.
- Getting
Error in httpuv::startServer(use$host, use$port, list(call = listen)) : Failed to create server- this most likely means that you have a zombie port that's open. The Google API relies on talking to port 1410. To kill this zombie port: runsudo lsof -i :1410to see which port is open, then runkill $(lsof -t -i :1410)to kill it.
