From 9ce6126dc3fb02c6158f8af1a5009869d7f774e7 Mon Sep 17 00:00:00 2001 From: Arman Jahanpour <77515879+rmanaem@users.noreply.github.com> Date: Wed, 25 Oct 2023 17:29:29 -0400 Subject: [PATCH] [ENH] Added `Subject ID/Participant ID` to JSON output file (#584) * Added `participant_id` to the JSON output file * Expanded `download-pagetests` to check for `identifies` property and its value under the `participant_id` key --- cypress/e2e/page/download-pagetests.cy.js | 5 +++++ store/index.js | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/cypress/e2e/page/download-pagetests.cy.js b/cypress/e2e/page/download-pagetests.cy.js index f0382abc..040eebe9 100644 --- a/cypress/e2e/page/download-pagetests.cy.js +++ b/cypress/e2e/page/download-pagetests.cy.js @@ -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"); + }); }); }); }); diff --git a/store/index.js b/store/index.js index f9e63746..b7d53adc 100644 --- a/store/index.js +++ b/store/index.js @@ -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" + } + }; } } @@ -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":