Skip to content

Commit 0b28ba8

Browse files
committed
make sure probe insertion id is not overwritten on partial update
1 parent 634e9db commit 0b28ba8

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

ibllib/oneibl/patcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def _patch_dataset(self, path, dset_id=None, revision=None, dry=False, ftp=False
115115
assert is_uuid_string(dset_id)
116116
# If the revision is not None then we need to add the revision into the path. Note the moving of the file
117117
# is handled by one registration client
118-
if revision is not None:
118+
if revision is not None and f'#{revision}' not in str(path):
119119
path = path.parent.joinpath(f'#{revision}#', path.name)
120120
assert path.exists()
121121
dset = self.one.alyx.rest('datasets', 'read', id=dset_id)

ibllib/pipes/histology.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,10 @@ def create_trajectory_dict(probe_id, insertion, provenance, endpoint='insertions
391391
}
392392
if endpoint == 'chronic-insertions':
393393
tdict['chronic_insertion'] = probe_id
394+
tdict['probe_insertion'] = None
394395
else:
395396
tdict['probe_insertion'] = probe_id
397+
tdict['chronic_insertion'] = None
396398

397399
return tdict
398400

ibllib/qc/alignment_qc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def upload_channels(self, alignment_key, upload_alyx, upload_flatiron):
316316
ephys_traj = self.one.alyx.get(f'/trajectories?&probe_insertion={self.eid}'
317317
'&provenance=Ephys aligned histology track',
318318
clobber=True)
319-
patch_dict = {'json': self.alignments}
319+
patch_dict = {'probe_insertion': self.eid, 'json': self.alignments}
320320
self.one.alyx.rest('trajectories', 'partial_update', id=ephys_traj[0]['id'],
321321
data=patch_dict)
322322

ibllib/tests/qc/test_alignment_qc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ def _02_one_alignment(self):
186186
self.alignments['2020-06-26T16:40:14_Karolina_Socha']}
187187
trajectory = copy.deepcopy(self.trajectory)
188188
trajectory.update({'json': alignments})
189+
trajectory.update({'chronic_insertion': None})
189190
_ = one.alyx.rest('trajectories', 'create', data=trajectory)
190191
align_qc = AlignmentQC(self.probe_id, one=one, brain_atlas=brain_atlas, channels=False)
191192
align_qc.run(update=True, upload_alyx=True, upload_flatiron=False)
@@ -277,6 +278,7 @@ def setUpClass(cls) -> None:
277278
cls.probe_id = probe_insertion['id']
278279
cls.trajectory = data['trajectory'].tolist()
279280
cls.trajectory.update({'probe_insertion': cls.probe_id})
281+
cls.trajectory.update({'chronic_insertion': None})
280282
cls.trajectory.update({'json': cls.alignments})
281283
cls.traj = one.alyx.rest('trajectories', 'create', data=cls.trajectory)
282284

@@ -415,6 +417,7 @@ def setUpClass(cls) -> None:
415417
cls.probe_name = probe_insertion['name']
416418
cls.trajectory = data['trajectory'].tolist()
417419
cls.trajectory.update({'probe_insertion': cls.probe_id})
420+
cls.trajectory.update({'chronic_insertion': None})
418421
cls.trajectory.update({'json': cls.alignments})
419422
cls.traj = one.alyx.rest('trajectories', 'create', data=cls.trajectory)
420423

0 commit comments

Comments
 (0)