Auerbach-Lab/Behavior-autoanalysis

Shiny not renaming

Opened this issue · 5 comments

Shiny is not renaming files with the manually entered rat name. It instead keeps the file name.

Its possible I misunderstood how name conflicts would be handled. I thought that the manually entered name would be used to overwrite the name pulled from the file.

To reproduce:
Use attached files from 7/27/23 in which Red 3 was run in Red 4's box. In the attached files, the one labeled:
Red3_gap_60dB_1-100ms_12s_20230727-111819_BOX#002.mat should be for Red4
Not renaming.zip
Input 'Red3' to the 'Rat Name' field.
Weight: 48, comments: None
Load the "Red3_gap_60dB_1-100ms_12s_20230727-111819_BOX#002.mat"
It should warn that the names don't match.
Proceed with the analysis and the console in Rstudio will say that the file in loaded in the enviornment is for Red 4 (#254)

For Red 4: weight should be 434

tofof commented

Input 'Red3' to the 'Rat Name' field.
Load the "Red3_gap_60dB_1-100ms_12s_20230727-111819_BOX#002.mat"
It should warn that the names don't match.

So, red3 is the provided rat name and red3 is the provided filename? So the names DO match, so it should NOT warn that they don't.

Its possible I misunderstood how name conflicts would be handled.

That is not what is happening here. There is no name conflict here.

Note that file contents do not provide the rat name. The .mat file does not specify which of the 4 boxes mentioned inside it actually corresponds to the file's contents. As such, rat name has always depended strictly on file name.

Shiny is not renaming files

Files are never renamed by shiny, I don't know where you got the idea they ever were. No input file is ever altered in any way by any part of the entire PiedPiper stack, nor should it ever be.

PiedPiper should not be expected to be infallible - you do not want it to go deliberately rewriting your data.

I thought that the manually entered name would be used to overwrite the name pulled from the file.

That is not the implemented behavior, no. The pre-shiny PiedPiper has only the filename to go on, so it can only check that the rat name mentioned in the filename is also in the rat archive. It cannot do further validation. Shiny sits on top of that and provides a check of filename and entered name -- the intention is to guard against the wrong file being loaded by the user. The name check is not intended to do anything about a malformed file.

Don't ever feed known-bad information to a program and expect good behavior - of piedpiper or any other tool.

tofof commented

It's possible that the best behavior is for shiny to disable the analyze button while a name conflict remains. That would force the desired behavior, which is that the user should rename the input .mat data file to reflect reality.

Fixing incorrect submission on report:

Weight: 48 481, comments: None
Load the "Red3 Red4_gap_60dB_1-100ms_12s_20230727-111818_BOX#001.mat"

I misunderstood the expected behavior. During design at one point we discussed how to handle name conflicts and clearly I did not remember what was ultimately built into the system. It would be better if the system did not allow the user to proceed with a name miss-match since the user does not have any expectation which name the system will use going forward.

Desired behavior:
When names don't match, do not offer the 'analyze' button.

Solution for filename vs. actual rat miss-match:
Rename the .mat file

tofof commented

This is not wontfix, you said you want the following fix:

It's possible that the best behavior is for shiny to disable the analyze button while a name conflict remains. That would force the desired behavior, which is that the user should rename the input .mat data file to reflect reality.