ESapenaVentura / biobroker

https://biobroker.readthedocs.io/en/latest/
GNU General Public License v3.0
0 stars 0 forks source link

Investigate if pydantic would be useful for metadata validation #20

Open ESapenaVentura opened 1 day ago

ESapenaVentura commented 1 day ago

Currently, each subclass of metadata_entity defines a validate method.

This could be simplified by using pydantic, passing a subclass of BaseModel, but it would imply to define a data model per each new metadata entity

Is it worth it?

So far I can think of pros and cons:

Pros:

Cons:

ESapenaVentura commented 1 day ago

Let's set up a branch with this refactoring and decide

ESapenaVentura commented 17 hours ago

I am liking what I see so far - I can replace the validation functions specific to each metadata entity for future expansions (e.g. for EnaSubmissions) by creating the models. Also the validation functions allow for value refactoring, which I find it pretty useful for e.g. dates.

Now I can also provide with a Notebook on how to validate your own samples against checklists not in BSD! pretty cool