Skip to content

Validation Data Classes

Data models for validation of input datasets for generating scenarios.

RuleConfiguration dataclass

RuleConfiguration(category, description, rule_name, recommendation='')

Context information for configuring a data validator.

RuleInfo dataclass

RuleInfo(type, name)

Contains summary information on the rule type and corresponding friendly rule name (which is synced with the one in the RuleConfiguration object).

RuleResult dataclass

RuleResult(config, recommendation, summary, validate_info=list())

Contains information on the result of validating a single rule.

category property

category

Returns the validation category of the specified rule.

Returns:

Type Description
ValidationCategory

Validation category of the specified rule.

success property

success

Whether the result contains any warnings or errors depending on the rule configuration.

:returns: True if there are no errors or warnings depending on the rule configuration, else False.

RuleType

Bases: IntEnum

Types of validation that will be performed on the data.

SubmitResult dataclass

SubmitResult(identifier, success, feedback=None)

Contains information on the status of submitting a set of layers for validation.

ValidationCategory

Bases: IntEnum

Classification type of the validation.

ValidationResult dataclass

ValidationResult(rule_results=list(), component_type=ModelComponentType.UNKNOWN)

Contains information on the result of validating multiple rules i.e. an aggregation of RuleResult objects.

errors property

errors

Returns RuleResult objects that are of ERROR category and contain one or more error messages.

Returns:

Type Description
list

RuleResult objects that are of ERROR category and contain one or mor error messages.

success property

success

Whether the result contains any warnings or errors based on the individual rule results.

:returns: True if there are no errors or warnings for any of the RuleResult objects, else False.

warnings property

warnings

Returns RuleResult objects that are of WARNING category and contain one or more error messages.

Returns:

Type Description
list

RuleResult objects that are of WARNING category and contain one or mor error messages.

__iter__

__iter__()

Returns an iterable object containing the individual rule results.

Source code in src/cplus_plugin/models/validation.py
def __iter__(self):
    """Returns an iterable object containing the individual rule results."""
    return iter(self.rule_results)

__len__

__len__()

Gets the number of rule results in the object.

Returns:

Type Description
int

The number of rule results in the object.

Source code in src/cplus_plugin/models/validation.py
def __len__(self) -> int:
    """Gets the number of rule results in the object.

    :returns: The number of rule results in the object.
    :rtype: int
    """
    return len(self.rule_results)

Last update: October 2, 2024
Back to top