cnr-ibba/IMAGE-InjectTool

Structure ZOOMA calls into InjectTool

Closed this issue · 3 comments

bunop commented

Is your feature request related to a problem? Please describe.
Zooma tasks are performed to fill-up dictionary tables. There are defined in InjectTool in zooma django application, in both helpers and tasks modules; however they have to be called manually using django management commands after a dictionary terms is added into database, for example:

docker-compose run --rm uwsgi python manage.py annotate_countries

Describe the solution you'd like
Zooma tasks need to be called after data import, for example using celery chains and considered as a part of data-loading step.

Describe alternatives you've considered
Zooma tasks could be called also by celery periodic tasks with regular time schedules and ideally manually by user. Where user can call those task (in which page) need to be defined

Additional context
Call to zooma API are maintaned into IMAGE-ValidationTool package, maybe the zooma.helper module could be updated in order to import such code. Moreover, solutions like mapping to a default ontology is already defined in IMAGE-ValidationTool. Ideally we have to:

  • fix issues with celery-flower - pinning kombu version
  • Update IMAGE-ValidationTool to the last version
  • Model annotate_developmental_stage and annotate_physiological_stage
  • Update zooma.helpers to use image_validation module
  • Call zooma tasks after data load
  • Define periodic task in order to call zooma regularly
  • zooma tasks should be mutually exclusives
  • Designing views where a user can call zooma tasks.
  • Designing views where a user can set manually an ontology term (should instead have a django group able to admin only those tables)?
  • Send notification to admin when a new term is added or is missing - postponed: using admin to manage term
  • Solve the task exlusive bug
  • Test all this stuff

I expect Zooma should be called automatically

  1. upload the data
  2. check the values for all ontology-required fields have ontologies
  3. If not, for those values, look up in the central database (one and only one for everyone)
  4. Still missing ontology, call Zooma automatically
    4.1 high confidence: return the value to the user, notify the admin that an entry automatically created in the central database
    4.2 Good and medium confidence: return the value to the user, notify the admin by creating the command to insert the entry into the database, i.e. the admin still needs manual approval
    4.3 other confidence: discard the mapping, notify the admin to do a manual mapping
    The end user should only receive notifications like "Could not find ontology terms for ****, *****, please revise them"
bunop commented

Currently when data are loaded everything needs an ontology is modelled as an entry in a dictionary table. There are entities that are filled during import (ie breeds), others require a privileged user to add a new term (ie. species) or to resolve a term with a language table (ie pig->Sus scrofa) otherwise the import throws an error. The ontology is an attribute of each term, that is unique in the dictionary table. So the ontologies are resolved once for in the UID. Zooma is called (by a management task) on empty ontology terms for breed, country, organism parts and species. Only high and good confidences are kept, the rest is discarded. No notification regarding terms is currently implemented.
Shuld we add nofification when adding a new term?

good to have, but could wait as for test everything is under close monitoring.