def _validate_match(self, match, field, value): schema_registry.add('yaml_match_schema', sch.yaml_match_schema) schema_registry.add('yaml_genomic_schema', sch.yaml_genomic_schema) schema_registry.add('yaml_clinical_schema', sch.yaml_clinical_schema) v = Validator(sch.yaml_match_schema) v.validate(value[0]) if len(v.errors) > 0: self._error(field, v.errors)
def _validate_match(self, match, field, value): for item in value: self.__signature_exception(item) schema_registry.add('yaml_match_schema', data_model.yaml_match_schema) schema_registry.add('yaml_genomic_schema', data_model.yaml_genomic_schema) schema_registry.add('yaml_clinical_schema', data_model.yaml_clinical_schema) v = Validator(data_model.yaml_match_schema) v.validate(value[0]) if len(v.errors) > 0: self._error(field, v.errors)
parent_schema_adv = schema.parent_schema.copy() parent_schema_adv['children'] = { 'type': 'list', 'schema': { 'type': 'dict', 'schema': 'child_schema' } } parent_schema_adv['match'] = { 'type': 'list', 'schema': { 'type': 'dict', 'schema': 'yaml_match_schema' } } schema_registry.add('parent_schema', parent_schema_adv) schema_registry.add('yaml_match_schema', schema.yaml_match_schema) schema_registry.add('yaml_genomic_schema', schema.yaml_genomic_schema) schema_registry.add('yaml_clinical_schema', schema.yaml_clinical_schema) schema_registry.add('map', schema.map) class MatchEngine(object): def __init__(self, db): # get the database. self.db = db # stores the complete list as easy lookup self.all_match = set(self.db.clinical.distinct('SAMPLE_ID')) # get mapping values between yml and db