From 3de6275ce1e878fc79013767bed332c970f81a93 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Wed, 30 Oct 2024 08:46:08 -0400 Subject: [PATCH] KPMP-5366: change tissueType variables --- .../enrollmentCategoryActions.js | 8 +++++ src/actions/TissueType/tissueTypeActions.js | 8 ----- src/actions/actionNames.js | 2 +- src/components/DataViz/DataTypeSelector.js | 32 +++++++++---------- .../DataViz/DataTypeSelectorContainer.js | 8 ++--- src/components/DataViz/RNASeqViz.js | 32 +++++++++---------- src/components/DataViz/RNASeqVizContainer.js | 8 ++--- src/components/DataViz/RegionalProteomics.js | 24 +++++++------- .../DataViz/RegionalProteomicsContainer.js | 8 ++--- src/components/DataViz/RegionalViz.js | 22 ++++++------- .../DataViz/RegionalVizContainer.js | 8 ++--- src/components/DataViz/UMAPContainer.js | 2 +- src/components/DataViz/UMAPViz.js | 6 ++-- ...educer.js => enrollmentCategoryReducer.js} | 4 +-- src/components/Explorer/Explorer.js | 8 ++--- .../Explorer/NephronSchemaCardContainer.js | 4 +-- .../DiffexByClusterContainer.js | 2 +- .../ExpressionTables/ExpressionXCellType.js | 30 ++++++++--------- ...pe.js => ExpressionXEnrollmentCategory.js} | 4 +-- src/components/Home/AvailableDatasetsTable.js | 14 ++++---- src/components/Home/ParticipantSummary.js | 4 +-- .../Home/ParticipantSummaryContainer.js | 8 ++--- src/components/Plots/FeaturePlot.js | 6 ++-- src/components/Plots/LMDDotPlot.js | 8 ++--- .../Summary/CellTypeSummaryContainer.js | 4 +-- .../Summary/GeneSummaryContainer.js | 4 +-- src/helpers/ApolloClient.js | 2 +- src/helpers/Utils.js | 16 +++++----- src/initialState.json | 2 +- src/reducers.js | 4 +-- 30 files changed, 146 insertions(+), 146 deletions(-) create mode 100644 src/actions/EnrollmentCategory/enrollmentCategoryActions.js delete mode 100644 src/actions/TissueType/tissueTypeActions.js rename src/components/DataViz/{tissueTypeReducer.js => enrollmentCategoryReducer.js} (57%) rename src/components/ExpressionTables/{ExpressionXTissueType.js => ExpressionXEnrollmentCategory.js} (93%) diff --git a/src/actions/EnrollmentCategory/enrollmentCategoryActions.js b/src/actions/EnrollmentCategory/enrollmentCategoryActions.js new file mode 100644 index 00000000..c9a48457 --- /dev/null +++ b/src/actions/EnrollmentCategory/enrollmentCategoryActions.js @@ -0,0 +1,8 @@ +import actionNames from '../actionNames' + +export const setEnrollmentCategory = (enrollmentCategory) => { + return { + type: actionNames.SET_ENROLLMENT_CATEGORY, + payload: enrollmentCategory + } +}; diff --git a/src/actions/TissueType/tissueTypeActions.js b/src/actions/TissueType/tissueTypeActions.js deleted file mode 100644 index 33992802..00000000 --- a/src/actions/TissueType/tissueTypeActions.js +++ /dev/null @@ -1,8 +0,0 @@ -import actionNames from '../actionNames' - -export const setTissueType = (tissueType) => { - return { - type: actionNames.SET_TISSUE_TYPE, - payload: tissueType - } -}; diff --git a/src/actions/actionNames.js b/src/actions/actionNames.js index c23869fc..277e5727 100644 --- a/src/actions/actionNames.js +++ b/src/actions/actionNames.js @@ -3,7 +3,7 @@ const actionNames = { RESET_STATE: 'RESET_STATE', SET_SELECTED_CONCEPT: 'SET_SELECTED_CONCEPT', SET_DATA_TYPE: 'SET_DATA_TYPE', - SET_TISSUE_TYPE: 'SET_TISSUE_TYPE', + SET_ENROLLMENT_CATEGORY: 'SET_ENROLLMENT_CATEGORY', SET_CLUSTER: 'SET_CLUSTER', SET_CELL_TYPE: 'SET_CELL_TYPE', SET_GENE: 'SET_GENE', diff --git a/src/components/DataViz/DataTypeSelector.js b/src/components/DataViz/DataTypeSelector.js index 3be0bedc..b05e2787 100644 --- a/src/components/DataViz/DataTypeSelector.js +++ b/src/components/DataViz/DataTypeSelector.js @@ -2,7 +2,7 @@ import React, { Component } from "react"; import Select from "react-select"; import { Row, Col, Container} from 'reactstrap'; import ConceptSelectContainer from '../ConceptSelect/ConceptSelectContainer'; -import { getTissueTypeOptions, getAllDataTypeOptions, getDataTypeOptionsWithTissueType } from "../../helpers/Utils"; +import { getEnrollmentCategoryOptions, getAllDataTypeOptions, getDataTypeOptionsWithEnrollmentCategory } from "../../helpers/Utils"; import { fetchDataTypeSummaryInformation } from '../../helpers/ApolloClient'; import { handleGoogleAnalyticsEvent } from '../../helpers/googleAnalyticsHelper'; import { faChevronDown, faChevronUp } from "@fortawesome/free-solid-svg-icons"; @@ -13,7 +13,7 @@ class DataTypeSelector extends Component { constructor(props) { super(props); this.state = { - tissueInputValue: this.props.tissueType ? this.props.tissueType : "all", + tissueInputValue: this.props.enrollmentCategory ? this.props.enrollmentCategory : "all", isDatasetSummaryLoading: false, tissueValue: null, dataTypeInputValue: null, @@ -33,7 +33,7 @@ class DataTypeSelector extends Component { componentDidUpdate(prevProps) { if ((this.props.gene.symbol !== prevProps.gene.symbol || this.props.dataType !== prevProps.dataType - || this.props.tissueType !== prevProps.tissueType)) { + || this.props.enrollmentCategory !== prevProps.enrollmentCategory)) { if (this.props.gene.symbol) { this.reloadPageData(this.props.gene.symbol); } else { @@ -44,11 +44,11 @@ class DataTypeSelector extends Component { componentDidMount() { let options = getAllDataTypeOptions() - let tissueTypeOptions = getTissueTypeOptions(this.state.selectedDataset, this.props.gene.symbol); + let enrollmentCategoryOptions = getEnrollmentCategoryOptions(this.state.selectedDataset, this.props.gene.symbol); let selectedOption = options.find(item => this.props.dataType === item.value); - let selectedTissueType = tissueTypeOptions.find(item => this.state.tissueInputValue === item.value) - this.setState({ dataTypeOptions: options, dataTypeInputValue: selectedOption, tissueValue: selectedTissueType }) + let selectedEnrollmentCategory = enrollmentCategoryOptions.find(item => this.state.tissueInputValue === item.value) + this.setState({ dataTypeOptions: options, dataTypeInputValue: selectedOption, tissueValue: selectedEnrollmentCategory }) if (this.props.gene.symbol) { this.reloadPageData(this.props.gene.symbol); @@ -61,14 +61,14 @@ class DataTypeSelector extends Component { // Coming from homepage search (no datatype yet) if (!dataTypeShort && availableData && availableData.length > 0) { this.props.setDataType(availableData[0].dataTypeShort); - this.props.setTissueType(this.props.tissueType ? this.props.tissueType : "all"); + this.props.setEnrollmentCategory(this.props.enrollmentCategory ? this.props.enrollmentCategory : "all"); this.setState({ selectedDataset: availableData[0], tissueInputValue: "all"}) return } // Coming from search on viz page (has datatype) for (const [, dataset] of availableData.entries()) { if (dataset["dataTypeShort"] === dataTypeShort) { - this.props.setTissueType(this.props.tissueType ? this.props.tissueType : "all"); + this.props.setEnrollmentCategory(this.props.enrollmentCategory ? this.props.enrollmentCategory : "all"); this.setState({ selectedDataset: dataset, }) return } @@ -117,13 +117,13 @@ class DataTypeSelector extends Component { if (datasetSummary) { datasetSummary = this.formatGeneDataset(datasetSummary) this.setSelectedDatasetSummary(this.props.dataType, datasetSummary) - getDataTypeOptionsWithTissueType(this.props.gene.symbol, "", datasetSummary, this.props.tissueType).then( + getDataTypeOptionsWithEnrollmentCategory(this.props.gene.symbol, "", datasetSummary, this.props.enrollmentCategory).then( (options) => { let selectedOption = options.find(item => this.props.dataType === item.value); - let tissueTypeOptions = getTissueTypeOptions(this.state.selectedDataset, this.props.gene.symbol); + let enrollmentCategoryOptions = getEnrollmentCategoryOptions(this.state.selectedDataset, this.props.gene.symbol); - let selectedTissueType = tissueTypeOptions.find(item => this.state.tissueInputValue === item.value) - this.setState({ dataTypeOptions: options, dataTypeInputValue: selectedOption, availableData: datasetSummary, tissueValue: selectedTissueType }) + let selectedEnrollmentCategory = enrollmentCategoryOptions.find(item => this.state.tissueInputValue === item.value) + this.setState({ dataTypeOptions: options, dataTypeInputValue: selectedOption, availableData: datasetSummary, tissueValue: selectedEnrollmentCategory }) }, (error) => { this.setState({ dataTypeOptions: [] }); @@ -149,8 +149,8 @@ class DataTypeSelector extends Component { handleTissueSelect = (selected, actionMeta) => { - handleGoogleAnalyticsEvent('Explorer', 'Filter', `tissueType: ${selected.value}`); - this.props.setTissueType(selected.value); + handleGoogleAnalyticsEvent('Explorer', 'Filter', `enrollmentCategory: ${selected.value}`); + this.props.setEnrollmentCategory(selected.value); this.setState({ tissueValue: selected }); }; @@ -163,7 +163,7 @@ class DataTypeSelector extends Component { }; getInputValue = () => { - let options = getTissueTypeOptions(this.state.selectedDataset, this.props.gene.symbol); + let options = getEnrollmentCategoryOptions(this.state.selectedDataset, this.props.gene.symbol); try { return options.find(element => element.value === this.state.tissueInputValue).label } catch (e) { @@ -222,7 +222,7 @@ class DataTypeSelector extends Component { in: