Closed SiriChandanaGarimella closed 10 months ago
I can explain the data collection part of this issue. Users can enter in the measurements of animals for an experiment in the "data collection" page. The way that things are currently setup, the data is stored in CSV files that are individual to each experiment. However, we now want all of that data to be stored on the experiment files (aka the ones ending in .db/.mouser) in one form or another, ideally in a new table in the database.
@loganwyas - I tried to test the data-collection functionality, but I am getting an error. On debugging, I could see that currently the code in data_collection_database.py is commented out, and I uncommented it to better understand the functionality. I could see that a CSV file was generated in .\database_apis\fake_data with the data - Date, Animal ID, followed by measurement items data in a single row. But in both cases, I am getting the below error. As I debugged, I could see that an empty list [] is assigned to the animals variable in the line -> self.animals = self.database.get_animals(), which is passed as an argument to create the table in the line -> self.table = Treeview(self.table_frame, columns=columns, show='headings', selectmode="browse", height=len(self.animals)). I think this might be causing the issue.
So, if possible, please brief me on the actual functionality and expected behavior. I am available for a call as well if that works for you. Also, I guess the task related to CSV operations is a big chunk of work and can go as part of a separate PR. If you agree with this, I am happy to fix this as part of a new PR.
Error: .\Mouser\experiment_pages\data_collection_ui.py", line 76, in open_auto_increment_changer self.changing_value = self.table.get_children()[self.auto_inc_id]
IndexError: tuple index out of range
I believe the reason that an empty list is being returned is because there haven't been any animals added to the experiment yet. Animals are added under the "Map RFID" page on the experiment, and won't show up in the database until this is completed. This is something that will probably be changed in the future, but that's how it is right now.
If you feel that this will be too much work for this PR, please let me know. I've checked the other tasks and have confirmed completion, so this can be merged if necessary, and I'll create a new issue for the data collection stuff. You won't have to worry about handling that issue if that ends up being the case, as the capstone team will be more familiar with the codebase and can resolve it.
Hi @loganwyas, I feel creating a new issue for data collection is better as it requires more knowledge of the application. Please let me know if there are any changes needed for this PR to be merged. Thanks for your support.
Fixes #152
What was changed?
Did the following changes to fix the issue - "Any experiment files that are saved (when creating the experiment) or opened (from the menu bar) should be ".mouser" files, rather than ".db" files": a. In summary_ui.py -> save_to_database() - changed the file extension to .mouser instead of .db to save the created files as .mouser b. In main.py -> open_file() - changes are done to populate the .mouser files to the user for file selection during open_file()
Did the following changes to fix the issue "Passwords - Give users the option to set a password for their experiment:" a. In new_experiment_ui.py -> added the label Password next to the experiment name to provide an option to set a password for the experiment and sending to the setter method (set_password() in experiment.py) "Store the password in the experiment file as a hash (to prevent malicious activity):" a. Added a new file password_utils.py to handle file encryption and decryption with the password. b. In summary_ui.py -> save_to_database() - changes are done to add the condition to save the filename with a suffix as '_Protected' if the user provides the password during the creation of the file or else to save it as .mouser "Prompt users upon opening an experiment if that experiment requires a password" a. In main.py -> open_file() - changes are done to check if the filename is saved with the suffix '_Protected' and if so, a prompt for the password will be displayed. If the password is correct then the '*.mouser' file will open else an error prompt will be displayed.
Requirements 1,3,4 are completed and I need help in understanding the 2nd requirement of working with data collection.