diff --git a/ibllib/__init__.py b/ibllib/__init__.py index 0ab006529..3525165e1 100644 --- a/ibllib/__init__.py +++ b/ibllib/__init__.py @@ -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 diff --git a/ibllib/oneibl/registration.py b/ibllib/oneibl/registration.py index 48767628e..c5dc71553 100644 --- a/ibllib/oneibl/registration.py +++ b/ibllib/oneibl/registration.py @@ -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') @@ -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_) @@ -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: diff --git a/release_notes.md b/release_notes.md index 8ef197b7a..e2eb6ce78 100644 --- a/release_notes.md +++ b/release_notes.md @@ -1,3 +1,8 @@ +## Release Note 3.1.0 + +### features +- Add narrative during registration of Bpod session + ## Release Note 3.0.0 ### features