def create_validator():
field_names = (<EOL>'<STR_LIT>', <EOL>'<STR_LIT>', <EOL>'<STR_LIT>', <EOL>'<STR_LIT>', <EOL>'<STR_LIT>',<EOL>'<STR_LIT>'<EOL>)<EOL>validator = CSVValidator(field_names)<EOL>validator.add_header_check('<STR_LIT>', '<STR_LIT>')<EOL>validator.add_record_length_check('<STR_LIT>', '<STR_LIT>')<EOL>validator.add_value_check('<STR_LIT>', int, <EOL>'<STR_LIT>', '<STR_LIT>')<EOL>validator.add_value_check('<STR_LIT>', int, <EOL>'<STR_LIT>', '<STR_LIT>')<EOL>validator.add_value_check('<STR_LIT>', enumeration('<STR_LIT:M>', '<STR_LIT:F>'), <EOL>'<STR_LIT>', '<STR_LIT>')<EOL>validator.add_value_check('<STR_LIT>', number_range_inclusive(<NUM_LIT:0>, <NUM_LIT>, int), <EOL>'<STR_LIT>', '<STR_LIT>')<EOL>validator.add_value_check('<STR_LIT>', datetime_string('<STR_LIT>'),<EOL>'<STR_LIT>', '<STR_LIT>')<EOL>def check_age_variables(r):<EOL><INDENT>age_years = int(r['<STR_LIT>'])<EOL>age_months = int(r['<STR_LIT>'])<EOL>valid = (age_months >= age_years * <NUM_LIT:12> and <EOL>age_months % age_years < <NUM_LIT:12>)<EOL>if not valid:<EOL><INDENT>raise RecordError('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT><DEDENT>validator.add_record_check(check_age_variables)<EOL>return validator<EOL>
Create an example CSV validator for patient demographic data.