Skip to content

Commit

Permalink
On Study View handle larger number of resource files (#5034)
Browse files Browse the repository at this point in the history
Fixes cBioPortal/cbioportal#11004 (associated backend PR is merged, see cBioPortal/cbioportal#11051). This PR modifies the FilesAndLinks table on the Study View to use the new resource-data-all endpoint, which reduces the number of API requests and enables showing thousands of resource files without performance degradation
  • Loading branch information
hweej authored Nov 1, 2024
1 parent 813db5d commit 9a02d70
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2831,6 +2831,103 @@
"operationId": "getAllStudyResourceDataInStudyUsingGET"
}
},
"/api/studies/{studyId}/resource-data-all": {
"get": {
"produces": [
"application/json"
],
"parameters": [
{
"description": "Study ID e.g. acc_tcga",
"in": "path",
"name": "studyId",
"required": true,
"type": "string"
},
{
"description": "Resource ID",
"in": "query",
"name": "resourceId",
"required": false,
"type": "string"
},
{
"default": "SUMMARY",
"description": "Level of detail of the response",
"enum": [
"ID",
"SUMMARY",
"DETAILED",
"META"
],
"in": "query",
"name": "projection",
"required": false,
"type": "string"
},
{
"default": 10000000,
"description": "Page size of the result list",
"format": "int32",
"in": "query",
"maximum": 10000000,
"minimum": 1,
"name": "pageSize",
"required": false,
"type": "integer"
},
{
"default": 0,
"description": "Page number of the result list",
"format": "int32",
"in": "query",
"minimum": 0,
"name": "pageNumber",
"required": false,
"type": "integer"
},
{
"description": "Name of the property that the result list is sorted by",
"enum": [
"ResourceId",
"url"
],
"in": "query",
"name": "sortBy",
"required": false,
"type": "string"
},
{
"default": "ASC",
"description": "Direction of the sort",
"enum": [
"ASC",
"DESC"
],
"in": "query",
"name": "direction",
"required": false,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"items": {
"$ref": "#/definitions/ResourceData"
},
"type": "array"
}
}
},
"tags": [
"Resource Data"
],
"description": "Get all resource data for for all patients and all samples within a study",
"operationId": "getAllStudyResourceDataInStudyPatientSampleUsingGET"
}
},
"/api/studies/{studyId}/resource-definitions": {
"get": {
"produces": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6746,6 +6746,159 @@ export default class CBioPortalAPIInternal {
return response.body;
});
};
getAllStudyResourceDataInStudyPatientSampleUsingGETURL(parameters: {
'studyId': string,
'resourceId' ? : string,
'projection' ? : "ID" | "SUMMARY" | "DETAILED" | "META",
'pageSize' ? : number,
'pageNumber' ? : number,
'sortBy' ? : "ResourceId" | "url",
'direction' ? : "ASC" | "DESC",
$queryParameters ? : any
}): string {
let queryParameters: any = {};
let path = '/api/studies/{studyId}/resource-data-all';

path = path.replace('{studyId}', parameters['studyId'] + '');
if (parameters['resourceId'] !== undefined) {
queryParameters['resourceId'] = parameters['resourceId'];
}

if (parameters['projection'] !== undefined) {
queryParameters['projection'] = parameters['projection'];
}

if (parameters['pageSize'] !== undefined) {
queryParameters['pageSize'] = parameters['pageSize'];
}

if (parameters['pageNumber'] !== undefined) {
queryParameters['pageNumber'] = parameters['pageNumber'];
}

if (parameters['sortBy'] !== undefined) {
queryParameters['sortBy'] = parameters['sortBy'];
}

if (parameters['direction'] !== undefined) {
queryParameters['direction'] = parameters['direction'];
}

if (parameters.$queryParameters) {
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
var parameter = parameters.$queryParameters[parameterName];
queryParameters[parameterName] = parameter;
});
}
let keys = Object.keys(queryParameters);
return this.domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '');
};

