znamlab / flexiznam

Znam lab tool to interact with flexilims
https://flexiznam.znamlab.org/
MIT License
0 stars 0 forks source link

Dataset.update_flexilims does not ensure JSON compatibility #88

Closed ablot closed 1 year ago

ablot commented 2 years ago

Setting extra attributes to some non JSON value triggers crash. Clean or give the option to clean

ablot commented 1 year ago

Same for post

For instance json fields cannot contain dots. This happened for csv file dictionnary:

 harpmessage:
    attributes:
      binary_file: harpmessage.bin
      csv_files:
        FrameLog: FrameLog.csv
        NewParams: NewParams.csv
        PZAH8.2f_S20221206_R170430_Retinotopy_Motion_00001: PZAH8.2f_S20221206_R170430_Retinotopy_Motion_00001.csv

The dot in PZAH8.2f is an issue.

Catch error with invalid bson, see if it can be automatically fixed or at least try to explain what the error is. Maybe parse yaml for such errors beforehand?

ablot commented 1 year ago

Fixed in 77fef92

ablot commented 1 year ago

Actually it's more complex. There are more restriction on filed names of MongoDB than json (dots for instance) https://www.mongodb.com/docs/manual/reference/limits/#Restrictions-on-Field-Names

For now remove all but dot and keep that open. Let's look more precisely if it creeps up again.

ablot commented 1 year ago

That should be mostly fixed. There can be issue remaining if someone tries to upload any other object but that might warrant another issue if it becomes annoying