Draft: Updating archive json based on changes from normalize method
If some changes are made to the quantities of an entry through its normalize
method, they are not updated in the archive.json
main file of the entry when reprocessing the upload.
For reproduction: I wrote a test section with a normalizer that modifies its quantities and a data file that can be dropped in the upload to create an entry.
Dropping the data file creates an entry with bool_quantity=True
and string_quantity="initialized"
.
Expected behavior: Upon processing the entry, the normalize method should modify these values to bool_quantity=False
and string_quantity="modified"
. But this doesn't happen. Can we fix this?
Some observations:
- While these modifications show up in the ELN, they are not updated in the
archive.json
file. If you try reprocessing the whole upload again (or multiple times), thearchive.json
is still not updated. This means that every time the upload is reprocessed the starting state of the quantities is the initialized one, never the modified one. - If you go inside the ELN, and trigger a reprocess from there (using the save button), the updates are reflected in the
archive.json
. So the updation only seems to work if reprocessing is triggered from inside the entry. - If you now change the states in the ELN to
bool_quantity=True
andstring_quantity="modified again"
and save the entry, the ELN will update tobool_quantity=False
andstring_quantity="modified"
based on the normalization, but thearchive.json
is updated tobool_quantity=True
andstring_quantity="modified again"
. So it seems that the state of the ELN before hitting save is what is updated in thearchive.json
. Modifications done by the normalizer are not saved.