Skip to content

Commit

Permalink
[ENH] Add session ID as a new category for annotation (#675)
Browse files Browse the repository at this point in the history
* Recklessly add session id

no safeguards, no tests

* Bring the tests and come back to safety
  • Loading branch information
surchs authored Jan 17, 2024
1 parent 6fdd3c3 commit 85329cf
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
6 changes: 6 additions & 0 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
color: white !important;
}

.category-style-6 {

background-color: rgb(23, 155, 207) !important;
color: black !important;
}

.category-style-default {

background-color: white;
Expand Down
34 changes: 34 additions & 0 deletions cypress/e2e/page/categorization-pagetests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,40 @@ describe("Tests on categorization page ui via programmatic state loading and sto
.should("not.have.css", "background-color", p_oldColor);
});
});

it.only("doesn't enable the next button until something other than Subject ID or Session ID is clicked", () => {
// Note: skipping the fancy test dataset handling since we only have one test dataset
cy.assertNextPageAccess("annotation", false);

cy.get("[data-cy='categorization-table']")
.contains("Subject ID")
.click();
cy.get("[data-cy='column-linking-table'] tbody > tr > td")
.contains("participant_id")
.click();

// Still expect the next page to be inaccessible
cy.assertNextPageAccess("annotation", false);

cy.get("[data-cy='categorization-table']")
.contains("Session ID")
.click();
cy.get("[data-cy='column-linking-table'] tbody > tr > td")
.contains("age") // TODO: eventually find a good column for this stuff
.click();

// Still expect the next page to be inaccessible
cy.assertNextPageAccess("annotation", false);

cy.get("[data-cy='categorization-table']")
.contains("Sex")
.click();
cy.get("[data-cy='column-linking-table'] tbody > tr > td")
.contains("sex") // TODO: eventually find a good column for this stuff
.click();

cy.assertNextPageAccess("annotation", true);
});
});
});
});
2 changes: 1 addition & 1 deletion pages/annotation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
return {
categorySkipList: ["Subject ID"],
categorySkipList: ["Subject ID", "Session ID"],
tabNavTitle: 0
};
},
Expand Down
22 changes: 22 additions & 0 deletions store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export const state = () => ({
// Added to be used as a case inside the switch statement of getJSONOutput
componentName: "participantID"
},
"Session ID": {
// Added to be used as a case inside the switch statement of getJSONOutput
componentName: "sessionID"
},
"Age": {

componentName: "annot-continuous-values",
Expand Down Expand Up @@ -69,12 +73,14 @@ export const state = () => ({
color3: "category-style-3",
color4: "category-style-4",
color5: "category-style-5",
color6: "category-style-6",
colorDefault: "category-style-default"
},

categoryToColorMap: {

"Subject ID": "color1",
"Session ID": "color6",
"Age": "color2",
"Sex": "color3",
"Diagnosis": "color4",
Expand All @@ -84,6 +90,7 @@ export const state = () => ({
categoryClasses: {

"Subject ID": "category-style-1",
"Session ID": "category-style-6",
"Age": "category-style-2",
"Sex": "category-style-3",
"Diagnosis": "category-style-4",
Expand Down Expand Up @@ -439,6 +446,20 @@ export const getters = {
};
break;

case "sessionID":
columnOutput = {
"Description": "A session ID",
Annotations: {

IsAbout: {
Label: "Session Unique Identifier",
TermURL: "nb:SessionID"
},
Identifies: "session"
}
};
break;

case "annot-tool-groups":
columnOutput = p_getters.getAssessmentToolJSONOutput(columnName);
break;
Expand Down Expand Up @@ -626,6 +647,7 @@ export const getters = {
// 2. Make sure at least one other category other than 'Subject ID' has been linked to a column
const notOnlySubjectIDCategorized = ( Object.values(p_state.columnToCategoryMap)
.filter(category => "Subject ID" !== category &&
"Session ID" !== category &&
null !== category)
.length >= 1 );

Expand Down

0 comments on commit 85329cf

Please sign in to comment.