Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Code Integration Scenarios

R Convenience Functions

"Level 1" functions

saveCode(localFolder, codeRepo)

parameters

localFolder: folder or file on the local file system

'codeRepo' short 'nickname' of code repository system.  If 'codeRepo' is omitted, user's default is used.

side effects

Register folder with code repository, if not already registered.

Commit code.

Create metadata in Synapse, if not already created.

returns

ID of the object created in Synapse

Note: Code version is not recorded.

loadCode(id)

parameters

ID of the object in Synapse

side effects

Checks out code from code repository, if not already checked out.  Otherwise, updates local copy from code repository.

"Sources" code into R session.

returns

nothing

TODO: What if not all steps are successful?

delete(id)

parameters

ID of the object in Synapse

side effects

Delete from the code repository.

Delete metadata from Synapse.

returns

Nothing.

TODO: What if not all steps are successful?

"Level 2" functions

Web Services

These manipulation only the metadata, stored in Synapse.
Note: It is assumed that code versions are represented by refererences.

Create Code

Code Block

POST https://repo-staging.sagebase.org/repo/v1/code
{"parentId":"1234", "codeRepoId":"4567", "codeRepoLoc":"/trunk/analysisProject/R"}

Note: "parentId" is the ID of a Synapse Project; "codeRepoId" is the ID of a Code Repository object.

Successful Response:

Code Block

HTTP/1.1 201 Created
{"id":"8901", "parentId":"1234", "codeRepoId":"4567", "codeRepoLoc":"/trunk/analysisProject/R"}

Get Code

Code Block

GET https://repo-staging.sagebase.org/repo/v1/code/8901

Successful Response:

Code Block

HTTP/1.1 200 OK
{"id":"8901", "parentId":"1234", "codeRepoId":"4567", "codeRepoLoc":"/trunk/analysisProject/R"}

Update Code

Code Block

PUT https://repo-staging.sagebase.org/repo/v1/code/8901
{"id":"8901", "parentId":"5432", "codeRepoId":"4567", "codeRepoLoc":"/trunk/analysisProject/R"}

Successful Response:

Code Block

HTTP/1.1 200 OK
{"id":"8901", "parentId":"5432", "codeRepoId":"4567", "codeRepoLoc":"/trunk/analysisProject/R"}

Delete Code

Code Block

DELETE https://repo-staging.sagebase.org/repo/v1/code/8901

Successful Response:

Code Block

HTTP/1.1 204 No Content

Create Code Repository

Code Block

POST https://repo-staging.sagebase.org/repo/v1/codeRepo
{"codeRepoType":"svn", "nickname":"sageSvn", "codeRepoURL":"https://sagebionetworks.jira.com/svn"}

Successful Response:

Code Block

HTTP/1.1 201 Created
{id:"9876", "codeRepoType":"svn", "codeRepoURL":https://sagebionetworks.jira.com/svn}

TODO: Error response if 'nickname' is already used.

TODO: GET, PUT, DELETE

Create Code Repo Credentials

Code Block

POST https://repo-staging.sagebase.org/repo/v1/codeRepoCredentials
{"codeRepoId:"9876", "username":"foo": "password":"bar"}

Note: This request must be authenticated and the credentials are created for the authenticated user. The given "username" need not be the same as the user's Synapse username.

Successful Response:

Code Block

HTTP/1.1 201 Created
{"id":"5432", "codeRepoId:"9876", "username":"foo": "password":"bar"}

TODO: Should the password be 'echoed'?
TODO: GET, PUT, DELETE

...

The development cycle for preexisting code:  The code is Downloaded from Synapse, and Loaded into the R session.  The user repeatedly Runs, Edits and reLoads the code.  When satisfied, she may Store the code back to Synapse.  To help capture provenance, the Load and Store functions put the Code's ID and version into the current Step.  For the provenance record to be accurate, the user must Store prior to running.

  Image Added

Discover, retrieve, load and run code

A user, browsing Synapse, sees a piece of code of interest (mentioned in a discussion or used in an analysis), and clicks on it.  She sees:

entity.3733 <- downloadEntity(3733)

and begins by executing this in R.

Image Added

Develop new code, then Store

Image Added