AllenNeuralDynamics / AllenNeuralDynamics/biodata-schema

Lists vs Dictionaries when using `List[Model]`

Đang mở
#57 13 bình luận 0 reaction 1 người được giao Được @dbirman nhận Xem trên GitHub
question
Ngôn ngữ chính
Python
Star
0
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

A common pattern in the current schema is to use a `List` of generic objects to keep track of such objects. For instance, cameras can be expressed as follows:

https://github.com/AllenNeuralDynamics/aind-data-schema/blob/c8aca0341d86efc82aa32ba0255b1f66287a4a3c/src/aind_data_schema/rig.py#L64C1

While easy to use, `List`s make grabbing a specific device somewhat difficult without parsing all objects since they must be indexed by the order (which can easily change across days) or the experimenter must generate somesort of keyed collection type with an unique key (e.g. device name).

I wonder if rather than using generic unsorted lists, it would be beneficial to simply use some sort of hashed dictionary structure in the form of `Dict[str, CameraAssembly]` instead of `List[CameraAssembly]`. This would make it much easier to access the objects after deserialization.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.