Skip to content

Commit 3afe50c

Browse files
committed
Merge branch 'FEAT-1193-allow-users-to-edit-exclusion-labels' into staging
2 parents 5152232 + 3f61ea9 commit 3afe50c

File tree

47 files changed

+523
-344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+523
-344
lines changed

compose/neurosynth-frontend/cypress/e2e/pages/EditStudyPage.cy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe(PAGE_NAME, () => {
2323
cy.login('mocked').visit(PATH);
2424
});
2525

26-
it.only('should load', () => {
26+
it('should load', () => {
2727
cy.visit(PATH)
2828
.wait('@studyFixture')
2929
.wait('@projectFixture')

compose/neurosynth-frontend/cypress/e2e/workflows/Curation/CurationAIInterface.cy.tsx

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ describe('CurationAIInterface', () => {
185185
});
186186

187187
describe('table mode', () => {
188-
it.only('should only show the basic, non-AI options in the manage columns dropdown for the identification phase', () => {
188+
it('should only show the basic, non-AI options in the manage columns dropdown for the identification phase', () => {
189189
cy.contains('button', 'Manually review').click();
190190
cy.contains('button', 'Columns').click();
191191
cy.get('.MuiPopper-root').should('exist').and('not.contain', 'AI');
@@ -287,8 +287,8 @@ describe('CurationAIInterface', () => {
287287
it('should show 1 duplicate identified message when one duplicate exists project-wide', () => {
288288
cy.fixture('projects/projectCurationPRISMAWithStudies').then((projectFixture: INeurosynthProjectReturn) => {
289289
// add a duplicate tag to the first identification phase stub
290-
projectFixture.provenance.curationMetadata.columns[0].stubStudies[0].exclusionTag =
291-
defaultExclusionTags.duplicate;
290+
projectFixture.provenance.curationMetadata.columns[0].stubStudies[0].exclusionTagId =
291+
defaultExclusionTags.duplicate.id;
292292

293293
cy.intercept('GET', '**/api/projects/*', {
294294
...projectFixture,
@@ -305,12 +305,12 @@ describe('CurationAIInterface', () => {
305305

306306
it('should show the correct number of duplicates identified message when multiple duplicates exist project-wide', () => {
307307
cy.fixture('projects/projectCurationPRISMAWithStudies').then((projectFixture: INeurosynthProjectReturn) => {
308-
projectFixture.provenance.curationMetadata.columns[0].stubStudies[0].exclusionTag =
309-
defaultExclusionTags.duplicate;
310-
projectFixture.provenance.curationMetadata.columns[0].stubStudies[1].exclusionTag =
311-
defaultExclusionTags.duplicate;
312-
projectFixture.provenance.curationMetadata.columns[0].stubStudies[2].exclusionTag =
313-
defaultExclusionTags.duplicate;
308+
projectFixture.provenance.curationMetadata.columns[0].stubStudies[0].exclusionTagId =
309+
defaultExclusionTags.duplicate.id;
310+
projectFixture.provenance.curationMetadata.columns[0].stubStudies[1].exclusionTagId =
311+
defaultExclusionTags.duplicate.id;
312+
projectFixture.provenance.curationMetadata.columns[0].stubStudies[2].exclusionTagId =
313+
defaultExclusionTags.duplicate.id;
314314

315315
cy.intercept('GET', '**/api/projects/*', {
316316
...projectFixture,
@@ -329,7 +329,7 @@ describe('CurationAIInterface', () => {
329329
cy.fixture('projects/projectCurationPRISMAWithStudies').then((projectFixture: INeurosynthProjectReturn) => {
330330
// exclude all studies in the first column
331331
projectFixture.provenance.curationMetadata.columns[0].stubStudies.forEach((stub) => {
332-
stub.exclusionTag = defaultExclusionTags.duplicate;
332+
stub.exclusionTagId = defaultExclusionTags.duplicate.id;
333333
});
334334

335335
cy.intercept('GET', '**/api/projects/*', {
@@ -1043,29 +1043,21 @@ describe('CurationAIInterface', () => {
10431043
});
10441044
});
10451045

1046-
describe('exclusions', () => {
1046+
describe.only('exclusions', () => {
10471047
it('should show empty when in the exclusions view and there are no studies', () => {
10481048
cy.login('mocked').visit('/projects/abc123/curation').wait('@projectFixture');
10491049
cy.contains('li', 'Excluded').click();
10501050
cy.contains('Duplicate').click();
1051-
cy.contains('No studies for this exclusion').should('exist');
1051+
cy.contains('No studies have been marked as').should('exist');
10521052
});
10531053

10541054
it('should show excluded studies in the exclusions view', () => {
10551055
cy.fixture('projects/projectCurationSimpleWithStudies').then((projectFixture: INeurosynthProjectReturn) => {
1056-
projectFixture.provenance.curationMetadata.columns[0].stubStudies[0].exclusionTag = {
1057-
id: defaultExclusionTags.duplicate.id,
1058-
label: defaultExclusionTags.duplicate.label,
1059-
isAssignable: false,
1060-
isExclusionTag: true,
1061-
};
1062-
1063-
projectFixture.provenance.curationMetadata.columns[0].stubStudies[1].exclusionTag = {
1064-
id: defaultExclusionTags.duplicate.id,
1065-
label: defaultExclusionTags.duplicate.label,
1066-
isAssignable: false,
1067-
isExclusionTag: true,
1068-
};
1056+
projectFixture.provenance.curationMetadata.columns[0].stubStudies[0].exclusionTagId =
1057+
defaultExclusionTags.duplicate.id;
1058+
1059+
projectFixture.provenance.curationMetadata.columns[0].stubStudies[1].exclusionTagId =
1060+
defaultExclusionTags.duplicate.id;
10691061

10701062
cy.intercept('GET', '**/api/projects/*', {
10711063
...projectFixture,
@@ -1081,19 +1073,11 @@ describe('CurationAIInterface', () => {
10811073

10821074
it('should unexclude the study', () => {
10831075
cy.fixture('projects/projectCurationSimpleWithStudies').then((projectFixture: INeurosynthProjectReturn) => {
1084-
projectFixture.provenance.curationMetadata.columns[0].stubStudies[0].exclusionTag = {
1085-
id: defaultExclusionTags.duplicate.id,
1086-
label: defaultExclusionTags.duplicate.label,
1087-
isAssignable: false,
1088-
isExclusionTag: true,
1089-
};
1090-
1091-
projectFixture.provenance.curationMetadata.columns[0].stubStudies[1].exclusionTag = {
1092-
id: defaultExclusionTags.duplicate.id,
1093-
label: defaultExclusionTags.duplicate.label,
1094-
isAssignable: false,
1095-
isExclusionTag: true,
1096-
};
1076+
projectFixture.provenance.curationMetadata.columns[0].stubStudies[0].exclusionTagId =
1077+
defaultExclusionTags.duplicate.id;
1078+
1079+
projectFixture.provenance.curationMetadata.columns[0].stubStudies[1].exclusionTagId =
1080+
defaultExclusionTags.duplicate.id;
10971081

10981082
cy.intercept('GET', '**/api/projects/*', {
10991083
...projectFixture,
@@ -1109,5 +1093,31 @@ describe('CurationAIInterface', () => {
11091093
cy.get('.MuiListItem-root .MuiTypography-root').get('li:contains(Duplicate)').should('have.length', 2); // includes the Duplicate exclusion group list item
11101094
});
11111095
});
1096+
1097+
it('should allow the user to edit an exclusion', () => {
1098+
cy.fixture('projects/projectCurationSimpleWithStudies').then((projectFixture: INeurosynthProjectReturn) => {
1099+
projectFixture.user = 'auth0|62e0e6c9dd47048572613b4d'; // this user can edit the project
1100+
1101+
projectFixture.provenance.curationMetadata.columns[0].stubStudies[0].exclusionTagId =
1102+
'my-custom-exclusion';
1103+
1104+
cy.intercept('GET', '**/api/projects/*', {
1105+
...projectFixture,
1106+
} as INeurosynthProjectReturn).as('projectFixture');
1107+
});
1108+
1109+
cy.login('mocked').visit('/projects/abc123/curation').wait('@projectFixture');
1110+
1111+
cy.contains('li', 'Excluded').click();
1112+
cy.contains('My Custom Exclusion').click(); // open Duplicate exclusion group
1113+
1114+
cy.contains('h4', 'My Custom Exclusion').parent().find('[data-testid="EditIcon"]').click();
1115+
1116+
cy.get('input[type="text"]').clear();
1117+
cy.get('input[type="text"]').type('New My Custom Exclusion');
1118+
1119+
cy.contains('button', 'Save').click();
1120+
cy.contains('h4', 'New My Custom Exclusion').should('exist');
1121+
});
11121122
});
11131123
});

compose/neurosynth-frontend/cypress/e2e/workflows/Curation/ImportSleuth.cy.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import baseStudiesSingleSleuthStudyResponse from '../../../fixtures/ImportSleuth
44

55
describe('ImportSleuthDialog', () => {
66
const neurostoreAPIBaseURL = Cypress.env('neurostoreAPIBaseURL');
7+
console.log('neurostoreAPIBaseURL', neurostoreAPIBaseURL);
78

89
beforeEach(() => {
910
cy.clearLocalStorage();

compose/neurosynth-frontend/cypress/e2e/workflows/Extraction/ExtractionTable.cy.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ describe('ExtractionTable', () => {
146146
});
147147
});
148148

149-
it.only('should remove the filter if the delete button is clicked', () => {
149+
it('should remove the filter if the delete button is clicked', () => {
150150
let studysetYear = '';
151151
// ARRANGE
152152
cy.wait('@studysetFixture').then((studysetFixture) => {
@@ -635,6 +635,7 @@ describe('ExtractionTable', () => {
635635
const parsedState = JSON.parse(state || '{}');
636636

637637
cy.wrap(parsedState).should('deep.equal', {
638+
pagination: { pageIndex: 0, pageSize: 25 },
638639
columnFilters: [{ id: 'name', value: 'Activation' }],
639640
sorting: [{ id: 'year', desc: true }],
640641
studies: ['3zutS8kyg2sy'],

compose/neurosynth-frontend/cypress/fixtures/Extraction/project.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"articleYear": "1998",
3232
"authors": "Corbetta M, Akbudak E, Conturo TE, Snyder AZ, Ollinger JM, Drury HA, Linenweber MR, Petersen SE, Raichle ME, Van Essen DC, Shulman GL",
3333
"doi": "10.1016/S0896-6273(00)80593-0",
34-
"exclusionTag": null,
34+
"exclusionTagId": null,
3535
"id": "1",
3636
"identificationSource": {
3737
"id": "neurosynth_neurostore_id_source",
@@ -52,7 +52,7 @@
5252
"articleYear": "",
5353
"authors": "Silvia U. Maier, Aidan B. Makwana and Todd A. Hare",
5454
"doi": "10.1016/j.neuron.2015.07.005",
55-
"exclusionTag": null,
55+
"exclusionTagId": null,
5656
"id": "2",
5757
"identificationSource": {
5858
"id": "neurosynth_neurostore_id_source",
@@ -73,7 +73,7 @@
7373
"articleYear": "",
7474
"authors": "Ethan M. McCormick, Yang Qu and Eva H. Telzer",
7575
"doi": "10.3389/fnhum.2017.00141",
76-
"exclusionTag": null,
76+
"exclusionTagId": null,
7777
"id": "3",
7878
"identificationSource": {
7979
"id": "neurosynth_neurostore_id_source",

compose/neurosynth-frontend/cypress/fixtures/ImportSleuth/neurosynthResponses/projectsSingleSleuthStudyResponse.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"articleYear": "1996",
3333
"authors": "Henrich J,",
3434
"doi": "10.3390/ani13213332",
35-
"exclusionTag": null,
35+
"exclusionTagId": null,
3636
"id": "0101befe-ec93-4720-82e3-790c0d53ad4f",
3737
"identificationSource": {
3838
"id": "neurosynth_sleuth_id_source",

compose/neurosynth-frontend/cypress/fixtures/IngestionFixtures/projectFixture.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"articleYear": "",
3333
"authors": "",
3434
"doi": "",
35-
"exclusionTag": null,
35+
"exclusionTagId": null,
3636
"id": "c70a3df6-dd10-4789-b3f3-41743061fb6f",
3737
"identificationSource": {
3838
"id": "neurosynth_pubmed_id_source",

compose/neurosynth-frontend/cypress/fixtures/IngestionFixtures/projectPutFixture.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"articleYear": "",
3333
"authors": "",
3434
"doi": "",
35-
"exclusionTag": null,
35+
"exclusionTagId": null,
3636
"id": "c70a3df6-dd10-4789-b3f3-41743061fb6f",
3737
"identificationSource": {
3838
"id": "neurosynth_pubmed_id_source",

compose/neurosynth-frontend/cypress/fixtures/ProjectPage/projectWithMetaAnalyses.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"articleYear": "1977",
3333
"authors": "R Nilius",
3434
"doi": "",
35-
"exclusionTag": null,
35+
"exclusionTagId": null,
3636
"id": "42585725-16a8-49ea-9cb6-0919d437fef3",
3737
"identificationSource": {
3838
"id": "neurosynth_pubmed_id_source",
@@ -58,7 +58,7 @@
5858
"articleYear": "1975",
5959
"authors": "I Furuno, H Matsudaira",
6060
"doi": "10.1016/0014-4827(75)90509-1",
61-
"exclusionTag": null,
61+
"exclusionTagId": null,
6262
"id": "b2d7125b-6665-43b9-882e-652d0f1f0060",
6363
"identificationSource": {
6464
"id": "neurosynth_pubmed_id_source",
@@ -84,7 +84,7 @@
8484
"articleYear": "1976",
8585
"authors": "W Bleifeld",
8686
"doi": "",
87-
"exclusionTag": null,
87+
"exclusionTagId": null,
8888
"id": "aadf6f13-8f83-4787-ad34-a6a4bfadfbd2",
8989
"identificationSource": {
9090
"id": "neurosynth_pubmed_id_source",
@@ -110,7 +110,7 @@
110110
"articleYear": "1976",
111111
"authors": "W J van der Gulden, A J van Aspert-van Erp",
112112
"doi": "10.1016/0014-4894(76)90008-4",
113-
"exclusionTag": null,
113+
"exclusionTagId": null,
114114
"id": "be4f6821-7467-4d6e-ab86-ef9a2390d32c",
115115
"identificationSource": {
116116
"id": "neurosynth_pubmed_id_source",

0 commit comments

Comments
 (0)