Switch on data validation checks throughout your pipeline.
adilib
provides data syntax validation at runtime that reports errors and warnings akin to a stack-trace.
For performance reasons it is disabled by default. Enable it like so:
import adilib
adilib.setup(validation=True)
Example trace:
find_average(
cell_protein_expression: {'Quantification' : 1.015},
tissue_slide_region: {'Slide' : 'A1001', 'Tissue anatomical region' : 'Stroma'},
)
ERROR: During validation of find_average ...
cell_protein_expression type: dict
Got arguments: ('cell_protein_expression', 'tissue_slide_region')
cell_protein_expression: {'Quantification' : 1.015}
cell_protein_expression record lacks required elements: 'Cell', 'Gene'
Suggestion: Supply missing value(s) 'Cell', 'Gene'
Traceback (most recent call last):
File "./process.py", line 25, in <module>
processor.find_average(...)
File "./process.py", line 13, in adiwrapper
raise ValueError(message)
ValueError: Syntax of schema at *https://adiframework.com/schemas/pathology* violated by function DataProcessor.find_average
In this hypothetical example, we called find_average
on an incomplete data record of type ‘Cell protein expression’.