Skip to content

Commit

Permalink
Merge pull request #895 from int-brain-lab/feature/narrative
Browse files Browse the repository at this point in the history
feature/narrative
  • Loading branch information
bimac authored Dec 5, 2024
2 parents 4af1ab4 + 21dce81 commit 3c82b30
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ibllib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import warnings

__version__ = '3.0.0'
__version__ = '3.1.0'
warnings.filterwarnings('always', category=DeprecationWarning, module='ibllib')

# if this becomes a full-blown library we should let the logging configuration to the discretion of the dev
Expand Down
10 changes: 10 additions & 0 deletions ibllib/oneibl/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ def register_session(self, ses_path, file_list=True, projects=None, procedures=N
procedures = list({*experiment_description_file.get('procedures', []), *(procedures or [])})
collections = session_params.get_task_collection(experiment_description_file)

# Read narrative.txt
if (narrative_file := ses_path.joinpath('narrative.txt')).exists():
with narrative_file.open('r') as f:
narrative = f.read()
else:
narrative = ''

# query Alyx endpoints for subject, error if not found
subject = self.assert_exists(subject, 'subjects')

Expand Down Expand Up @@ -301,6 +308,7 @@ def register_session(self, ses_path, file_list=True, projects=None, procedures=N
'end_time': self.ensure_ISO8601(end_time) if end_time else None,
'n_correct_trials': n_correct_trials,
'n_trials': n_trials,
'narrative': narrative,
'json': json_field
}
session = self.one.alyx.rest('sessions', 'create', data=ses_)
Expand All @@ -316,6 +324,8 @@ def register_session(self, ses_path, file_list=True, projects=None, procedures=N
else: # if session exists update a few key fields
data = {'procedures': procedures, 'projects': projects,
'n_correct_trials': n_correct_trials, 'n_trials': n_trials}
if len(narrative) > 0:
data['narrative'] = narrative
if task_protocols:
data['task_protocol'] = '/'.join(task_protocols)
if end_time:
Expand Down
5 changes: 5 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Release Note 3.1.0

### features
- Add narrative during registration of Bpod session

## Release Note 3.0.0

### features
Expand Down

0 comments on commit 3c82b30

Please sign in to comment.