Skip to content

Commit

Permalink
Merge pull request cBioPortal#4343 from dippindots/fix-9702
Browse files Browse the repository at this point in the history
Set data limit and add warning message for study view clinical tab
  • Loading branch information
dippindots authored Aug 9, 2022
2 parents 1d368e6 + 5735717 commit 9299156
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 29 deletions.
4 changes: 4 additions & 0 deletions end-to-end-test/local/runtime-config/portal.properties
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ ehcache.cache_type=none
# This limit is enforced on the frontend.
# query_product_limit=1000000

# Limit the size of samples in clinical tab in study view page. clinical attribute count * sample count < clinical_attribute_product_limit
# This limit is enforced on the frontend.
# clinical_attribute_product_limit=6500000

# Enable gsva to query
skin.show_gsva=true
skin.show_settings_menu=true
1 change: 1 addition & 0 deletions src/config/IAppConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export interface IServerConfig {
session_url_length_threshold: string;
mskWholeSlideViewerToken: string;
query_product_limit: number;
clinical_attribute_product_limit: number;
dat_method: string;
skin_show_gsva: boolean;
skin_geneset_hierarchy_default_gsva_score: number;
Expand Down
2 changes: 2 additions & 0 deletions src/config/serverConfigDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ export const ServerConfigDefaults: Partial<IServerConfig> = {

query_product_limit: 1000000,

clinical_attribute_product_limit: 6500000,

skin_show_gsva: false,

skin_geneset_hierarchy_default_gsva_score: 0.5,
Expand Down
27 changes: 27 additions & 0 deletions src/pages/studyView/StudyViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1909,6 +1909,11 @@ export class StudyViewPageStore
return this.newlyAddedCharts.includes(uniqueKey);
}

@action
handleTabChange(id: string) {
this.urlWrapper.setTab(id);
}

@action
updateStoreByFilters(filters: Partial<StudyViewFilter>): void {
// fixes filters in place to ensure backward compatiblity
Expand Down Expand Up @@ -8278,6 +8283,28 @@ export class StudyViewPageStore
default: [],
});

readonly clinicalAttributeProduct = remoteData({
await: () => [this.clinicalAttributes, this.selectedSamples],
invoke: async () => {
return (
this.clinicalAttributes.result.length *
this.selectedSamples.result.length
);
},
default: 0,
});

readonly maxSamplesForClinicalTab = remoteData({
await: () => [this.clinicalAttributes],
invoke: async () => {
return Math.floor(
getServerConfig().clinical_attribute_product_limit /
this.clinicalAttributes.result.length
);
},
default: 0,
});

readonly molecularProfileForGeneCharts = remoteData({
await: () => [
this.molecularProfiles,
Expand Down
133 changes: 104 additions & 29 deletions src/pages/studyView/tabs/ClinicalDataTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import ProgressIndicator, {
} from '../../../shared/components/progressIndicator/ProgressIndicator';
import autobind from 'autobind-decorator';
import { WindowWidthBox } from '../../../shared/components/WindowWidthBox/WindowWidthBox';
import { getServerConfig } from 'config/config';
import { StudyViewPageTabKeyEnum } from '../StudyViewPageTabs';

export interface IClinicalDataTabTable {
store: StudyViewPageStore;
Expand Down Expand Up @@ -178,46 +180,119 @@ export class ClinicalDataTab extends React.Component<
<WindowWidthBox offset={60}>
<If
condition={
this.columns.isPending ||
this.props.store.getDataForClinicalDataTab.isPending
this.props.store.clinicalAttributeProduct
.isPending ||
this.props.store.maxSamplesForClinicalTab
.isPending ||
this.props.store.selectedSamples.isPending
}
>
<Then>
<LoadingIndicator
isLoading={
this.columns.isPending ||
this.props.store.getDataForClinicalDataTab
.isPending
this.props.store.clinicalAttributeProduct
.isPending ||
this.props.store.maxSamplesForClinicalTab
.isPending ||
this.props.store.selectedSamples.isPending
}
size={'big'}
center={true}
>
<ProgressIndicator
getItems={this.getProgressItems}
show={
this.columns.isPending ||
this.props.store
.getDataForClinicalDataTab.isPending
}
/>
</LoadingIndicator>
/>
</Then>
<Else>
<ClinicalDataTabTableComponent
initialItemsPerPage={20}
showCopyDownload={true}
showColumnVisibility={false}
data={
this.props.store.getDataForClinicalDataTab
.result || []
<If
condition={
this.props.store.clinicalAttributeProduct
.result >
getServerConfig()
.clinical_attribute_product_limit
}
columns={this.columns.result}
copyDownloadProps={{
showCopy: false,
downloadFilename: this.props.store
.clinicalDataDownloadFilename,
}}
/>
>
<Then>
Too many samples selected. The maximum table
length is{' '}
<b>
{
this.props.store
.maxSamplesForClinicalTab.result
}
</b>{' '}
rows, but your current selection would be{' '}
<b>
{
this.props.store.selectedSamples
.result.length
}
</b>{' '}
rows. Select fewer samples on the{' '}
<a
onClick={() =>
this.props.store.handleTabChange(
StudyViewPageTabKeyEnum.SUMMARY
)
}
>
Summary tab
</a>
.{' '}
</Then>
<Else>
<If
condition={
this.columns.isPending ||
this.props.store
.getDataForClinicalDataTab
.isPending
}
>
<Then>
<LoadingIndicator
isLoading={
this.columns.isPending ||
this.props.store
.getDataForClinicalDataTab
.isPending
}
size={'big'}
center={true}
>
<ProgressIndicator
getItems={
this.getProgressItems
}
show={
this.columns
.isPending ||
this.props.store
.getDataForClinicalDataTab
.isPending
}
/>
</LoadingIndicator>
</Then>
<Else>
<ClinicalDataTabTableComponent
initialItemsPerPage={20}
showCopyDownload={true}
showColumnVisibility={false}
data={
this.props.store
.getDataForClinicalDataTab
.result || []
}
columns={this.columns.result}
copyDownloadProps={{
showCopy: false,
downloadFilename: this.props
.store
.clinicalDataDownloadFilename,
}}
/>
</Else>
</If>
</Else>
</If>
</Else>
</If>
</WindowWidthBox>
Expand Down

0 comments on commit 9299156

Please sign in to comment.