Validation for nested data structures
pip install valida
from valida import Data, Value, Rule
# Define some data that we want to validate:
my_data = Data({'A': 1, 'B': [1, 2, 3], 'C': {'c1': 8.2, 'c2': 'hello'}})
# Define a rule as a path within the data and a condition at that path:
rule = Rule(
path=('C', 'c2'),
condition=Value.dtype.equal_to(str),
)
# Test the rule
rule.test(my_data).is_valid # `True` => The rule tested successfully
Valida was developed using funding from the LightForm EPSRC programme grant (EP/R001715/1)