Corpus validation after all fields are added #1333
Labels
backend
changes to the django backend
corpus
changes to corpus definitions or new corpora
enhancement
improvements to user functionality
Is your feature request related to a problem? Please describe.
We recently added a LOT of validation for corpora, which is nice. But some requirements for fields can't be validated because you need to be sure all fields have been added. For example, this docstring suggests that there must be an 'id' field ,but that is never enforced:
https://github.com/UUDigitalHumanitieslab/I-analyzer/blob/9224528af4a435b84d8708fdad422eb8f2980ac9/backend/addcorpus/corpus.py#L109
There are some similar requirements, like how each corpus should at least have one
text_content
field.We can't validate this at the moment, because you need to save the
CorpusConfiguration
in the databse before you can add fields to it. You also can't add this to field validation, because fields are saved one by one.This also applies to #982 - a user should be able to save their "working version" of a corpus before they have added every single field.
Describe the solution you'd like
Perhaps we can add a second validation method that isn't run when saving the model, but is run when you want to index the corpus or include it in the interface. So you can save a corpus without an ID field, but I-analyzer will consider it a draft and refuse to include it in the interface.
The text was updated successfully, but these errors were encountered: