Skip to content

Commit fd2d579

Browse files
authored
feat: addressed meta-analysis bugs and improvements (#648)
* feat: addressed meta-analysis bugs and improvements * feat: delete studysets page and fix tests
1 parent 0b7a69c commit fd2d579

File tree

17 files changed

+422
-647
lines changed

17 files changed

+422
-647
lines changed

compose/neurosynth-frontend/cypress/e2e/pages/PublicStudysetsPage.cy.tsx renamed to compose/neurosynth-frontend/cypress/e2e/pages/PublicStudysetPage.cy.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export {};
44

5-
const PATH = '/studysets';
5+
const PATH = '/studysets/abc123';
66
const PAGE_NAME = 'StudysetsPage';
77

88
describe(PAGE_NAME, () => {
@@ -12,9 +12,11 @@ describe(PAGE_NAME, () => {
1212
});
1313

1414
it('should load successfully', () => {
15-
cy.intercept('GET', `**/api/projects*`).as('realProjectsRequest');
16-
cy.intercept('GET', `**/api/studysets/**`).as('realStudysetRequest');
17-
cy.visit(PATH).wait('@realStudysetRequest');
15+
cy.intercept('GET', `**/api/studysets/**`, { fixture: 'studyset' }).as('studysetRequest');
16+
cy.intercept('GET', `**/api/annotations/**`, { fixture: 'annotation' }).as(
17+
'annotationRequest'
18+
);
19+
cy.visit(PATH).wait('@studysetRequest').wait('@annotationRequest');
1820
});
1921

2022
// describe('Search', () => {

compose/neurosynth-frontend/src/components/Dialogs/CreateMetaAnalysisSpecificationDialog/CreateMetaAnalysisSpecificationAlgorithmStep/SelectSpecificationComponent/SelectSpecificationComponent.tsx

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import NeurosynthAutocomplete, {
1111
import { EAnalysisType } from 'hooks/metaAnalyses/useCreateAlgorithmSpecification';
1212
import DynamicForm from 'components/MetaAnalysisConfigComponents/DynamicForm/DynamicForm';
1313
import CreateMetaAnalysisSpecificationDialogBaseStyles from '../../CreateMetaAnalysisSpecificationDialogBase.styles';
14+
import { useEffect, useMemo, useRef } from 'react';
1415

1516
const metaAnalysisSpecification: IMetaAnalysisParamsSpecification = metaAnalysisSpec;
1617

@@ -50,19 +51,41 @@ const SelectSpecificationComponent: React.FC<{
5051
correctorArgs: IDynamicValueType;
5152
};
5253
}> = (props) => {
53-
const metaAnalyticAlgorithms: IAutocompleteObject[] = Object.keys(
54-
metaAnalysisSpecification[EAnalysisType.CBMA]
55-
).map((algoName) => ({
56-
label: algoName,
57-
description: metaAnalysisSpecification[EAnalysisType.CBMA][algoName]?.summary || '',
58-
}));
59-
60-
const correctorOptions: IAutocompleteObject[] = Object.keys(
61-
metaAnalysisSpecification.CORRECTOR
62-
).map((corrector) => ({
63-
label: corrector,
64-
description: metaAnalysisSpecification.CORRECTOR[corrector]?.summary,
65-
}));
54+
const initialized = useRef<boolean>(false);
55+
56+
const metaAnalyticAlgorithms: IAutocompleteObject[] = useMemo(
57+
() =>
58+
Object.keys(metaAnalysisSpecification[EAnalysisType.CBMA]).map((algoName) => ({
59+
label: algoName,
60+
description: metaAnalysisSpecification[EAnalysisType.CBMA][algoName]?.summary || '',
61+
})),
62+
[]
63+
);
64+
65+
useEffect(() => {
66+
if (props.algorithm?.estimator || initialized.current) return;
67+
68+
const algorithmOpt = metaAnalyticAlgorithms.find((algo) => algo.label === 'MKDADensity');
69+
if (!algorithmOpt) return;
70+
props.onSelectSpecification({
71+
...props.algorithm,
72+
estimator: algorithmOpt,
73+
estimatorArgs: getDefaultValuesForTypeAndParameter(
74+
EAnalysisType.CBMA,
75+
algorithmOpt?.label
76+
),
77+
});
78+
initialized.current = true;
79+
}, [props.algorithm?.estimator, metaAnalyticAlgorithms, props]);
80+
81+
const correctorOptions: IAutocompleteObject[] = useMemo(
82+
() =>
83+
Object.keys(metaAnalysisSpecification.CORRECTOR).map((corrector) => ({
84+
label: corrector,
85+
description: metaAnalysisSpecification.CORRECTOR[corrector]?.summary,
86+
})),
87+
[]
88+
);
6689

6790
return (
6891
<Box>

compose/neurosynth-frontend/src/components/Dialogs/CreateMetaAnalysisSpecificationDialog/CreateMetaAnalysisSpecificationSelectionStep/CreateMetaAnalysisSpecificationSelectionStep.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, Button, Typography } from '@mui/material';
1+
import { Box, Button, Link, Typography } from '@mui/material';
22
import { ENavigationButton } from 'components/Buttons/NavigationButtons/NavigationButtons';
33
import { EPropertyType } from 'components/EditMetadata';
44
import {
@@ -44,9 +44,27 @@ const CreateMetaAnalysisSpecificationSelectionStep: React.FC<{
4444
</Typography>
4545
</Box>
4646
<Box>
47+
<Typography gutterBottom>
48+
Select the{' '}
49+
<Link
50+
target="_blank"
51+
href="https://neurostuff.github.io/compose-docs/guide/glossary#annotation"
52+
>
53+
annotation
54+
</Link>{' '}
55+
column for inclusion. This will determine which{' '}
56+
<Link
57+
target="_blank"
58+
href="https://neurostuff.github.io/compose-docs/guide/glossary#analysis"
59+
>
60+
analyses
61+
</Link>{' '}
62+
are used for this meta-analysis.
63+
</Typography>
64+
4765
<Typography gutterBottom sx={{ marginBottom: '1rem' }}>
48-
Select the <b>annotation inclusion column</b> that you would like to use to
49-
select the analyses for your meta-analysis.
66+
By default, the "included" column includes all studies & analyses. At the
67+
moment, only boolean and string annotations are supported.
5068
</Typography>
5169

5270
<SelectAnalysesComponent

compose/neurosynth-frontend/src/components/EditStudyComponents/EditStudySwapVersionButton/EditStudySwapVersionButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const EditStudySwapVersionButton: React.FC = (props) => {
8989
});
9090

9191
updateStudysetWithNewStudyId(studyId, versionToSwapTo);
92-
await setAnalysesInAnnotationAsIncluded(annotationId, versionToSwapTo);
92+
await setAnalysesInAnnotationAsIncluded(annotationId);
9393

9494
history.push(`/projects/${projectId}/extraction/studies/${versionToSwapTo}`);
9595

compose/neurosynth-frontend/src/components/HotTables/EditAnnotationsHotTable/EditAnnotationsHotTable.helpers.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const createColumnHeader = (
147147
);
148148
};
149149

150-
export const createColumns = (noteKeys: NoteKeyType[]) =>
150+
export const createColumns = (noteKeys: NoteKeyType[], disable?: boolean) =>
151151
[
152152
{
153153
className: `${styles['study-col']} ${styles['read-only-col']} truncate`,
@@ -159,7 +159,7 @@ export const createColumns = (noteKeys: NoteKeyType[]) =>
159159
},
160160
...noteKeys.map((x) => {
161161
return {
162-
readOnly: false,
162+
readOnly: disable !== undefined ? disable : false,
163163
className: styles[x.type],
164164
allowInvalid: false,
165165
type: x.type === EPropertyType.BOOLEAN ? 'checkbox' : 'text',

0 commit comments

Comments
 (0)