Validation App

validation.helpers

validation.helpers module contents

Created on Tue Feb 19 16:15:35 2019

@author: Paolo Cozzi <cozzi@ibba.cnr.it>

class validation.helpers.MetaDataValidation(ruleset_filename='/home/docs/checkouts/readthedocs.org/user_builds/image-injecttool/conda/latest/lib/python3.6/site-packages/image_validation/sample_ruleset_v3a0ee76.json')[source]

Bases: object

A class to deal with IMAGE-ValidationTool ruleset objects

__init__(ruleset_filename='/home/docs/checkouts/readthedocs.org/user_builds/image-injecttool/conda/latest/lib/python3.6/site-packages/image_validation/sample_ruleset_v3a0ee76.json')[source]

Initialize self. See help(type(self)) for accurate signature.

check_biosample_id_target(biosample_id, record_id, record_result)[source]

Check if a target biosample_id exists or not. If it is present, ok. Otherwise a ValidationResultColumn with a warning

Parameters
  • biosample_id (str) – the desidered biosample id

  • record_id (str) – is the name of the object in the original data source

  • record_result (ValidationResult.ValidationResultRecord) – an image_validation result object

Returns

an updated image_validation object

Return type

ValidationResult.ValidationResultRecord

check_duplicates(record)[source]

Check duplicates in data

check_relationship(record, record_result)[source]

Check relationship for an Animal/Sample record and return a list of dictionaries (to_biosample() objects) of related object

Parameters
  • record (dict) – An Animal/Sample.to_biosample() dictionary object

  • record_result (ValidationResult.ValidationResultRecord) – an image_validation result object

Returns

a list of dictionaries of relate objects ValidationResult.ValidationResultRecord: an updated image_validation object

Return type

list

check_ruleset()[source]

Check ruleset

check_usi_structure(record: object)object[source]

Check data against USI rules

read_in_ruleset(ruleset_filename)[source]
ruleset = None
validate(record)[source]

Check attributes for record by calling image_validation methods

Parameters

record (dict) – An Animal/Sample.to_biosample() dictionary object

Returns

an image_validation object

Return type

ValidationResult.ValidationResultRecord

exception validation.helpers.OntologyCacheError[source]

Bases: Exception

Identifies temporary issues with EBI servers and image_validation.use_ontology.OntologyCache objects

exception validation.helpers.RulesetError[source]

Bases: Exception

Indentifies errors in ruleset

validation.helpers.construct_validation_message(submission)[source]

Function will return dict with all the data required to construct validation message

Parameters

submission (uid.models.Submission) – submission to get data from

Returns

dictionary with all required data for validation message or None if database objects do not exist

Return type

dict

validation.models

validation.models module contents

Created on Mon Jan 28 11:09:02 2019

@author: Paolo Cozzi <cozzi@ibba.cnr.it>

class validation.models.ValidationResult(id, submission, content_type, object_id, status, messages)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

animals

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

content_object

Provide a generic many-to-one relation through the content_type and object_id fields.

This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.

content_type

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

content_type_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

messages

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name_limit = <Q: (OR: (AND: ('app_label', 'uid'), ('model', 'animal')), (AND: ('app_label', 'uid'), ('model', 'sample')))>
object_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
samples

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

submission

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

submission_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class validation.models.ValidationSummary(id, submission, all_count, validation_known_count, issues_count, pass_count, warning_count, error_count, type, messages)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

all_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

error_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_unknown_count()[source]

Returns number of samples or animals with unknown validation

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

issues_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

messages

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
pass_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

reset()[source]

Sets all counts and other counters to 0

reset_all_count()[source]

Set all_count column according to Animal/Sample objects

submission

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

submission_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

validation_known_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

warning_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.