Skip to content

Commit

Permalink
[ENH] Added Subject ID/Participant ID to JSON output file (#584)
Browse files Browse the repository at this point in the history
* Added `participant_id` to the JSON output file

* Expanded `download-pagetests` to check for `identifies` property and its value

under the `participant_id` key
  • Loading branch information
rmanaem authored Oct 25, 2023
1 parent ea82ec2 commit 9ce6126
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cypress/e2e/page/download-pagetests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ describe("tests on download page ui via programmatic state loading and store int

expect(folderStateAfter[folderStateAfter.length - 1]).to.contain(dataDictionaryFilenameNoExt);
});
// C. Check if the last file retrieved contains the Identifies property and its value under the participant_id key
cy.readFile('cypress/downloads/' + folderStateAfter[folderStateAfter.length - 1]).then((fileContent) => {
expect(fileContent.participant_id.Annotations).to.have.property("Identifies");
expect(fileContent.participant_id.Annotations.Identifies).to.eq("participant");
});
});
});
});
Expand Down
19 changes: 19 additions & 0 deletions store/index.js
Original file line number Diff line number Diff line change
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 @@ -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 "Subject ID":
p_state.dataDictionary.annotated[columnName] = Object.assign(
{},
p_state.dataDictionary.userProvided[columnName]
);
break;

case "Age":

Expand Down

0 comments on commit 9ce6126

Please sign in to comment.