# Path: nacc/uds3/filters.py
# def validate(func):
#     def read_config(config_path):
#     def get_reqs_dict(config_path):
#     def validate_filter(*args, **kwargs):
# def int_or_string(value, default=-1):
# def filter_clean_ptid(input_ptr, filter_config, output_ptr):
# def filter_clean_ptid_do(input_ptr, nacc_packet_file, output_ptr):
# def write_headers(reader, output):
# def filter_replace_drug_id(input_ptr, filter_meta, output_ptr):
# def filter_replace_drug_id_do(input_ptr, output_ptr):
# def filter_fix_headers(input_file, header_mapping, output_file):
# def filter_fix_headers_do(input_ptr, header_dictionary, output_ptr):
# def filter_remove_ptid(input_ptr, filter_config, output_ptr):
# def filter_remove_ptid_do(input_ptr, filter_diction, output_ptr):
# def filter_eliminate_empty_date(input_ptr, filter_meta, output_ptr):
# def filter_eliminate_empty_date_do(input_ptr, output_ptr):
# def _invalid_date(record):
# def fill_value_of_fields(input_ptr, output_ptr, keysDict, blankCheck=False,
#                          defaultCheck=False):
# def filter_fix_visitdate(input_ptr, filter_meta, output_ptr):
# def filter_fix_visitdate_do(input_ptr, output_ptr):
# def filter_fill_default(input_ptr, filter_meta, output_ptr):
# def fill_default_values(config):
# def filter_update_field(input_ptr, filter_meta, output_ptr):
# def fill_non_blank_values(config):
# def skip_filter(input_ptr, output_ptr):
# def filter_extract_ptid(input_ptr, Ptid, visit_num, visit_type, output_ptr):
# def filter_csv_all(Ptid, visit_num, visit_type, record):
# def filter_csv_vtype(Ptid, visit_type, record):
# def filter_csv_vnum(Ptid, visit_num, record):
# def filter_csv_ptid(Ptid, record):
# def load_special_case_ptid(case_name, filter_config):


import csv
import io
import unittest
from nacc.uds3 import filters
            results.seek(0)
            reader = csv.DictReader(results)
            for row in reader:
                actual.append(row['adcid'])
        expected = ['', '41', '', '41']
        self.assertEqual(actual, expected)

# Next 4 filters are sub filters of filter_extract_ptid
    def test_filter_csv_vnum(self):
        '''
        `filter_csv_vnum` should return records of matching input ptid
        and visit number.
        '''
        Ptid = '110001'
        visit_num = '1'
        redcap_data = '''
ptid,redcap_event_name,formver,adcid,visitmo,visitday,visityr,visitnum,initials,header_complete
110001,initial_visit_year_arm_1,3,99,1,1,2019,001,ABC,2
110002,initial_visit_year_arm_1,3,99,1,1,2019,001,ABC,2
110001,followup_visit_yea_arm_1,3,99,1,1,2019,002,ABC,2
110002,followup_visit_yea_arm_1,3,99,1,1,2019,002,ABC,2
110001,followup_visit_yea_arm_1,3,99,1,1,2019,001,ABC,2
110001,followup_visit_yea_arm_1,3,99,1,1,2019,002,ABC,2
'''.strip()
        actual = []
        with io.StringIO(redcap_data) as data, \
                io.StringIO("") as results:

            reader = csv.DictReader(data)
            output = csv.DictWriter(results, None)

# Path: nacc/uds3/filters.py
# def validate(func):
#     def read_config(config_path):
#     def get_reqs_dict(config_path):
#     def validate_filter(*args, **kwargs):
# def int_or_string(value, default=-1):
# def filter_clean_ptid(input_ptr, filter_config, output_ptr):
# def filter_clean_ptid_do(input_ptr, nacc_packet_file, output_ptr):
# def write_headers(reader, output):
# def filter_replace_drug_id(input_ptr, filter_meta, output_ptr):
# def filter_replace_drug_id_do(input_ptr, output_ptr):
# def filter_fix_headers(input_file, header_mapping, output_file):
# def filter_fix_headers_do(input_ptr, header_dictionary, output_ptr):
# def filter_remove_ptid(input_ptr, filter_config, output_ptr):
# def filter_remove_ptid_do(input_ptr, filter_diction, output_ptr):
# def filter_eliminate_empty_date(input_ptr, filter_meta, output_ptr):
# def filter_eliminate_empty_date_do(input_ptr, output_ptr):
# def _invalid_date(record):
# def fill_value_of_fields(input_ptr, output_ptr, keysDict, blankCheck=False,
#                          defaultCheck=False):
# def filter_fix_visitdate(input_ptr, filter_meta, output_ptr):
# def filter_fix_visitdate_do(input_ptr, output_ptr):
# def filter_fill_default(input_ptr, filter_meta, output_ptr):
# def fill_default_values(config):
# def filter_update_field(input_ptr, filter_meta, output_ptr):
# def fill_non_blank_values(config):
# def skip_filter(input_ptr, output_ptr):
# def filter_extract_ptid(input_ptr, Ptid, visit_num, visit_type, output_ptr):
# def filter_csv_all(Ptid, visit_num, visit_type, record):
# def filter_csv_vtype(Ptid, visit_type, record):
# def filter_csv_vnum(Ptid, visit_num, record):
# def filter_csv_ptid(Ptid, record):
# def load_special_case_ptid(case_name, filter_config):


# Path: tests/test_filters.py
import csv
import io
import unittest
from nacc.uds3 import filters

            results.seek(0)
            reader = csv.DictReader(results)
            for row in reader:
                actual.append(row['adcid'])
        expected = ['', '41', '', '41']
        self.assertEqual(actual, expected)

# Next 4 filters are sub filters of filter_extract_ptid
    def test_filter_csv_vnum(self):
        '''
        `filter_csv_vnum` should return records of matching input ptid
        and visit number.
        '''
        Ptid = '110001'
        visit_num = '1'
        redcap_data = '''
ptid,redcap_event_name,formver,adcid,visitmo,visitday,visityr,visitnum,initials,header_complete
110001,initial_visit_year_arm_1,3,99,1,1,2019,001,ABC,2
110002,initial_visit_year_arm_1,3,99,1,1,2019,001,ABC,2
110001,followup_visit_yea_arm_1,3,99,1,1,2019,002,ABC,2
110002,followup_visit_yea_arm_1,3,99,1,1,2019,002,ABC,2
110001,followup_visit_yea_arm_1,3,99,1,1,2019,001,ABC,2
110001,followup_visit_yea_arm_1,3,99,1,1,2019,002,ABC,2
'''.strip()
        actual = []
        with io.StringIO(redcap_data) as data, \
                io.StringIO("") as results:

            reader = csv.DictReader(data)
            output = csv.DictWriter(results, None)

            filters.write_headers(reader, output)