/**
* Get all resource data for for all patients and all samples within a study
* @method
* @name CBioPortalAPIInternal#getAllStudyResourceDataInStudyPatientSampleUsingGET
* @param {string} studyId - Study ID e.g. acc_tcga
* @param {string} resourceId - Resource ID
* @param {string} projection - Level of detail of the response
* @param {integer} pageSize - Page size of the result list
* @param {integer} pageNumber - Page number of the result list
* @param {string} sortBy - Name of the property that the result list is sorted by
* @param {string} direction - Direction of the sort
*/
getAllStudyResourceDataInStudyPatientSampleUsingGETWithHttpInfo(parameters: {
'studyId': string,
'resourceId' ? : string,
'projection' ? : "ID" | "SUMMARY" | "DETAILED" | "META",
'pageSize' ? : number,
'pageNumber' ? : number,
'sortBy' ? : "ResourceId" | "url",
'direction' ? : "ASC" | "DESC",
$queryParameters ? : any,
$domain ? : string
}): Promise < request.Response > {
const domain = parameters.$domain ? parameters.$domain : this.domain;
const errorHandlers = this.errorHandlers;
const request = this.request;
let path = '/api/studies/{studyId}/resource-data-all';
let body: any;
let queryParameters: any = {};
let headers: any = {};
let form: any = {};
return new Promise(function(resolve, reject) {
headers['Accept'] = 'application/json';

path = path.replace('{studyId}', parameters['studyId'] + '');

if (parameters['studyId'] === undefined) {
reject(new Error('Missing required parameter: studyId'));
return;
}

if (parameters['resourceId'] !== undefined) {
queryParameters['resourceId'] = parameters['resourceId'];
}

if (parameters['projection'] !== undefined) {
queryParameters['projection'] = parameters['projection'];
}

if (parameters['pageSize'] !== undefined) {
queryParameters['pageSize'] = parameters['pageSize'];
}

if (parameters['pageNumber'] !== undefined) {
queryParameters['pageNumber'] = parameters['pageNumber'];
}

if (parameters['sortBy'] !== undefined) {
queryParameters['sortBy'] = parameters['sortBy'];
}

if (parameters['direction'] !== undefined) {
queryParameters['direction'] = parameters['direction'];
}

if (parameters.$queryParameters) {
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
var parameter = parameters.$queryParameters[parameterName];
queryParameters[parameterName] = parameter;
});
}

request('GET', domain + path, body, headers, queryParameters, form, reject, resolve, errorHandlers);

});
};

/**
* Get all resource data for for all patients and all samples within a study
* @method
* @name CBioPortalAPIInternal#getAllStudyResourceDataInStudyPatientSampleUsingGET
* @param {string} studyId - Study ID e.g. acc_tcga
* @param {string} resourceId - Resource ID
* @param {string} projection - Level of detail of the response
* @param {integer} pageSize - Page size of the result list
* @param {integer} pageNumber - Page number of the result list
* @param {string} sortBy - Name of the property that the result list is sorted by
* @param {string} direction - Direction of the sort
*/
getAllStudyResourceDataInStudyPatientSampleUsingGET(parameters: {
'studyId': string,
'resourceId' ? : string,
'projection' ? : "ID" | "SUMMARY" | "DETAILED" | "META",
'pageSize' ? : number,
'pageNumber' ? : number,
'sortBy' ? : "ResourceId" | "url",
'direction' ? : "ASC" | "DESC",
$queryParameters ? : any,
$domain ? : string
}): Promise < Array < ResourceData >
> {
return this.getAllStudyResourceDataInStudyPatientSampleUsingGETWithHttpInfo(parameters).then(function(response: request.Response) {
return response.body;
});
};
getAllResourceDefinitionsInStudyUsingGETURL(parameters: {
'studyId': string,
'projection' ? : "ID" | "SUMMARY" | "DETAILED" | "META",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,15 @@
},
"ncitCode": {
"type": "string"
},
"synonyms": {
"type": "array",
"items": {
"type": "string"
}
},
"uuid": {
"type": "string"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ export type Drug = {

'ncitCode': string

'synonyms': Array < string >

'uuid': string

};
export type EnsemblFilter = {
'geneIds': Array < string >
Expand Down
Loading

0 comments on commit 9a02d70

Please sign in to comment.