Skip to content

Commit

Permalink
fix: prevented pmid,pmcid,doi from being undefined during ingestion o…
Browse files Browse the repository at this point in the history
…r study edit
  • Loading branch information
nicoalee committed Jul 22, 2024
1 parent 9e34c88 commit c5584d2
Show file tree
Hide file tree
Showing 12 changed files with 508 additions and 11 deletions.
34 changes: 32 additions & 2 deletions compose/neurosynth-frontend/cypress/e2e/pages/EditStudyPage.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ describe(PAGE_NAME, () => {
cy.intercept('GET', `https://api.semanticscholar.org/**`, {
fixture: 'semanticScholar',
}).as('semanticScholarFixture');
});

it('should load', () => {
cy.intercept('GET', `**/api/studies/mock-study-id*`, { fixture: 'study' }).as(
'studyFixture'
);
Expand All @@ -25,12 +23,44 @@ describe(PAGE_NAME, () => {
'annotationFixture'
);
cy.intercept('GET', `**/api/studysets/*`, { fixture: 'studyset' }).as('studysetFixture');

cy.intercept('POST', `https://www.google-analytics.com/*/**`, {}).as(
'googleAnalyticsFixture'
);

cy.login('mocked').visit(PATH);
});

it('should load', () => {
cy.visit(PATH)
.wait('@studyFixture')
.wait('@projectFixture')
.wait('@annotationFixture')
.wait('@semanticScholarFixture')
.wait('@studysetFixture');
});

it('should save and set study with doi and pmid undefined if they are empty', () => {
cy.intercept('PUT', '**/api/studies/mock-study-id').as('editStudy');

// ARRANGE
cy.visit(PATH)
.wait('@studyFixture')
.wait('@projectFixture')
.wait('@annotationFixture')
.wait('@semanticScholarFixture')
.wait('@studysetFixture');

// ACT
cy.get('div').contains('(name, authors, description, doi, pmid, etc)').click();
cy.contains('label', 'doi').next().clear();
cy.contains('label', 'pmid').next().clear();
cy.contains('label', 'pmcid').next().clear();
cy.contains('button', 'save').click();

// ASSERT
cy.get('@editStudy').its('request.body').should('not.have.a.property', 'doi');
cy.get('@editStudy').its('request.body').should('not.have.a.property', 'pmid');
cy.get('@editStudy').its('request.body').should('not.have.a.property', 'pmcid');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/// <reference types="cypress" />

const PATH = '/projects/mock-project-id/curation';

describe('Ingestion', () => {
beforeEach(() => {
cy.clearLocalStorage().clearSessionStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
cy.intercept('GET', `**/api/meta-analyses*`, { fixture: 'metaAnalyses' }).as(
'metaAnalysesFixture'
);

cy.intercept('POST', `https://www.google-analytics.com/*/**`, {}).as(
'googleAnalyticsFixture'
);

cy.intercept('GET', `**/api/projects/*`, {
fixture: 'IngestionFixtures/projectFixture',
}).as('projectFixture');
cy.intercept('PUT', `**/api/projects/*`, {
fixture: 'IngestionFixtures/projectPutFixture',
});

cy.intercept('POST', `**/api/studysets/`, {
fixture: 'IngestionFixtures/studysetFixture',
}).as('studysetFixture');
cy.intercept('PUT', `**/api/studysets/*`, {
fixture: 'IngestionFixtures/studysetPutFixture',
});
cy.intercept('GET', `**/api/studysets/*`, {
fixture: 'IngestionFixtures/studysetFixture',
}).as('studysetFixture');

cy.intercept('POST', `**/api/annotations/*`, {
fixture: 'IngestionFixtures/annotationsFixture',
}).as('annotationFixture');
cy.intercept('PUT', `**/api/annotations/*`, {
fixture: 'IngestionFixtures/annotationsPutFixture',
}).as('annotationPutFixture');
cy.intercept('GET', `**/api/annotations/*`, {
fixture: 'IngestionFixtures/annotationsPutFixture',
}).as('annotationFixture');

cy.intercept('POST', `**/api/base-studies/`, {
fixture: 'IngestionFixtures/baseStudiesFixture',
}).as('baseStudiesFixture');
});

it('should show the dialog', () => {
cy.login('mocked').visit(PATH);
cy.contains('button', 'Move To Extraction Phase').click();

cy.contains('button', 'extraction: get started').click();
cy.contains('button', 'NEXT').click();

cy.get('@baseStudiesFixture').its('request.body').should('not.have.a.property', 'doi');
cy.get('@baseStudiesFixture').its('request.body').should('not.have.a.property', 'pmid');
cy.get('@baseStudiesFixture').its('request.body').should('not.have.a.property', 'pmcid');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"id": "DVwyM6Qg5iaw",
"user": "auth0|666c39a8b281fda9ff9699e9",
"username": "test user 5",
"created_at": "2024-07-22T17:09:51.521370+00:00",
"updated_at": null,
"studyset": "hQFjozWL9v8Q",
"notes": [],
"source": null,
"source_id": null,
"source_updated_at": null,
"note_keys": {
"included": "boolean"
},
"metadata": null,
"name": "Annotation for studyset hQFjozWL9v8Q",
"description": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"id": "DVwyM6Qg5iaw",
"user": "auth0|666c39a8b281fda9ff9699e9",
"username": "test user 5",
"created_at": "2024-07-22T17:09:51.521370+00:00",
"updated_at": null,
"studyset": "hQFjozWL9v8Q",
"notes": [],
"source": null,
"source_id": null,
"source_updated_at": null,
"note_keys": {
"included": "boolean"
},
"metadata": null,
"name": "Annotation for studyset hQFjozWL9v8Q",
"description": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[
{
"id": "CtGJ5aaN5AeK",
"user": "auth0|666c39a8b281fda9ff9699e9",
"username": "test user 5",
"created_at": "2024-07-22T17:09:51.627184+00:00",
"updated_at": null,
"metadata": null,
"versions": [
{
"id": "ZR6H8F6c2aKX",
"user": "auth0|666c39a8b281fda9ff9699e9",
"username": "test user 5",
"created_at": "2024-07-22T17:09:51.627184+00:00",
"updated_at": null,
"source": null
}
],
"name": "New study",
"description": "",
"publication": "",
"doi": null,
"pmid": null,
"pmcid": null,
"authors": "",
"year": 0,
"level": "group"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"created_at": "2024-07-22T17:06:27.161543+00:00",
"description": "",
"draft": true,
"id": "5uEqnaad4Hfe",
"meta_analyses": [],
"name": "Untitled",
"neurostore_study": {
"created_at": "2024-07-22T17:06:27.172187+00:00",
"exception": null,
"neurostore_id": "teTeQPRAe7E5",
"status": "PENDING",
"traceback": null,
"updated_at": "2024-07-22T17:06:27.177339+00:00"
},
"neurostore_url": "https://neurostore.org/api/studies/teTeQPRAe7E5",
"provenance": {
"curationMetadata": {
"columns": [
{
"id": "0ac133d9-f994-434e-9d93-352f40e7d266",
"name": "not included",
"stubStudies": []
},
{
"id": "38eec6d4-4c07-4a11-aff9-afe2de91116e",
"name": "included",
"stubStudies": [
{
"abstractText": "",
"articleLink": "",
"articleYear": "",
"authors": "",
"doi": "",
"exclusionTag": null,
"id": "c70a3df6-dd10-4789-b3f3-41743061fb6f",
"identificationSource": {
"id": "neurosynth_pubmed_id_source",
"label": "PubMed"
},
"journal": "",
"keywords": "",
"pmcid": "",
"pmid": "",
"tags": [
{
"id": "a71d283c-fb05-496d-a005-551cdfe3cd8e",
"isAssignable": true,
"isExclusionTag": false,
"label": "MANUAL_CREATE-2024-07-22T17:09:16.238Z"
}
],
"title": "New study"
}
]
}
],
"exclusionTags": [
{
"id": "neurosynth_exclude_exclusion",
"isAssignable": true,
"isExclusionTag": true,
"label": "Exclude"
},
{
"id": "neurosynth_duplicate_exclusion",
"isAssignable": true,
"isExclusionTag": true,
"label": "Duplicate"
}
],
"identificationSources": [
{
"id": "neurosynth_neurostore_id_source",
"label": "Neurostore"
},
{
"id": "neurosynth_pubmed_id_source",
"label": "PubMed"
},
{
"id": "neurosynth_scopus_id_source",
"label": "Scopus"
},
{
"id": "neurosynth_web_of_science_id_source",
"label": "Web of Science"
},
{
"id": "neurosynth_psycinfo_id_source",
"label": "PsycInfo"
},
{
"id": "neurosynth_sleuth_id_source",
"label": "Sleuth"
}
],
"infoTags": [
{
"id": "neurosynth_untagged_tag",
"isAssignable": false,
"isExclusionTag": false,
"label": "Untagged studies"
},
{
"id": "neurosynth_uncategorized_tag",
"isAssignable": false,
"isExclusionTag": false,
"label": "Uncategorized Studies"
},
{
"id": "neurosynth_needs_review_tag",
"isAssignable": false,
"isExclusionTag": false,
"label": "Needs Review"
},
{
"id": "a71d283c-fb05-496d-a005-551cdfe3cd8e",
"isAssignable": true,
"isExclusionTag": false,
"label": "MANUAL_CREATE-2024-07-22T17:09:16.238Z"
}
],
"prismaConfig": {
"eligibility": {
"exclusionTags": []
},
"identification": {
"exclusionTags": []
},
"isPrisma": false,
"screening": {
"exclusionTags": []
}
}
},
"extractionMetadata": {
"studyStatusList": []
},
"metaAnalysisMetadata": {
"canEditMetaAnalyses": false
}
},
"public": true,
"updated_at": "2024-07-22T17:09:24.932504+00:00",
"user": "auth0|62e0e6c9dd47048572613b4d",
"username": "test user 5"
}
Loading

0 comments on commit c5584d2

Please sign in to comment.