-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RFC83: Add admin call to make virtual study available for all users o…
…n their landing pages (#10829) * Implement endpoints for public virtual studies * Add possibility to specify cancer type id and pmi for virt. study during publishing * Filter out forbidden study ids from virtual studies * Do not allow set * user for user virtual study To prevent missuse of the request to publish virtual study for everyone! * Add integration tests for (un)publishing virtual study * Assert fields fo published virtual studies * Use recommended ways to inject dependencies in spring * Add issue link to session service FIXMEs * Fix sonar reported NPE bugs * Remove unnecessary checks for null * Remove obsolete TODO comment * Throw AccessForbiddenException and use GlobalExceptionHadler instead * Throw IllegalStateException is downstream server return unsuccessful result * Remove raw use of ResponseEntity * Throw bad request exception instead of returning ResponseEntity * Do not filter out VS when user does not hava access to underlying study samples * Fix integration tests * Extract http calls to the session service to the handler * Remove todo comment User has to have * username witch is not likely * Fix sonarcloud issues * Deduplicate ensuring publisher api key is correct * Remove usage of generic wildcard type * Extract logic to update VS metadata fields into a method * Document publishing virtual study feature * Update docs/Create-And-Publish-Virtual-Study.md Co-authored-by: pieterlukasse <[email protected]> * Publish virtual study by modifying it instead of making copy Also get rid of undocumented endpoint * Improve name and docs of method to retrieve VS for user * Assign VM after un-publshing to the owner Make sure that we unpublish public virtual study. Fail otherwise. --------- Co-authored-by: Charles Haynes <[email protected]> Co-authored-by: pieterlukasse <[email protected]>
- Loading branch information
1 parent
dc2c594
commit a4a5942
Showing
12 changed files
with
603 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Create and Publish Virtual Study | ||
|
||
A [Virtual Study](./user-guide/faq.md#what-is-a-virtual-study) defines a subset or a combination of samples from one or more studies in the system. | ||
|
||
*Note*: To publish or un-publish a virtual study, your cBioPortal instance must be configured with `session.endpoint.publisher-api-key` in the `application.properties`. | ||
|
||
## Create Virtual Study | ||
|
||
To create a virtual study in cBioPortal, follow these steps: | ||
|
||
1. Define the desired filters on the study or multiple studies summary page. | ||
2. Click the button with the bookmark icon () in the top right corner of the screen. | ||
3. Provide a title and description, then click the Save button. You will see a link that looks like: | ||
|
||
``` | ||
https://<cbioportal_host>/study?id=<virtual_study_id> | ||
``` | ||
|
||
4. Save the virtual study link or ID if you want to publish it. | ||
|
||
If you are logged in, this virtual study will appear in the `My Virtual Studies` section on the landing page. | ||
You can always find the ID of the virtual study from the URL of the page that opens after clicking on it. | ||
|
||
## Publish Virtual Study | ||
|
||
To publish a virtual study, you need to supply the publisher API key in the `X-PUBLISHER-API-KEY` header. | ||
|
||
Here is a curl command to publish a virtual study: | ||
```shell | ||
curl \ | ||
-X POST \ | ||
-H 'X-PUBLISHER-API-KEY: <session.endpoint.publisher-api-key>' \ | ||
-v 'http://<cbioportal_host>/api/public_virtual_studies/<virtual_study_id>' | ||
``` | ||
The published virtual study will appear under the `Public Virtual Studies` section (next to the `My Virtual Studies` section) on the landing page for all users of cBioPortal. | ||
|
||
While publishing, you can specify the PubMed ID (`pmid`) and `typeOfCancerId` of the virtual study using the following command: | ||
```shell | ||
curl \ | ||
-X POST \ | ||
-H 'X-PUBLISHER-API-KEY: <session.endpoint.publisher-api-key>' \ | ||
-v 'http://<cbioportal_host>/api/public_virtual_studies/<virtual_study_id>?pmid=<pmid>&typeOfCancerId=<code>' | ||
``` | ||
|
||
The type of cancer code should match the known types of cancers in the cBioPortal database. | ||
If the type of cancer is specified, the published virtual study will appear under the respective cancer section on the landing page. | ||
Specifying the `pmid` enables a link to the PubMed page of the study. | ||
|
||
## Un-publish Virtual Study | ||
|
||
To un-publish a virtual study, you need to supply the publisher API key in the `X-PUBLISHER-API-KEY` header. | ||
After un-publishing, virtual study will no longer be displayed in the `Public Virtual Studies` section on the landing page. | ||
However, it reappears in the `My Virtual Studies` section for the owner. | ||
|
||
Here is the command to un-publish a virtual study: | ||
```shell | ||
curl \ | ||
-X DELETE \ | ||
-H 'X-PUBLISHER-API-KEY: <session.endpoint.publisher-api-key>' \ | ||
-v 'http://<cbioportal_host>/api/public_virtual_studies/<virtual_study_id>' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/org/cbioportal/service/exception/AccessForbiddenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.cbioportal.service.exception; | ||
|
||
public class AccessForbiddenException extends RuntimeException { | ||
public AccessForbiddenException(String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.