# Example of how to run the functions
# Find what the correct id is for the project
ukbAid:::admin_get_project_ids()
# Confirm the username to use
ukbAid:::gh_get_users()
# Then create the project!
ukbAid:::admin_start_approved_project("USER", "PROJECT_ID")Administration
Still in development.
Adding users to the RAP project
- In the UKB AMS go to “Edit application”, then go to the “Add member” form and select the scroll down menu, using either AUH or AU.
- In DNAnexus, go to
Project -> Share project(people icon to top right, add by username or email address). - After adding the users, delete their email from the survey sheet, since we don’t need it.
Adding users to the GitHub repos
- To add someone to the GitHub UKB team, use
gh_add_user_to_team(). - To add a contributor to a project, use the function
gh_add_user_to_repo().
Todo after proposal submission
- Review the created Pull Request, provide any feedback or request clarifications if necessary.
- If changes necessary, main applicant should update the file on their own.
Todo after project acceptance
- See a list of approved projects with
admin_get_project_ids()andgh_get_repos()for projects on GitHub. - Run
admin_start_approved_project(), using the user name and project abbreviation to create the project, add it to the Steno GitHub, set up permissions, and add the user to the repo.
General admin
Google Forms to maintain submission to PR flow
We use Google Forms on a shared ukbiobank-sdca Drive folder for researchers to submit project proposals. When a researcher submits a project proposal, we have an “Apps Script” that takes the submission and creates a Pull Request on the ukbAid repository. There is some maintenance required for this workflow.
- Create a GitHub fine-grained personal access token with the following permissions on the “steno-aarhus” organization for the
ukbAidrepository (note: only someone with admin permissions for the organization can do this). Make sure this token only lasts for 90 days.- Read-only access to: “Contents” and “Metadata” (which is default and required)
- Read and write access to: “Actions”, “Pull requests”, and “Workflows”
- Copy the generated token and go into Google Drive. Open the
project-proposal-registrationGoogle Sheet (not the Form) and go to “Extensions -> Apps Script”. In this new page, on the line that saysvar gh_token, replace the string that starts withgithub_pat_with the token you just generated and copied. You may need to click “Run” to trigger the authorisation flow, but usually you don’t need to.
You only need to do this flow whenever the token expires.
On GitHub or own computer
Need to set a SURVEY_ID variable for the Google Forms Sheet ID (the unique string that comes after the /spreadsheets/d/ in the URL). This needs to be set on GitHub as well as on your own computer if you are going to download the survey data. This variable is used to download the project proposal registration data, and you only need it (locally) if you want to download the data to check something.
- On GitHub, add a secret in Settings called
SURVEY_IDwith the Google Sheet ID. - On your computer, you can either add a new variable in the form of
SURVEY_ID=""in a.Renvironfile or always get asked for it whenever you run the functions that require the variable (which uses theukbAid:::get_survey_id()function that requires the ID).
Uploading protocol or pre-print to Zenodo
For protocols or pre-prints, the code to use would be:
# Or "pre-print"/"paper" if you want to upload a pre-print instead of a
# protocol.
pdf_path <- here::here("path/to/protocol.pdf")
qmd_path <- here::here("path/to/protocol.qmd")
client <- zen_create_file_record(
path = pdf_path,
# NOTE: This metadatat function isn't fully working, so you'll
# have to manually fill in the metadata on the Zenodo upload page
# before publishing.
metadata = zen_create_protocol_metadata(qmd_path),
token = zen_get_token(),
# Test it in the sandbox first
sandbox = TRUE
)Always test it in the sandbox first, which you can check that it uploads by going to the Zenodo sandbox.
You can generate a token for either the sandbox or the main Zenodo site by clicking your profile menu on the top right and then clicking “Applications”. Inside of the new page, there is a section to create a new “Personal access token”. Create one for both the sandbox and the main site. Whenever you run the code (or similar) above, the zen_get_token() function will ask you which token you want to use, as well as a text box to paste the token in.
Uploading the repository to Zenodo
The process for uploading a repository to Zenodo is currently a bit more manual. You need to connect your GitHub account to Zenodo, which you can do by going to the GitHub section of your Zenodo account. You may have to click “Sync now” to see the repository (which only organisation admins will have access to) and refresh the page. Scroll down to find the repository you want to upload and click the switch to enable it.
Now, you need to create a release from GitHub. Go to the GitHub repository you want to upload the code to Zenodo for and follow these steps:
- Convert the repository to be public, not private.
- Create a
.zenodo.jsonfile in the root of the repository. Use the legliv repository as an example. This file is required for Zenodo to correctly create a record for the repository. - Click the “Tags” button in the “Code” tab (should be near the top, beside the “branches” button).
- Click the “Create a new release” button and follow the instructions there by filling in the tag version, title, and description.
- Click “Publish release” on the bottom of the page.
You’ve now created a Zenodo record with a DOI! You can check it by going back to Zenodo and looking at your Dashboard. You’ll want to copy that DOI and add it to the ukbAid repository for the project (in data-raw/projects/approved/). Then move the project file from approved/ into completed/. That’s it!