diff --git a/package.json b/package.json index 807446d..26ee052 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "react-start": "cross-env BROWSER=NONE react-scripts start", "electron-start": "cross-env DEV=1 electron .", "start": "concurrently \"npm run react-start\" \"wait-on http://localhost:3000/ && npm run electron-start\"", + "start-server": "./start-server.sh", "react-build": "cross-env INLINE_RUNTIME_CHUNK=false react-scripts build", "pack": "electron-builder --dir -c.extraMetadata.main=build/electron.js", "electron-build-linux": "electron-builder --linux -c.extraMetadata.main=build/electron.js", diff --git a/python/libs/Modifier.py b/python/libs/Modifier.py index f2409c6..87c960a 100644 --- a/python/libs/Modifier.py +++ b/python/libs/Modifier.py @@ -28,7 +28,7 @@ def get_bids_root_path(self): ) def get_eeg_path(self, relative=False): - directory_path = 'sub-' + self.data['participantID'].replace('_', '').replace('-', '').replace(' ', '') + directory_path = 'sub-' + self.data['participantID'] if relative: return os.path.join( @@ -80,6 +80,7 @@ def modify_dataset_description_json(self): file_data = json.load(fp) file_data['PreparedBy'] = self.data['preparedBy'] file_data['Eeg2bidsVersion'] = self.data['appVersion'] + file_data['Name'] = self.data['participantID'] + '_' + self.data['session'] with open(file_path, "w") as fp: json.dump(file_data, fp, indent=4) diff --git a/src/jsx/Configuration.js b/src/jsx/Configuration.js index 232c391..cf3b6b1 100644 --- a/src/jsx/Configuration.js +++ b/src/jsx/Configuration.js @@ -76,7 +76,7 @@ const Configuration = (props) => { taskName: '', reference: 'n/a', recordingType: 'n/a', - participantEntryMode: 'manual', + participantEntryMode: 'existing_loris', participantPSCID: '', participantCandID: '', participantID: '', @@ -196,10 +196,12 @@ const Configuration = (props) => { }, [outputTime]); useEffect(() => { - if (isAuthenticated && state.LORIScompliant) { - state.participantEntryMode.set('new_loris'); + if (isAuthenticated && state.LORIScompliant.get) { + state.participantEntryMode.set('existing_loris'); + } else { + state.participantEntryMode.set('manual'); } - }, [state.LORIScompliant.get]); + }, [state.LORIScompliant.get, isAuthenticated]); /** * hideModal - display Modal. @@ -672,19 +674,22 @@ const Configuration = (props) => { let taskNameStatus = ''; const taskName = appContext.getFromTask('taskName'); if (taskName) { - if (taskName.indexOf('-') > -1 || + /* if (taskName.indexOf('-') > -1 || taskName.indexOf('_') > -1 || taskName.indexOf('/') > -1) { taskNameStatus = formatError( - 'Task name has invalid characters (-, /, _)', + 'Task Name has invalid characters (-, /, _)', ); } else { taskNameStatus = formatPass( - `Task name: ${appContext.getFromTask('taskName')}`, + `Task Name: ${appContext.getFromTask('taskName')}`, ); - } + } */ + taskNameStatus = formatPass( + `Task Name: ${appContext.getFromTask('taskName')}`, + ); } else { - taskNameStatus = formatError('Task name is not specified'); + taskNameStatus = formatError('Task Name is not specified'); } result.push(
{taskNameStatus}
); @@ -745,7 +750,7 @@ const Configuration = (props) => { let lineFreqStatus = ''; if (appContext.getFromTask('lineFreq')) { lineFreqStatus = formatPass( - `Powerline frequency: ${appContext.getFromTask('lineFreq')}`, + `Powerline Frequency: ${appContext.getFromTask('lineFreq')}`, ); } else { lineFreqStatus = formatWarning('Powerline frequency is not specified'); @@ -776,22 +781,28 @@ const Configuration = (props) => { // participantCandID let participantCandIDStatus = ''; - if (appContext.getFromTask('participantCandID')?.error) { + if (!appContext.getFromTask('participantPSCID')) { + participantPSCIDStatus = formatError( + 'LORIS PSCID is not specified', + ); + } else { + participantPSCIDStatus = formatPass( + `LORIS PSCID: ${state.participantPSCID.get}`, + ); + } + + if (!appContext.getFromTask('participantCandID')) { + participantCandIDStatus = formatError( + 'LORIS DCCID is not specified', + ); + } else if (appContext.getFromTask('participantCandID')?.error) { participantCandIDStatus = formatError( appContext.getFromTask('participantCandID').error, ); } else { - if (appContext.getFromTask('participantCandID')) { - participantCandIDStatus = formatPass( - `LORIS DCCID: ${state.participantCandID.get}`, - ); - } - - if (appContext.getFromTask('participantPSCID')) { - participantPSCIDStatus = formatPass( - `LORIS PSCID: ${state.participantPSCID.get}`, - ); - } + participantCandIDStatus = formatPass( + `LORIS DCCID: ${state.participantCandID.get}`, + ); } result.push( @@ -1166,6 +1177,14 @@ const Configuration = (props) => { // Update the state of Configuration. switch (name) { + case 'LORIScompliant': + if (value === 'yes') { + value = true; + } else { + value = false; + } + state.LORIScompliant.set(value); + break; case 'recordingID': state.edfData.set((prevState) => { return {...prevState, [name]: value}; @@ -1179,27 +1198,6 @@ const Configuration = (props) => { state.subjectID.set(value); appContext.setTask(name, value); break; - case 'participantEntryMode': - if (isAuthenticated === false) { - state.participantEntryMode.set('new_loris'); - } else { - state.participantEntryMode.set(value); - } - break; - case 'LORIScompliant': - if (value === 'yes') { - value = true; - if (isAuthenticated) { - state.participantEntryMode.set('new_loris'); - } else { - state.participantEntryMode.set('manual'); - } - } else { - value = false; - state.participantEntryMode.set('manual'); - } - state.LORIScompliant.set(value); - break; case 'siteID_API': if (value == 'Enter manually') { value = ''; @@ -1379,7 +1377,7 @@ const Configuration = (props) => {
{ (bidsMetadataFile) => bidsMetadataFile['name'], ).join(', ') } - label='Recording parameters (json)' + label='Recording Parameters (json)' onUserInput={onUserInput} help='Used to contribute non-required fields to *.json BIDS parameter file. See BIDS spec and template available with @@ -1496,9 +1494,10 @@ const Configuration = (props) => { @@ -1631,7 +1630,7 @@ const Configuration = (props) => { label='' required={!state.LORIScompliant.get} value={state.session.get} - bannedCharacters={['-', '_', ' ']} + bannedCharacters={['-', '_', ' ', '/']} onUserInput={onUserInput} /> } @@ -1652,7 +1651,7 @@ const Configuration = (props) => {
{ required={true} value={state.participantID.get} onUserInput={onUserInput} + bannedCharacters={['-', '_', ' ', '/']} help='Study ID (e.g. LORIS PSCID)' /> {state.LORIScompliant.get && diff --git a/src/jsx/Welcome.js b/src/jsx/Welcome.js index ad573ba..66ba935 100644 --- a/src/jsx/Welcome.js +++ b/src/jsx/Welcome.js @@ -110,7 +110,9 @@ const Welcome = (props) => {
  • Compress the BIDS output folder
  • - - Important - Please back up your data before beginning. + - Important - Please back up your data before beginning.
    + You may wish to edit the dataset_description.json + after generating your BIDS dataset.

    diff --git a/start-server.sh b/start-server.sh new file mode 100755 index 0000000..c46daf0 --- /dev/null +++ b/start-server.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +python3 -m venv python +source python/bin/activate +pip install -r requirements.txt +python -m python.eeg2bids diff --git a/wiki/ubuntu/README.md b/wiki/ubuntu/README.md index 68f4c87..d50e8f5 100644 --- a/wiki/ubuntu/README.md +++ b/wiki/ubuntu/README.md @@ -18,10 +18,7 @@ npm install npm run start # In another terminal inside project root type: sudo apt-get install python3-venv -python3 -m venv . -source bin/activate -pip install -r requirements.txt -python3 -m python.eeg2bids +npm run start-server ``` **Note:** Both the "python-service" & the "electron-app" need to be running simultaneously for EEG2BIDS Wizard to successfully function in development!