Skip to content

Commit

Permalink
Added to the JSON output file
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanaem committed Oct 25, 2023
1 parent c5990af commit ba5cb85
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const state = () => ({

categories: {

"Subject ID": {},
"Participant ID": {},
"Age": {

componentName: "annot-continuous-values",
Expand Down Expand Up @@ -89,7 +89,7 @@ export const state = () => ({

categoryToColorMap: {

"Subject ID": "color1",
"Participant ID": "color1",
"Age": "color2",
"Sex": "color3",
"Diagnosis": "color4",
Expand All @@ -98,7 +98,7 @@ export const state = () => ({

categoryClasses: {

"Subject ID": "category-style-1",
"Participant ID": "category-style-1",
"Age": "category-style-2",
"Sex": "category-style-3",
"Diagnosis": "category-style-4",
Expand Down Expand Up @@ -439,6 +439,19 @@ export const getters = {

columnOutput = p_getters.getContinuousJsonOutput(columnName);
break;

default:
columnOutput = {
"Description": "A participant ID",
Annotations: {

IsAbout: {
Label: "Subject Unique Identifier",
TermURL: "nb:ParticipantID"
},
Identifies: "participant"
}
};
}

}
Expand Down Expand Up @@ -638,23 +651,23 @@ export const getters = {

case "annotation": {

// 1. Make sure one (and only one) column has been categorized as 'Subject ID'
// 1. Make sure one (and only one) column has been categorized as 'Participant ID'
const singleSubjectIDColumn = ( 1 === Object.values(p_state.columnToCategoryMap)
.filter(category => "Subject ID" === category)
.filter(category => "Participant ID" === category)
.length );

// 2. Make sure at least one other category other than 'Subject ID' has been linked to a column
// 2. Make sure at least one other category other than 'Participant ID' has been linked to a column
const notOnlySubjectIDCategorized = ( Object.values(p_state.columnToCategoryMap)
.filter(category => "Subject ID" !== category &&
.filter(category => "Participant ID" !== category &&
null !== category)
.length >= 1 );

// 3. Make sure all columns about assessment tools are mapped to something
const allAssessmentColumnsAreMapped = p_getters.getColumnsForCategory("Assessment Tool")
.every(column => p_state.columnToToolMap[column] !== null);
// Annotation page is only accessible if one (and only one)
// column has been categorized as 'Subject ID' and if at least
// one category other than Subject ID has been categorized
// column has been categorized as 'Participant ID' and if at least
// one category other than Participant ID has been categorized
pageAccessible = singleSubjectIDColumn && notOnlySubjectIDCategorized && allAssessmentColumnsAreMapped;

break;
Expand Down Expand Up @@ -722,6 +735,12 @@ export const mutations = {
// NOTE: The latter are initialized here to eliminate checks for their
// nullness in other store functions
switch ( p_state.columnToCategoryMap[columnName] ) {
case "Participant ID":
p_state.dataDictionary.annotated[columnName] = Object.assign(
{},
p_state.dataDictionary.userProvided[columnName]
);
break;

case "Age":

Expand Down

0 comments on commit ba5cb85

Please sign in to comment.