cnr-ibba/IMAGE-InjectTool

Better model relationship objects and validation

Closed this issue · 1 comments

bunop commented

Is your feature request related to a problem? Please describe.
Last image_validation update has stuff to validate relationship between objects. Moreover image_app.models.Animals can't deal with parents (that are relationship)

Describe the solution you'd like
Model relationship between animals and try to check them in validation

Describe alternatives you've considered
I could ignore this, but I plan to model animal relationship. So is time to face it and with its validation. Since data are submitted to test server, I need to deal with temporary urls

Additional context

  • model relationship between animal in image_app.models.Animal.to_biosample()
  • set temporary urls for context validation (remember to change them in production)
  • update validate.helpers.MetaDataValidation to check relationship
  • setup tests (with biosample mock) and keep coverage nearly the same
  • call check ruleset during MetaDataValidation setUp
  • Define custom exception for check_ruleset fail. Submit a mail to user (or admins ?)
  • catch exceptions from image_validation context validation
  • try to do a real submission to biosample

Some context validations already exist in the Validation Tool:
child and parents from the same species
parents could not be more than 2
two parents must have different sex (Unknown sex will raise a warning)