Lark parser for CSV validation with explicit context
I am working on a CSV validation script based on The National Archives schema (https://blog.nationalarchives.gov.uk/csv-validator-new-digital-preservation-tool/) using Python and Lark. The basics all work such that if you declare a column must be called “name” and not be empty (name: notEmpty
), or called “age” and be between 0 and 120 (age: range(0, 120)
) the Lark transformer is able to collect up all the relevant functions through the tree and hand them over to the validation script to confirm that each value is True.