From 22403fb37d57b50de399ea6972f9980232674601 Mon Sep 17 00:00:00 2001 From: Sebastian Urchs Date: Wed, 10 Apr 2024 10:09:15 -0400 Subject: [PATCH 1/4] Add a warning about limitations for data dictionary --- cypress/component/home_page.cy.js | 11 +++++++++++ pages/home.vue | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/cypress/component/home_page.cy.js b/cypress/component/home_page.cy.js index 5fc0bc39..40d0ef8f 100644 --- a/cypress/component/home_page.cy.js +++ b/cypress/component/home_page.cy.js @@ -41,6 +41,17 @@ describe("The Home page", () => { cy.get("[data-cy='data-dictionary-selector']").should("be.visible").contains("Choose file"); }); + it("Shows a warning about not being able to reuse annotations in the data dictionary", () => { + cy.mount(homePage, { + + mocks: { $store: store }, + stubs: stubs, + plugins: ["bootstrap-vue"] + }); + + cy.get("[data-cy='cannot-reuse-annotations-button']").should('be.visible').contains("Cannot reuse annotations"); + }); + it("Correctly displays previews of the loaded data", () => { // Act diff --git a/pages/home.vue b/pages/home.vue index 7ac98f4c..bbf8444a 100644 --- a/pages/home.vue +++ b/pages/home.vue @@ -71,6 +71,16 @@

{{ uiText.dataDictionaryHeader }}

+ Cannot reuse annotations + +
+ At the moment, the annotation tool is not able to load previously created annotations. + This means thart if you provide a data dictionary here that you created with Neurobagel, + any existing semantic annotations will be removed when the data dictionary is loaded. + + In practice this means that you cannot resume an aborted previous annotation. + This is a limitation we are going to address: #601. +
Date: Wed, 10 Apr 2024 10:43:06 -0400 Subject: [PATCH 2/4] Remove annotations This step does not have a test because the corresponding store method never received one ... --- store/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/store/index.js b/store/index.js index aa32e6f4..b0e6b732 100644 --- a/store/index.js +++ b/store/index.js @@ -682,10 +682,14 @@ export const actions = { processDataDictionary({ state, commit, getters }, { data, filename }) { - // 1. Save the user-provided data dictionary - commit("setDataDictionary", { newDataDictionary: JSON.parse(data), storeColumns: getters.getColumnNames }); + // If annotations exist in the provided data, remove them first + const userDataDictionary = JSON.parse(data); - // 2. Save the filename of the user-provided data dictionary + Object.keys(userDataDictionary).forEach(key => { + delete userDataDictionary[key].Annotations; + }); + + commit("setDataDictionary", { newDataDictionary: userDataDictionary, storeColumns: getters.getColumnNames }); commit("setDataDictionaryFilename", filename); }, From 5443d18ff3845d1ead0f7649382f54c29ab81ee8 Mon Sep 17 00:00:00 2001 From: Sebastian Urchs Date: Mon, 15 Apr 2024 11:17:26 -0400 Subject: [PATCH 3/4] Update pages/home.vue Co-authored-by: Arman Jahanpour <77515879+rmanaem@users.noreply.github.com> --- pages/home.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/home.vue b/pages/home.vue index bbf8444a..2ae62692 100644 --- a/pages/home.vue +++ b/pages/home.vue @@ -75,7 +75,7 @@
At the moment, the annotation tool is not able to load previously created annotations. - This means thart if you provide a data dictionary here that you created with Neurobagel, + This means that if you provide a data dictionary here that you created with Neurobagel, any existing semantic annotations will be removed when the data dictionary is loaded. In practice this means that you cannot resume an aborted previous annotation. From f809776f4ebc18bedc9c04c6f087a37f1036ab60 Mon Sep 17 00:00:00 2001 From: Sebastian Urchs Date: Mon, 15 Apr 2024 13:32:26 -0400 Subject: [PATCH 4/4] [FIX] Missed updates --- components/annot-explanation.vue | 8 +++++--- components/tool-navbar.vue | 4 +++- cypress/component/home_page.cy.js | 1 + cypress/e2e/page/index-pagetests.cy.js | 22 ++++++++++++++++++++++ pages/home.vue | 13 +++++++++---- 5 files changed, 40 insertions(+), 8 deletions(-) diff --git a/components/annot-explanation.vue b/components/annot-explanation.vue index abe54b41..36a2e384 100644 --- a/components/annot-explanation.vue +++ b/components/annot-explanation.vue @@ -7,11 +7,13 @@ {{ uiText.cardTitle }} -
    -
  • + +
      +
    • {{ sentence }}.
    • -
    +
+
diff --git a/components/tool-navbar.vue b/components/tool-navbar.vue index 11502d8e..fb0dc070 100644 --- a/components/tool-navbar.vue +++ b/components/tool-navbar.vue @@ -13,7 +13,9 @@ alt="Neurobagel Logo" class="nav-logo" />