Skip to content

Commit

Permalink
Dataset name & npm start-server process
Browse files Browse the repository at this point in the history
  • Loading branch information
laemtl committed Oct 18, 2021
1 parent cac627e commit d1ee1aa
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 54 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion python/libs/Modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down
96 changes: 48 additions & 48 deletions src/jsx/Configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const Configuration = (props) => {
taskName: '',
reference: 'n/a',
recordingType: 'n/a',
participantEntryMode: 'manual',
participantEntryMode: 'existing_loris',
participantPSCID: '',
participantCandID: '',
participantID: '',
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(<div key='taskNameStatus'>{taskNameStatus}</div>);

Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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};
Expand All @@ -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 = '';
Expand Down Expand Up @@ -1379,7 +1377,7 @@ const Configuration = (props) => {
<div className='small-pad'>
<RadioInput id='modality'
name='modality'
label='Data modality'
label='Data Modality'
required={true}
onUserInput={onUserInput}
options={{
Expand Down Expand Up @@ -1427,7 +1425,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
Expand Down Expand Up @@ -1496,9 +1494,10 @@ const Configuration = (props) => {
<TextInput id='taskName'
name='taskName'
required={true}
label='Task name'
label='Task Name'
value={state.taskName.get}
onUserInput={onUserInput}
bannedCharacters={['-', '_', ' ', '/']}
help='Task, stimulus, state or experimental context.
See BIDS specification for more information.'
/>
Expand Down Expand Up @@ -1631,7 +1630,7 @@ const Configuration = (props) => {
label=''
required={!state.LORIScompliant.get}
value={state.session.get}
bannedCharacters={['-', '_', ' ']}
bannedCharacters={['-', '_', ' ', '/']}
onUserInput={onUserInput}
/>
}
Expand All @@ -1652,7 +1651,7 @@ const Configuration = (props) => {
<div className='small-pad'>
<SelectInput id='lineFreq'
name='lineFreq'
label='Powerline frequency'
label='Powerline Frequency'
value={state.lineFreq.get}
emptyOption='n/a'
options={{
Expand Down Expand Up @@ -1801,6 +1800,7 @@ const Configuration = (props) => {
required={true}
value={state.participantID.get}
onUserInput={onUserInput}
bannedCharacters={['-', '_', ' ', '/']}
help='Study ID (e.g. LORIS PSCID)'
/>
{state.LORIScompliant.get &&
Expand Down
4 changes: 3 additions & 1 deletion src/jsx/Welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ const Welcome = (props) => {
<li>Compress the BIDS output folder</li>
</ul>
<p>
- Important - Please back up your data before beginning.
- Important - Please back up your data before beginning. <br/>
You may wish to edit the dataset_description.json
after generating your BIDS dataset.
</p>
</div>
<div>
Expand Down
6 changes: 6 additions & 0 deletions start-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

python3 -m venv python
source python/bin/activate
pip install -r requirements.txt
python -m python.eeg2bids
5 changes: 1 addition & 4 deletions wiki/ubuntu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down

0 comments on commit d1ee1aa

Please sign in to comment.