GroupValidator

class GroupValidator(hed_schema)[source]

Validation for attributes across groups HED tags.

This is things like Required, Unique, top level tags, etc.

Methods

GroupValidator.__init__(hed_schema)

Constructor for GroupValidator

GroupValidator.check_for_required_tags(tags)

Report missing required tags.

GroupValidator.check_multiple_unique_tags_exist(tags)

Report if multiple identical unique tags exist

GroupValidator.check_tag_level_issue(...)

Report tags incorrectly positioned in hierarchy.

GroupValidator.run_all_tags_validators(...)

Report invalid the multi-tag properties in a HED string, e.g.

GroupValidator.run_tag_level_validators(...)

Report invalid groups at each level.

GroupValidator.validate_duration_tags(...)

Validate Duration/Delay tag groups

Attributes

GroupValidator.__init__(hed_schema)[source]

Constructor for GroupValidator

Parameters:

hed_schema (HedSchema) – A HedSchema object.

GroupValidator.check_for_required_tags(tags)[source]

Report missing required tags.

Parameters:

tags (list) – HedTags containing the tags.

Returns:

Validation issues. Each issue is a dictionary.

Return type:

list

GroupValidator.check_multiple_unique_tags_exist(tags)[source]

Report if multiple identical unique tags exist

A unique Term can only appear once in a given HedString. Unique terms are terms with the ‘unique’ property in the schema.

Parameters:

tags (list) – HedTags containing the tags.

Returns:

Validation issues. Each issue is a dictionary.

Return type:

list

static GroupValidator.check_tag_level_issue(original_tag_list, is_top_level, is_group)[source]

Report tags incorrectly positioned in hierarchy.

Top-level groups can contain definitions, Onset, etc. tags.

Parameters:
  • original_tag_list (list) – HedTags containing the original tags.

  • is_top_level (bool) – If True, this group is a “top level tag group”.

  • is_group (bool) – If True group should be contained by parenthesis.

Returns:

Validation issues. Each issue is a dictionary.

Return type:

list

GroupValidator.run_all_tags_validators(hed_string_obj)[source]

Report invalid the multi-tag properties in a HED string, e.g. required tags.

Parameters:

hed_string_obj (HedString) – A HedString object.

Returns:

The issues associated with the tags in the HED string. Each issue is a dictionary.

Return type:

list

GroupValidator.run_tag_level_validators(hed_string_obj)[source]

Report invalid groups at each level.

Parameters:

hed_string_obj (HedString) – A HedString object.

Returns:

Issues associated with each level in the HED string. Each issue is a dictionary.

Return type:

list

Notes

  • This pertains to the top-level, all groups, and nested groups.

static GroupValidator.validate_duration_tags(hed_string_obj)[source]

Validate Duration/Delay tag groups

Parameters:

hed_string_obj (HedString) – The hed string to check.

Returns:

Issues found in validating durations (i.e., extra tags or groups present, or a group missing)

Return type:

list