Skip to content

Commit

Permalink
Merge pull request #293 from Sage-Bionetworks/develop
Browse files Browse the repository at this point in the history
Prepare 1st release of DCA (general template)
  • Loading branch information
rrchai authored Mar 29, 2022
2 parents ce9b754 + 4802eba commit 6df0b15
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 208 deletions.
41 changes: 0 additions & 41 deletions .github/schematic_config.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/set_gh_secrets.R

This file was deleted.

38 changes: 18 additions & 20 deletions .github/workflows/shinyapps_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@ name: shiny-deploy
on:
push:
branches:
- shiny-server-main
- shiny-server-develop # add develop for testing for now
- release*
- main
- develop
tags:
- v*.*.*
paths-ignore:
- .github/ISSUE_TEMPLATE/**
- '.github/ISSUE_TEMPLATE/**'
- '**/*.md'
- '**/.gitignore'

jobs:
shiny-deploy:
runs-on: ubuntu-latest
# This image seems to be based on rocker/r-ver which in turn is based on debian
container: rocker/rstudio
container: rocker/rstudio:4.1.2
env:
# This should not be necessary for installing from public repo's however remotes::install_github() fails without it.
GITHUB_PAT: ${{ secrets.REPO_PAT }}
Expand All @@ -44,15 +47,10 @@ jobs:
run: |
R -f install-pkgs.R
- name: Install Python Packages Dependencies
shell: bash
run: |
source .venv/bin/activate
pip3 install -r requirements.txt
- name: Install Schematic
shell: bash
run: |
# has to activate each bash step
source .venv/bin/activate
# use 'poetry' to install schematic from the develop branch
pip3 install poetry
Expand All @@ -67,19 +65,17 @@ jobs:
source .venv/bin/activate
# download data model to the correct location
R -e '
config <- yaml::yaml.load_file(".github/schematic_config.yml");
config <- yaml::yaml.load_file("schematic_config.yml");
url <- config$model$input$download_url;
path <- config$model$input$location;
system(sprintf("mkdir -p %s", dirname(path)));
system(sprintf("wget %s -O %s", url, path));
'
# overwrite the config.yml in schematic
mv -f .github/schematic_config.yml schematic/config.yml
# write out configuration files using github secrets
echo "${{ secrets.SCHEMATIC_SYNAPSE_CONFIG }}" > schematic/.synapseConfig
echo "${{ secrets.SCHEMATIC_SERVICE_ACCT_CREDS }}" > schematic/schematic_service_account_creds.json
echo "${{ secrets.SCHEMATIC_CREDS_PATH }}" > schematic/credentials.json
echo "${{ secrets.SCHEMATIC_TOKEN_PICKLE }}" | base64 -d > schematic/token.pickle
echo "${{ secrets.SCHEMATIC_SYNAPSE_CONFIG }}" > .synapseConfig
echo "${{ secrets.SCHEMATIC_SERVICE_ACCT_CREDS }}" > schematic_service_account_creds.json
echo "${{ secrets.SCHEMATIC_CREDS_PATH }}" > credentials.json
echo "${{ secrets.SCHEMATIC_TOKEN_PICKLE }}" | base64 -d > token.pickle
- name: zip virtual env
shell: bash
Expand All @@ -92,10 +88,12 @@ jobs:
- name: Authorize and deploy app
shell: Rscript {0}
run: |
branch <- Sys.getenv("GITHUB_REF_NAME")
# if there is a tag, 'refName' will be tag name
refName <- Sys.getenv("GITHUB_REF_NAME")
repo <- Sys.getenv("GITHUB_REPOSITORY")
appName <- strsplit(repo, "/")[[1]][2]
if (!startsWith(branch, "release")) {
# if tag is v*.*.*, deploy to prod, otherwise to staging
if (!grepl("v[0-9]+.[0-9]+.[0-9]+", refName)) {
appName <- paste(appName, "staging", sep = "-")
}
rsConnectUser <- "${{ secrets.RSCONNECT_USER }}"
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ schematic/
**/token.pickle
**/__pycache__
oauth_config.yml
schematic_config.yml
.project
.settings/**
.venv
data-models/
data-models/
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Follow the steps below to make sure the _Data Curator App_ is fully setup to wor

### Data Curator App Setup

1. Clone this repo (front-end) with one single branch (i.e., _shiny-server-main_):
1. Clone this repo (front-end) with one single branch (i.e., _main_):

git clone --single-branch --branch shiny-server-main https://github.com/Sage-Bionetworks/data_curator.git
git clone --single-branch --branch main https://github.com/Sage-Bionetworks/data_curator.git

2. Create and modify the configuration file ([How to obtain OAuth Credential](https://github.com/Sage-Bionetworks/data_curator#Authentication)):

Expand All @@ -26,11 +26,7 @@ Follow the steps below to make sure the _Data Curator App_ is fully setup to wor
python -m venv .venv
source .venv/bin/activate

4. Install required Python pacakges dependencies:

pip install -r requirements.txt

5. Install required R pacakges dependencies:
4. Install required R pacakges dependencies:

R -f install-pkgs.R

Expand All @@ -50,7 +46,7 @@ Follow the steps below to make sure the _Data Curator App_ is fully setup to wor
poetry build
pip install dist/schematicpy-1.0.0-py3-none-any.whl

3. Set up the `schematic` configuration. To do so, follow the instructions on the [schematic's documentation](https://sage-schematic.readthedocs.io/en/develop/index.html#package-installation-and-setup)
3. Modify the `schematic_config.yml` to set up schematic configuration. To do so, follow the instructions on the [schematic's documentation](https://sage-schematic.readthedocs.io/en/develop/index.html#package-installation-and-setup)

### Data Model Configuration

Expand All @@ -60,8 +56,9 @@ Use the app configuration file `www/config.json` to adapt this app to your DCC.
- `display_name` : The display name for the dropdown. (e.g. _scRNA-seq Level 1_)
- `schema_name`: The name of the manifest in the JSON-LD schema (e.g. _ScRNA-seqLevel1_)
- `type`: The type of manifest. As currently configured in `app.R`, will only display manifests of type _assay_.
- `main_fileview` : The Synapse ID of a fileview that is scoped to all files, folders, & projects in your community. (e.g. _syn20446927_)
- `community` : the abbreviated name of the community or project. (e.g. _HTAN_)
- `community` (optional): The abbreviated name of the community or project. (e.g. _HTAN_)
- `schema` (optional): The version of data model
- `schematic_service` (optional): The version of schematic service

---

Expand All @@ -74,16 +71,21 @@ This utilizes a Synapse Authentication (OAuth) client (code motivated by [ShinyO

---

## Deployment
To deploy the app to shinyapps.io, please follow the instructions in the [shinyapps_deploy.md](./shinyapps_deploy.md).

## Contributors

Main contributors and developers:

- [Rongrong Chai](https://github.com/rrchai)
- [Xengie Doan](https://github.com/xdoan)
- [Anthony Williams](https://github.com/afwillia)
- [Milen Nikolov](https://github.com/milen-sage)
- [Sujay Patil](https://github.com/sujaypatil96)
- [Lauren Wolfe](https://github.com/lakikowolfe)
- [Robert Allaway](https://github.com/allaway)
- [Bruno Grande](https://github.com/BrunoGrandePhD)
- [Xengie Doan](https://github.com/xdoan)
- [Sujay Patil](https://github.com/sujaypatil96)

<!-- Links -->

Expand Down
4 changes: 2 additions & 2 deletions functions/metadata_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from schematic import CONFIG


config = CONFIG.load_config("schematic/config.yml")
config = CONFIG.load_config("schematic_config.yml")

inputMModelLocation = CONFIG["model"]["input"]["location"]
inputMModelLocationType = CONFIG["model"]["input"]["file_type"]

manifest_title = CONFIG["manifest"]["title"]
manifest_data_type = CONFIG["manifest"]["data_type"]
manifest_data_type = CONFIG["manifest"]["data_type"][0]

metadata_model = MetadataModel(inputMModelLocation, inputMModelLocationType)
2 changes: 1 addition & 1 deletion global.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ system("chmod -R +x .venv")
# Activate virtual env
# Don't necessarily have to set `RETICULATE_PYTHON` env variable
Sys.unsetenv("RETICULATE_PYTHON")
reticulate::use_virtualenv(file.path(getwd(), ".venv"))
reticulate::use_virtualenv(file.path(getwd(), ".venv"), required = TRUE)

suppressPackageStartupMessages({
library(shiny)
Expand Down
61 changes: 0 additions & 61 deletions requirements.txt

This file was deleted.

40 changes: 40 additions & 0 deletions schematic_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Do not change the 'definitions' section unless you know what you're doing
definitions:
synapse_config: ".synapseConfig"
creds_path: "credentials.json"
token_pickle: "token.pickle"
service_acct_creds: "schematic_service_account_creds.json"

synapse:
master_fileview: 'syn23643253'
manifest_folder: 'manifests'
manifest_filename: 'synapse_storage_manifest.csv'
token_creds: 'syn23643259'
service_acct_creds: 'syn25171627'

manifest:
# if making many manifests, just include name prefix
title: 'example'
# to make all manifests enter only 'all manifests'
data_type:
- 'Biospecimen'
- 'Patient'

model:
input:
download_url: 'https://raw.githubusercontent.com/Sage-Bionetworks/schematic/develop/tests/data/example.model.jsonld' # url to download JSON-LD data model
location: 'schematic/tests/data/example.model.jsonld' # path to JSON-LD data mode
file_type: 'local'

style:
google_manifest:
req_bg_color:
red: 0.9215
green: 0.9725
blue: 0.9803
opt_bg_color:
red: 1.0
green: 1.0
blue: 0.9019
master_template_id: '1LYS5qE4nV9jzcYw5sXwCza25slDfRA1CIg3cs-hCdpU'
strict_validation: true
Loading

0 comments on commit 6df0b15

Please sign in to comment.