DEpt-metagenom / MetagenoMongo

1 stars 2 forks source link

Run_date should not be a required field #36

Open haalasz opened 1 month ago

haalasz commented 1 month ago

When adding samples to MongoDB, not every sample is sequenced immediately, meaning some entries only have a collection_date without a run_date. Currently, the app does not allow saving a table if the run_date column is empty, which is problematic for these cases.

When attempting to save a table with missing run_date values, the following error message appears, preventing the user from saving the table:

["Number of cells with invalid date: 3\nInvalid value in row 1, column 'run_date': Expected data type: date\nInvalid value in row 2, column 'run_date': Expected data type: date\nInvalid value in row 3, column 'run_date': Expected data type: date"] [] 

The app should allow saving tables even if the run_date field is empty, as some samples will not have sequencing data available immediately. This information will be provided later as part of a data update.

gpetho commented 1 month ago

@iwmstjp Right, this is a good point that I didn't think about. Data type validation should in general be separated from the validation of whether a required field is present. So if a required field is left empty, then we want an error message saying this. If a field (whether required or not) is filled in but not with data of the right type, then we want a different error message that says that the data in the field is not the right type. The data type of fields that are left empty should not be checked.

gpetho commented 1 month ago

@haalasz I understand run_date, but why is this is a collection_date issue (as it says in the title)?

haalasz commented 1 month ago

@haalasz I understand run_date, but why is this is a collection_date issue (as it says in the title)?

Feel free to edit the title. The title is just a summary of the issue itself, it is just a run_date error.

gpetho commented 1 month ago

Feel free to edit the title. The title is just a summary of the issue itself, it is just a run_date error.

Okay, I wasn't sure whether something had been left out of the issue description or the title did not identify the bug specifically. I have modified the title.

iwmstjp commented 1 month ago

I solved this part by the following commit. 93f29e1f9437e211e689d44201e5a9744e7f83f4