Open k1o0 opened 3 weeks ago
Somehow several session have two experiment description datasets: one with a collection as an empty string, and another as null, e.g.
eid 00b3ebb3-1ebb-4f98-a75e-64a2e974c266 2 122bf341-069b-43d2-a4cc-e7600907c832 2 36676aa1-58ad-49a4-aaea-0e93be0cdb93 2 b3685c31-d304-4dd7-af33-24258fbaf243 2
I'm uncertain how the dataset with the empty string was created as the created_by and version fields are null. Registering datasets via the RegisterFileViewSet means the collection field is never specifically set, rather it is extracted from the relative path of the dataset: https://github.com/cortex-lab/alyx/blob/857bcab39bd030e1cb00eeb8e6ed18dddac9ed5d/alyx/data/views.py#L570 This code should be modified to ensure the returned fields are consistent (always None or always ''). Likewise, the _create_dataset_file_records function should also consistently cast empty strings or None: https://github.com/cortex-lab/alyx/blob/857bcab39bd030e1cb00eeb8e6ed18dddac9ed5d/alyx/data/transfers.py#L245
Finally, the Django convention is to avoid using null on string-based fields. This should probably be followed in Alyx by setting null=False on these fields: https://github.com/cortex-lab/alyx/blob/master/alyx/data/models.py#L331
Returning str values instead of None makes constructing paths simpler, e.g. the following:
parts = (None, None, 'obj.attr.ext') # collection, revision, name path = Path.home().joinpath(*filter(None, parts))
becomes
path = Path.home().joinpath(*parts)
Somehow several session have two experiment description datasets: one with a collection as an empty string, and another as null, e.g.
I'm uncertain how the dataset with the empty string was created as the created_by and version fields are null. Registering datasets via the RegisterFileViewSet means the collection field is never specifically set, rather it is extracted from the relative path of the dataset: https://github.com/cortex-lab/alyx/blob/857bcab39bd030e1cb00eeb8e6ed18dddac9ed5d/alyx/data/views.py#L570 This code should be modified to ensure the returned fields are consistent (always None or always ''). Likewise, the _create_dataset_file_records function should also consistently cast empty strings or None: https://github.com/cortex-lab/alyx/blob/857bcab39bd030e1cb00eeb8e6ed18dddac9ed5d/alyx/data/transfers.py#L245
Finally, the Django convention is to avoid using null on string-based fields. This should probably be followed in Alyx by setting null=False on these fields: https://github.com/cortex-lab/alyx/blob/master/alyx/data/models.py#L331
Returning str values instead of None makes constructing paths simpler, e.g. the following:
becomes