From 9303c499e9c95107bbda4f8abe268bcb384d4175 Mon Sep 17 00:00:00 2001 From: Florian Rau Date: Thu, 5 Dec 2024 13:18:49 +0000 Subject: [PATCH 1/3] Update registration.py --- ibllib/oneibl/registration.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ibllib/oneibl/registration.py b/ibllib/oneibl/registration.py index 48767628e..74ca59de7 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: From 93cc4459ca4aaba84b33c5672a8baa2cee58d6ba Mon Sep 17 00:00:00 2001 From: Florian Rau Date: Thu, 5 Dec 2024 13:22:54 +0000 Subject: [PATCH 2/3] release notes --- ibllib/__init__.py | 2 +- release_notes.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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/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 From 21dce81e424f72984c00561019b11ca5ce4873fc Mon Sep 17 00:00:00 2001 From: Florian Rau Date: Thu, 5 Dec 2024 14:18:25 +0000 Subject: [PATCH 3/3] flake --- ibllib/oneibl/registration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibllib/oneibl/registration.py b/ibllib/oneibl/registration.py index 74ca59de7..c5dc71553 100644 --- a/ibllib/oneibl/registration.py +++ b/ibllib/oneibl/registration.py @@ -226,7 +226,7 @@ def register_session(self, ses_path, file_list=True, projects=None, procedures=N with narrative_file.open('r') as f: narrative = f.read() else: - narrative = '' + narrative = '' # query Alyx endpoints for subject, error if not found subject = self.assert_exists(subject, 'subjects')