diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 310c04bd..56a234bb 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,14 +1,12 @@ FROM python:3.11-alpine -LABEL maintainer="Ethan Bienstock" +LABEL maintainer="CFPB RegTech Team" COPY ../pyproject.toml . COPY ../poetry.lock . -ENV PATH /opt/conda/bin:$PATH - # install git and alpine sdk for c compiler extensions -RUN apk add --update git curl alpine-sdk +RUN apk add --update git curl # install pip dependencies RUN pip install --upgrade pip & \ diff --git a/pyproject.toml b/pyproject.toml index a6ca92cc..b84d616d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,12 +7,14 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.11" -black = "23.3.0" -ruff = "0.0.259" pandas = "2.1.0" pandera = "0.16.1" + +[tool.poetry.group.dev.dependencies] pytest = "7.4.0" pytest-cov = "4.1.0" +black = "23.3.0" +ruff = "0.0.259" [build-system] requires = ["poetry-core"] @@ -21,19 +23,17 @@ build-backend = "poetry.core.masonry.api" # Black formatting [tool.black] preview = true +line-length = 120 skip-string-normalization = true include = '\.pyi?$' exclude = ''' /( - | .gitignore # list of files or directories to be excluded in the - | .git # root of the project - | Dockerfile - | .github | .devcontainer + | .git + | .gitignore + | .github | data | tools - | poetry.lock - | pyproject.toml )/ ''' @@ -63,21 +63,4 @@ relative_files = true source = ["src"] [tool.coverage.report] -skip_empty = true -# Regexes for lines to exclude from consideration -exclude_also = [ - # Don't complain about missing debug-only code: - "def __repr__", - "if self\\.debug", - - # Don't complain if tests don't hit defensive assertion code: - "raise AssertionError", - "raise NotImplementedError", - - # Don't complain if non-runnable code isn't run: - "if 0:", - "if __name__ == .__main__.:", - - # Don't complain about abstract methods, they aren't run: - "@(abc\\.)?abstractmethod", - ] +skip_empty = true \ No newline at end of file diff --git a/src/tests/test_check_functions.py b/src/tests/test_check_functions.py index e40caeef..65175eff 100644 --- a/src/tests/test_check_functions.py +++ b/src/tests/test_check_functions.py @@ -108,13 +108,9 @@ class TestMultiInvalidNumberOfValues: multiple_values_series = pd.Series(["1;2;3"], name="test_name", index=[2]) - multiple_values_series_with_977 = pd.Series( - ["1;2;3;977"], name="test_name", index=[2] - ) + multiple_values_series_with_977 = pd.Series(["1;2;3;977"], name="test_name", index=[2]) - multiple_values_series_with_blanks = pd.Series( - ["1;2;; ;3"], name="test_name", index=[2] - ) + multiple_values_series_with_blanks = pd.Series(["1;2;; ;3"], name="test_name", index=[2]) def test_inside_maxlength(self): result = has_valid_multi_field_value_count({"4": self.series}, 5) @@ -133,15 +129,11 @@ def test_invalid_length_with_blank(self): assert result.values == [False] def test_invalid_length_with_blank_and_ignored_values(self): - result = has_valid_multi_field_value_count( - {"4;1;977": self.blank_series}, 1, ignored_values={"977"} - ) + result = has_valid_multi_field_value_count({"4;1;977": self.blank_series}, 1, ignored_values={"977"}) assert result.values == [False] def test_valid_length_with_blank_and_ignored_values(self): - result = has_valid_multi_field_value_count( - {"4;1;977": self.blank_series}, 2, ignored_values={"977"} - ) + result = has_valid_multi_field_value_count({"4;1;977": self.blank_series}, 2, ignored_values={"977"}) assert result.values == [True] def test_outside_maxlength(self): @@ -149,15 +141,11 @@ def test_outside_maxlength(self): assert result.values == [False] def test_valid_length_with_non_blank(self): - result = has_valid_multi_field_value_count( - {"4;1": self.multiple_values_series}, 5 - ) + result = has_valid_multi_field_value_count({"4;1": self.multiple_values_series}, 5) assert result.values == [True] def test_invalid_length_with_non_blank(self): - result = has_valid_multi_field_value_count( - {"4;1": self.multiple_values_series}, 4 - ) + result = has_valid_multi_field_value_count({"4;1": self.multiple_values_series}, 4) assert result.values == [False] def test_valid_length_with_ignored_values(self): @@ -190,9 +178,7 @@ def test_valid_length_with_blank_values(self): ) assert result.values == [True] - result = has_valid_multi_field_value_count( - {"4;1;977": self.multiple_values_series_with_blanks}, 6 - ) + result = has_valid_multi_field_value_count({"4;1;977": self.multiple_values_series_with_blanks}, 6) assert result.values == [True] def test_invalid_length_with_blank_values(self): @@ -203,9 +189,7 @@ def test_invalid_length_with_blank_values(self): ) assert result.values == [False] - result = has_valid_multi_field_value_count( - {"4;1;977": self.multiple_values_series_with_blanks}, 5 - ) + result = has_valid_multi_field_value_count({"4;1;977": self.multiple_values_series_with_blanks}, 5) assert result.values == [False] @@ -336,9 +320,7 @@ def test_enum_value_confict_correct(self): ] # If ct_credit_product == 1, 2 then pricing_mca_addcost_flag must not equal 999 - pricing_mca_addcost_flag_series_1 = pd.Series( - ["900"], name="pricing_mca_addcost_flag", index=[2] - ) + pricing_mca_addcost_flag_series_1 = pd.Series(["900"], name="pricing_mca_addcost_flag", index=[2]) ct_credit_product_1 = "1" @@ -351,9 +333,7 @@ def test_enum_value_confict_correct(self): # If ct_credit_product == 988 then pricing_mca_addcost_flag must equal 999 ct_credit_product_2 = "988" # Case when pricing_mca_addcost_flag = 999 - pricing_mca_addcost_flag_series_2 = pd.Series( - ["999"], name="pricing_mca_addcost_flag", index=[2] - ) + pricing_mca_addcost_flag_series_2 = pd.Series(["999"], name="pricing_mca_addcost_flag", index=[2]) pricing_mca_addcost_flag_result_2 = has_valid_enum_pair( {ct_credit_product_2: pricing_mca_addcost_flag_series_2}, pricing_mca_addcost_flag_conditions, @@ -389,17 +369,13 @@ def test_enum_value_confict_correct(self): denial_reasons_1 = pd.Series(["988"], name="denial_reasons", index=[2]) action_taken_1 = "3" - denial_reason_result_1 = has_valid_enum_pair( - {action_taken_1: denial_reasons_1}, denial_reasons_conditions - ) + denial_reason_result_1 = has_valid_enum_pair({action_taken_1: denial_reasons_1}, denial_reasons_conditions) assert denial_reason_result_1.values == [True] # If action_taken is NOT 3, and denial_reasons must equal 999 denial_reasons_2 = pd.Series(["999"], name="denial_reasons", index=[2]) action_taken_2 = "1" - denial_reason_result_2 = has_valid_enum_pair( - {action_taken_2: denial_reasons_2}, denial_reasons_conditions - ) + denial_reason_result_2 = has_valid_enum_pair({action_taken_2: denial_reasons_2}, denial_reasons_conditions) assert denial_reason_result_2.values == [True] def test_enum_value_confict_incorrect(self): @@ -419,9 +395,7 @@ def test_enum_value_confict_incorrect(self): ] # If ct_credit_product == 1, 2 then pricing_mca_addcost_flag must not equal 999 - pricing_mca_addcost_flag_series_1 = pd.Series( - ["999"], name="pricing_mca_addcost_flag", index=[2] - ) + pricing_mca_addcost_flag_series_1 = pd.Series(["999"], name="pricing_mca_addcost_flag", index=[2]) ct_credit_product_1 = "1" @@ -434,9 +408,7 @@ def test_enum_value_confict_incorrect(self): # If ct_credit_product == 988 then pricing_mca_addcost_flag must equal 999 ct_credit_product_2 = "988" # Case when pricing_mca_addcost_flag = 999 - pricing_mca_addcost_flag_series_2 = pd.Series( - ["900"], name="pricing_mca_addcost_flag", index=[2] - ) + pricing_mca_addcost_flag_series_2 = pd.Series(["900"], name="pricing_mca_addcost_flag", index=[2]) pricing_mca_addcost_flag_result_2 = has_valid_enum_pair( {ct_credit_product_2: pricing_mca_addcost_flag_series_2}, pricing_mca_addcost_flag_conditions, @@ -472,17 +444,13 @@ def test_enum_value_confict_incorrect(self): denial_reasons_1 = pd.Series(["999"], name="denial_reasons", index=[2]) action_taken_1 = "3" - denial_reason_result_1 = has_valid_enum_pair( - {action_taken_1: denial_reasons_1}, denial_reasons_conditions - ) + denial_reason_result_1 = has_valid_enum_pair({action_taken_1: denial_reasons_1}, denial_reasons_conditions) assert denial_reason_result_1.values == [False] # If action_taken is NOT 3, and denial_reasons must equal 999 denial_reasons_2 = pd.Series(["988"], name="denial_reasons", index=[2]) action_taken_2 = "1" - denial_reason_result_2 = has_valid_enum_pair( - {action_taken_2: denial_reasons_2}, denial_reasons_conditions - ) + denial_reason_result_2 = has_valid_enum_pair({action_taken_2: denial_reasons_2}, denial_reasons_conditions) assert denial_reason_result_2.values == [False] @@ -610,41 +578,19 @@ def test_with_not_accepting_blank(self): # tests with different regex def test_with_valid_data_ip(self): - assert ( - has_valid_format( - "192.168.0.1", "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" - ) - is True - ) - assert ( - has_valid_format( - "192.168.120.100", "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" - ) - is True - ) + assert has_valid_format("192.168.0.1", "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$") is True + assert has_valid_format("192.168.120.100", "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$") is True def test_with_invalid_data_ip(self): - assert ( - has_valid_format( - "192.168.0.1000", "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" - ) - is False - ) - assert ( - has_valid_format( - "192.168.0", "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" - ) - is False - ) + assert has_valid_format("192.168.0.1000", "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$") is False + assert has_valid_format("192.168.0", "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$") is False class TestIsUniqueColumn: series = pd.Series(["ABC123"], name="id", index=[1]) other_series = pd.Series(["DEF456"], name="id", index=[3]) invalid_series = pd.Series(["ABC123", "ABC123"], name="id", index=[1, 2]) - multi_invalid_series = pd.Series( - ["GHI123", "GHI123", "GHI123"], name="id", index=[3, 4, 5] - ) + multi_invalid_series = pd.Series(["GHI123", "GHI123", "GHI123"], name="id", index=[3, 4, 5]) blank_value_series = pd.Series([""], name="id", index=[1]) def test_with_valid_series(self): @@ -664,9 +610,7 @@ def test_with_multiple_items_series(self): assert not result.values.all() def test_with_multiple_invalid_series(self): - result = is_unique_column( - {"ABC123": self.invalid_series, "GHI123": self.multi_invalid_series} - ) + result = is_unique_column({"ABC123": self.invalid_series, "GHI123": self.multi_invalid_series}) # ALL rows should be FALSE assert ( not result.values[0] @@ -677,9 +621,7 @@ def test_with_multiple_invalid_series(self): ) def test_with_multiple_mix_series(self): - result = is_unique_column( - {"ABC123": self.invalid_series, "DEF456": self.other_series} - ) + result = is_unique_column({"ABC123": self.invalid_series, "DEF456": self.other_series}) # first two rows should be FALSE and last Row should be TRUE assert not result.values[0] and not result.values[1] and result.values[2] @@ -698,9 +640,7 @@ def test_with_correct_is_not_equal_condition(self): } series = pd.Series(["0"], name="num_principal_owners", index=[1]) groupby_values = tuple(["", "", ""]) - result1 = has_valid_fieldset_pair( - {groupby_values: series}, condition_values, should_fieldset_key_equal_to - ) + result1 = has_valid_fieldset_pair({groupby_values: series}, condition_values, should_fieldset_key_equal_to) assert result1.values == [True] def test_with_correct_is_equal_condition(self): @@ -712,9 +652,7 @@ def test_with_correct_is_equal_condition(self): } series = pd.Series(["0"], name="num_principal_owners", index=[1]) groupby_values = tuple(["999", "999", "0"]) - result1 = has_valid_fieldset_pair( - {groupby_values: series}, condition_values, should_fieldset_key_equal_to - ) + result1 = has_valid_fieldset_pair({groupby_values: series}, condition_values, should_fieldset_key_equal_to) assert result1.values == [True] def test_with_correct_is_equal_and_not_equal_conditions(self): @@ -729,9 +667,7 @@ def test_with_correct_is_equal_and_not_equal_conditions(self): series = pd.Series(["0"], name="num_principal_owners", index=[1]) groupby_values = tuple(["999", "999", "0", "1", "2"]) - result1 = has_valid_fieldset_pair( - {groupby_values: series}, condition_values, should_fieldset_key_equal_to - ) + result1 = has_valid_fieldset_pair({groupby_values: series}, condition_values, should_fieldset_key_equal_to) assert result1.values == [True] def test_with_value_not_in_condition_values(self): @@ -746,9 +682,7 @@ def test_with_value_not_in_condition_values(self): series = pd.Series(["2"], name="num_principal_owners", index=[1]) groupby_values = tuple(["999", "999", "0", "1", "2"]) - result1 = has_valid_fieldset_pair( - {groupby_values: series}, condition_values, should_fieldset_key_equal_to - ) + result1 = has_valid_fieldset_pair({groupby_values: series}, condition_values, should_fieldset_key_equal_to) assert result1.values == [True] def test_with_incorrect_is_not_equal_condition(self): @@ -761,9 +695,7 @@ def test_with_incorrect_is_not_equal_condition(self): series = pd.Series(["0"], name="num_principal_owners", index=[1]) groupby_values = tuple(["999", "999", "999"]) - result1 = has_valid_fieldset_pair( - {groupby_values: series}, condition_values, should_fieldset_key_equal_to - ) + result1 = has_valid_fieldset_pair({groupby_values: series}, condition_values, should_fieldset_key_equal_to) assert result1.values == [False] def test_with_incorrect_is_equal_condition(self): @@ -776,9 +708,7 @@ def test_with_incorrect_is_equal_condition(self): series = pd.Series(["0"], name="num_principal_owners", index=[1]) groupby_values = tuple(["", "", ""]) - result1 = has_valid_fieldset_pair( - {groupby_values: series}, condition_values, should_fieldset_key_equal_to - ) + result1 = has_valid_fieldset_pair({groupby_values: series}, condition_values, should_fieldset_key_equal_to) assert result1.values == [False] def test_with_incorrect_is_equal_and_not_equal_conditions(self): @@ -793,9 +723,7 @@ def test_with_incorrect_is_equal_and_not_equal_conditions(self): series = pd.Series(["0"], name="num_principal_owners", index=[1]) groupby_values = tuple(["", "", "3", "4", "5"]) - result1 = has_valid_fieldset_pair( - {groupby_values: series}, condition_values, should_fieldset_key_equal_to - ) + result1 = has_valid_fieldset_pair({groupby_values: series}, condition_values, should_fieldset_key_equal_to) assert result1.values == [False] @@ -842,12 +770,7 @@ def test_with_incorrect_values(self): assert string_contains("000TESTFIUIDDONOTUSE", "TESTFIUIDDONOTUSE") is False """ when start_idx and end_idx are set, if sliced value does not match containing_value, must return false """ - assert ( - string_contains( - "000FIUIDDONOTUSEXGXVID11XTC1", "TEST", start_idx=4, end_idx=7 - ) - is False - ) + assert string_contains("000FIUIDDONOTUSEXGXVID11XTC1", "TEST", start_idx=4, end_idx=7) is False """ when only start_idx is set, if sliced value does not match containing_value, must return false """ assert ( diff --git a/src/validator/check_functions.py b/src/validator/check_functions.py index b42372e9..dbbc6470 100644 --- a/src/validator/check_functions.py +++ b/src/validator/check_functions.py @@ -87,9 +87,7 @@ def is_date(date: str) -> bool: return False -def ct_credit_product_ff_blank_validity( - grouped_data: Dict[int, pd.Series] -) -> pd.Series: +def ct_credit_product_ff_blank_validity(grouped_data: Dict[int, pd.Series]) -> pd.Series: """Checks the validity of the field `ct_credit_product_ff` based on the selection of `ct_credit_product`. @@ -130,9 +128,7 @@ def _get_non_blank_values(values: list[str]): # helper function for has_valid_multi_field_value_count: # process series and return validations -def _get_related_series_validations( - value_count: int, series: pd.Series, max_length: int, separator: str = ";" -) -> dict: +def _get_related_series_validations(value_count: int, series: pd.Series, max_length: int, separator: str = ";") -> dict: series_validations = {} for index, value in series.items(): series_count = len(set(_get_non_blank_values(value.split(separator)))) @@ -166,9 +162,7 @@ def has_valid_multi_field_value_count( return pd.concat(validation_holder) -def _get_conditional_field_series_validations( - series: pd.Series, conditional_func -) -> dict: +def _get_conditional_field_series_validations(series: pd.Series, conditional_func) -> dict: series_validations = {} for index, value in series.items(): series_validations[index] = conditional_func(value) @@ -210,9 +204,7 @@ def has_no_conditional_field_conflict( pd.Series( index=other_series.index, name=other_series.name, - data=_get_conditional_field_series_validations( - other_series, lambda v: not v.strip() - ), + data=_get_conditional_field_series_validations(other_series, lambda v: not v.strip()), ) ) else: @@ -222,9 +214,7 @@ def has_no_conditional_field_conflict( pd.Series( index=other_series.index, name=other_series.name, - data=_get_conditional_field_series_validations( - other_series, lambda v: v.strip() != "" - ), + data=_get_conditional_field_series_validations(other_series, lambda v: v.strip() != ""), ) ) @@ -236,13 +226,9 @@ def is_unique_in_field(ct_value: str, separator: str = ";") -> bool: return len(set(values)) == len(values) -def meets_multi_value_field_restriction( - ct_value: str, single_values: set[str], separator: str = ";" -) -> bool: +def meets_multi_value_field_restriction(ct_value: str, single_values: set[str], separator: str = ";") -> bool: ct_values_set = set(ct_value.split(separator)) - if (ct_values_set.isdisjoint(single_values)) or ( - len(ct_values_set) == 1 and ct_values_set.issubset(single_values) - ): + if (ct_values_set.isdisjoint(single_values)) or (len(ct_values_set) == 1 and ct_values_set.issubset(single_values)): return True else: return False @@ -262,9 +248,7 @@ def is_valid_enum( return enum_check -def has_valid_value_count( - ct_value: str, min_length: int, max_length: int = None, separator: str = ";" -) -> bool: +def has_valid_value_count(ct_value: str, min_length: int, max_length: int = None, separator: str = ";") -> bool: values_count = len(ct_value.split(separator)) if max_length is None: return min_length <= values_count @@ -272,9 +256,7 @@ def has_valid_value_count( return min_length <= values_count and values_count <= max_length -def is_date_in_range( - date_value: str, start_date_value: str, end_date_value: str -) -> bool: +def is_date_in_range(date_value: str, start_date_value: str, end_date_value: str) -> bool: """Checks that the date_value is within the range of the start_date_value and the end_date_value @@ -309,13 +291,9 @@ def is_date_after( for value, other_series in grouped_data.items(): try: before_date = datetime.strptime(value, "%Y%m%d") - other_series = pd.to_datetime( - other_series - ) # Convert other series to Date time object + other_series = pd.to_datetime(other_series) # Convert other series to Date time object - validation_holder.append( - other_series.apply(lambda date: date >= before_date) - ) + validation_holder.append(other_series.apply(lambda date: date >= before_date)) except ValueError: validation_holder.append(other_series.apply(lambda v: False)) return pd.concat(validation_holder) @@ -332,9 +310,7 @@ def is_number(ct_value: str, accept_blank: bool = False) -> bool: Returns: bool: True if value is number , False if value is not number """ - value_check = ct_value.isdigit() or bool( - re.match(r"^[-+]?[0-9]*\.?[0-9]+$", ct_value) - ) + value_check = ct_value.isdigit() or bool(re.match(r"^[-+]?[0-9]*\.?[0-9]+$", ct_value)) return _check_blank_(ct_value, value_check, accept_blank) @@ -418,15 +394,11 @@ def has_valid_enum_pair( validation_holder = [] for value, other_series in grouped_data.items(): received_values = set(value.split(separator)) - validation_holder.append( - _has_valid_enum_pair_helper(conditions, received_values, other_series) - ) + validation_holder.append(_has_valid_enum_pair_helper(conditions, received_values, other_series)) return pd.concat(validation_holder) -def is_date_before_in_days( - grouped_data: Dict[str, pd.Series], days_value: int = 730 -) -> pd.Series: +def is_date_before_in_days(grouped_data: Dict[str, pd.Series], days_value: int = 730) -> pd.Series: """Checks if the provided date is not beyond the grouped column date plus the days_value parameter Args: @@ -442,21 +414,15 @@ def is_date_before_in_days( try: initial_date = datetime.strptime(value, "%Y%m%d") unreasonable_date = initial_date + timedelta(days=days_value) - other_series = pd.to_datetime( - other_series - ) # Convert other series to Date time object + other_series = pd.to_datetime(other_series) # Convert other series to Date time object - validation_holder.append( - other_series.apply(lambda date: date < unreasonable_date) - ) + validation_holder.append(other_series.apply(lambda date: date < unreasonable_date)) except ValueError: validation_holder.append(other_series.apply(lambda v: False)) return pd.concat(validation_holder) -def has_correct_length( - ct_value: str, accepted_length: int, accept_blank: bool = False -) -> bool: +def has_correct_length(ct_value: str, accepted_length: int, accept_blank: bool = False) -> bool: """check text for correct length but allow blank Args: ct_value (str): value from file @@ -486,9 +452,7 @@ def is_valid_code(ct_value: str, accept_blank: bool = False, codes: dict = {}) - return _check_blank_(ct_value, key_check, accept_blank) -def is_greater_than_or_equal_to( - value: str, min_value: str, accept_blank: bool = False -) -> bool: +def is_greater_than_or_equal_to(value: str, min_value: str, accept_blank: bool = False) -> bool: """ check if value is greater or equal to min_value or blank If blank value check is not needed, use built-in 'greater_than_or_equal_to' @@ -557,9 +521,7 @@ def _is_unique_column_helper(series: pd.Series, count_limit: int): return series_validations -def is_unique_column( - grouped_data: Dict[any, pd.Series], count_limit: int = 1 -) -> pd.Series: +def is_unique_column(grouped_data: Dict[any, pd.Series], count_limit: int = 1) -> pd.Series: """ verify if the content of a column is unique. - To be used with element_wise set to false @@ -612,10 +574,8 @@ def _has_valid_fieldset_pair_helper( for current_index, current_value in series.items(): """Getting the validation result for comparing current_values to the should_fieldset_key_equal_to (target values)""" - has_valid_fieldset_pair_eq_neq_validation_value = ( - _get_has_valid_fieldset_pair_eq_neq_validation_value( - current_values, should_fieldset_key_equal_to - ) + has_valid_fieldset_pair_eq_neq_validation_value = _get_has_valid_fieldset_pair_eq_neq_validation_value( + current_values, should_fieldset_key_equal_to ) """ If current_value is in condition_values AND @@ -627,8 +587,7 @@ def _has_valid_fieldset_pair_helper( then fieldset pair is NOT valid (False). """ validation = ( - current_value in condition_values - and has_valid_fieldset_pair_eq_neq_validation_value + current_value in condition_values and has_valid_fieldset_pair_eq_neq_validation_value ) or current_value not in condition_values series_validations[current_index] = validation return series_validations diff --git a/src/validator/global_data.py b/src/validator/global_data.py index 422851b2..4ad9ae98 100644 --- a/src/validator/global_data.py +++ b/src/validator/global_data.py @@ -3,9 +3,7 @@ import pandas as pd -ROOT_DIR = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -) # noqa: E402 +ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # noqa: E402 sys.path.append(ROOT_DIR) # noqa: E402 from config import CENSUS_PROCESSED_CSV_PATH, NAICS_CSV_PATH # noqa: E402 diff --git a/src/validator/phase_validations.py b/src/validator/phase_validations.py index 3eacb534..32fd2df8 100644 --- a/src/validator/phase_validations.py +++ b/src/validator/phase_validations.py @@ -87,10 +87,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_date, name="app_date.invalid_date_format", - description=( - "'Application date' must be a real calendar " - "date using YYYYMMDD format." - ), + description="'Application date' must be a real calendar date using YYYYMMDD format.", element_wise=True, ), ], @@ -133,10 +130,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="ct_credit_product.invalid_enum_value", - description=( - "'Credit product' must equal 1, 2, 3, 4, 5, 6, " - "7, 8, 977, or 988." - ), + description="'Credit product' must equal 1, 2, 3, 4, 5, 6, 7, 8, 977, or 988.", element_wise=True, accepted_values=[ "1", @@ -161,8 +155,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): 300, name="ct_credit_product_ff.invalid_text_length", description=( - "'Free-form text field for other credit products' " - "must not exceed 300 characters in length." + "'Free-form text field for other credit products' must not exceed 300 characters in length." ), ) ], @@ -225,9 +218,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="ct_guarantee.duplicates_in_field", - description=( - "'Type of guarantee' should not contain duplicated values." - ), + description="'Type of guarantee' should not contain duplicated values.", element_wise=True, ), SBLCheck( @@ -250,10 +241,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): 0, 300, name="ct_guarantee_ff.invalid_text_length", - description=( - "'Free-form text field for other guarantee' must not " - "exceed 300 characters in length" - ), + description="'Free-form text field for other guarantee' must not exceed 300 characters in length", ), ], "phase_2": [ @@ -292,8 +280,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_valid_enum, name="ct_loan_term_flag.invalid_enum_value", description=( - "Each value in 'Loan term: NA/NP flag' (separated by " - " semicolons) must equal 900, 988, or 999." + "Each value in 'Loan term: NA/NP flag' (separated by semicolons) must equal 900, 988, or 999." ), element_wise=True, accepted_values=[ @@ -358,9 +345,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_greater_than_or_equal_to, name="ct_loan_term.invalid_numeric_value", - description=( - "When present, 'loan term' must be greater than or equal to 1." - ), + description="When present, 'loan term' must be greater than or equal to 1.", element_wise=True, min_value="1", accept_blank=True, @@ -368,10 +353,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_less_than, name="ct_loan_term.unreasonable_numeric_value", - description=( - "When present, 'loan term' should be less than 1200 (100" - " years)." - ), + description="When present, 'loan term' should be less than 1200 (100 years).", element_wise=True, max_value="1200", accept_blank=True, @@ -412,8 +394,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): has_valid_value_count, name="credit_purpose.invalid_number_of_values", description=( - "'Credit purpose' must contain at least one and at" - " most three values, separated by semicolons." + "'Credit purpose' must contain at least one and at most three values, separated by semicolons." ), element_wise=True, min_length=1, @@ -438,9 +419,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="credit_purpose.duplicates_in_field", - description=( - "'Credit purpose' should not contain duplicated values." - ), + description="'Credit purpose' should not contain duplicated values.", element_wise=True, ), ], @@ -452,8 +431,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): 300, name="credit_purpose_ff.invalid_text_length", description=( - "'Free-form text field for other credit purpose' " - " must not exceed 300 characters in length" + "'Free-form text field for other credit purpose' must not exceed 300 characters in length" ), ), ], @@ -473,10 +451,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( has_valid_value_count, name="credit_purpose_ff.invalid_number_of_values", - description=( - "'Other Credit purpose' must not contain more " - " than one other credit purpose." - ), + description="'Other Credit purpose' must not contain more than one other credit purpose.", element_wise=True, min_length=0, max_length=1, @@ -488,9 +463,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="amount_applied_for_flag.invalid_enum_value", - description=( - "'Amount applied For: NA/NP flag' must equal 900, 988, or 999." - ), + description="'Amount applied For: NA/NP flag' must equal 900, 988, or 999.", element_wise=True, accepted_values=[ "900", @@ -506,9 +479,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_number, name="amount_applied_for.invalid_numeric_format", - description=( - "When present, 'amount applied for' must be a numeric value." - ), + description="When present, 'amount applied for' must be a numeric value.", element_wise=True, accept_blank=True, ), @@ -529,9 +500,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_greater_than, name="amount_applied_for.invalid_numeric_value", - description=( - "When present, 'amount applied for' must be greater than 0." - ), + description="When present, 'amount applied for' must be greater than 0.", element_wise=True, min_value="0", accept_blank=True, @@ -543,10 +512,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_number, name="amount_approved.invalid_numeric_format", - description=( - "When present, 'amount approved or originated' " - "must be a numeric value." - ), + description="When present, 'amount approved or originated' must be a numeric value.", element_wise=True, accept_blank=True, ), @@ -555,10 +521,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_greater_than, name="amount_approved.invalid_numeric_value", - description=( - "When present, 'amount approved or originated' " - "must be greater than 0." - ), + description="When present, 'amount approved or originated' must be greater than 0.", element_wise=True, min_value="0", accept_blank=True, @@ -669,10 +632,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_date, name="action_taken_date.invalid_date_format", - description=( - "'Action taken date' must be a real calendar" - " date using YYYYMMDD format." - ), + description="'Action taken date' must be a real calendar date using YYYYMMDD format.", element_wise=True, ), ], @@ -692,10 +652,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_date_after, name="action_taken_date.date_value_conflict", - description=( - "The date indicated by 'action taken date'" - " must occur on or after 'application date'." - ), + description="The date indicated by 'action taken date' must occur on or after 'application date'.", groupby="app_date", ), SBLCheck( @@ -741,8 +698,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): has_valid_value_count, name="denial_reasons.invalid_number_of_values", description=( - "'Denial reason(s)' must contain at least one and at most four" - "values, separated by semicolons." + "'Denial reason(s)' must contain at least one and at most fourvalues, separated by semicolons." ), element_wise=True, min_length=1, @@ -787,9 +743,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="denial_reasons.duplicates_in_field", - description=( - "'Denial reason(s)' should not contain duplicated values." - ), + description="'Denial reason(s)' should not contain duplicated values.", element_wise=True, ), ], @@ -801,8 +755,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): max_value=300, name="denial_reasons_ff.invalid_text_length", description=( - "'Free-form text field for other denial reason(s)'" - "must not exceed 300 characters in length." + "'Free-form text field for other denial reason(s)'must not exceed 300 characters in length." ), ), ], @@ -849,9 +802,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_number, name="pricing_init_rate_period.invalid_numeric_format", - description=( - "When present, 'initial rate period' must be a whole number.", - ), + description=("When present, 'initial rate period' must be a whole number.",), element_wise=True, accept_blank=True, ), @@ -875,9 +826,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_greater_than, name="pricing_init_rate_period.invalid_numeric_value", - description=( - "When present, 'initial rate period' must be greater than 0", - ), + description=("When present, 'initial rate period' must be greater than 0",), element_wise=True, min_value="0", accept_blank=True, @@ -889,10 +838,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_number, name="pricing_fixed_rate.invalid_numeric_format", - description=( - "When present, 'fixed rate: interest rate'" - " must be a numeric value." - ), + description="When present, 'fixed rate: interest rate' must be a numeric value.", element_wise=True, accept_blank=True, ), @@ -916,10 +862,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_greater_than, name="pricing_fixed_rate.unreasonable_numeric_value", - description=( - "When present, 'fixed rate: interest rate'" - " should generally be greater than 0.1." - ), + description="When present, 'fixed rate: interest rate' should generally be greater than 0.1.", element_wise=True, min_value="0.1", accept_blank=True, @@ -931,10 +874,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_number, name="pricing_adj_margin.invalid_numeric_format", - description=( - "When present, 'adjustable rate transaction:" - " margin' must be a numeric value." - ), + description="When present, 'adjustable rate transaction: margin' must be a numeric value.", element_wise=True, accept_blank=True, ), @@ -959,8 +899,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_greater_than, name="pricing_adj_margin.unreasonable_numeric_value", description=( - "When present, 'adjustable rate transaction:" - " margin' should generally be greater than 0.1." + "When present, 'adjustable rate transaction: margin' should generally be greater than 0.1." ), element_wise=True, min_value="0.1", @@ -1032,8 +971,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): max_value=300, name="pricing_adj_index_name_ff.invalid_text_length", description=( - "'Adjustable rate transaction: index name: other' must not" - " exceed 300 characters in length." + "'Adjustable rate transaction: index name: other' must not exceed 300 characters in length." ), ), ], @@ -1059,10 +997,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_number, name="pricing_adj_index_value.invalid_numeric_format", - description=( - "When present, 'adjustable rate transaction:" - " index value' must be a numeric value." - ), + description="When present, 'adjustable rate transaction: index value' must be a numeric value.", element_wise=True, accept_blank=True, ), @@ -1119,9 +1054,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_number, name="pricing_initial_charges.invalid_numeric_format", - description=( - "When present, 'initial annual charges' must be anumeric value." - ), + description="When present, 'initial annual charges' must be anumeric value.", element_wise=True, accept_blank=True, ), @@ -1207,9 +1140,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="pricing_prepenalty_allowed.invalid_enum_value", - description=( - "'Prepayment penalty could be imposed' must equal 1, 2, or 999." - ), + description="'Prepayment penalty could be imposed' must equal 1, 2, or 999.", element_wise=True, accepted_values=[ "1", @@ -1241,9 +1172,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="census_tract_adr_type.invalid_enum_value", - description=( - "'Census tract: type of address' must equal 1, 2, 3, or 988." - ), + description="'Census tract: type of address' must equal 1, 2, 3, or 988.", element_wise=True, accepted_values=[ "1", @@ -1260,10 +1189,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( has_correct_length, name="census_tract_number.invalid_text_length", - description=( - "When present, 'census tract: tract number' must " - "be a GEOID with exactly 11 digits." - ), + description="When present, 'census tract: tract number' must be a GEOID with exactly 11 digits.", element_wise=True, accepted_length=11, accept_blank=True, @@ -1307,9 +1233,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="gross_annual_revenue_flag.invalid_enum_value", - description=( - "'Gross annual revenue: NP flag' must equal 900 or 988." - ), + description="'Gross annual revenue: NP flag' must equal 900 or 988.", element_wise=True, accepted_values=[ "900", @@ -1324,9 +1248,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_number, name="gross_annual_revenue.invalid_numeric_format", - description=( - "When present, 'gross annual revenue' must be a numeric value." - ), + description="When present, 'gross annual revenue' must be a numeric value.", element_wise=True, accept_blank=True, ), @@ -1352,8 +1274,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_valid_enum, name="naics_code_flag.invalid_enum_value", description=( - "'North American Industry Classification System (NAICS) " - "code: NP flag' must equal 900 or 988." + "'North American Industry Classification System (NAICS) code: NP flag' must equal 900 or 988." ), element_wise=True, accepted_values=[ @@ -1419,10 +1340,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="number_of_workers.invalid_enum_value", - description=( - "'Number of workers' must equal 1, 2, 3, 4, 5, 6, 7, 8, 9," - " or 988." - ), + description="'Number of workers' must equal 1, 2, 3, 4, 5, 6, 7, 8, 9, or 988.", element_wise=True, accepted_values=[ "1", @@ -1445,10 +1363,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="time_in_business_type.invalid_enum_value", - description=( - "'Time in business: type of response'" - " must equal 1, 2, 3, or 988." - ), + description="'Time in business: type of response' must equal 1, 2, 3, or 988.", element_wise=True, accepted_values=[ "1", @@ -1465,9 +1380,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_number, name="time_in_business.invalid_numeric_format", - description=( - "When present, 'time in business' must be a whole number." - ), + description="When present, 'time in business' must be a whole number.", element_wise=True, accept_blank=True, ), @@ -1476,10 +1389,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_greater_than_or_equal_to, name="time_in_business.invalid_numeric_value", - description=( - "When present, 'time in business'" - " must be greater than or equal to 0." - ), + description="When present, 'time in business' must be greater than or equal to 0.", element_wise=True, min_value="0", accept_blank=True, @@ -1525,9 +1435,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( has_valid_value_count, name="business_ownership_status.invalid_number_of_values", - description=( - "'Business ownership status' must contain at least one value." - ), + description="'Business ownership status' must contain at least one value.", element_wise=True, min_length=1, ), @@ -1535,10 +1443,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="business_ownership_status.duplicates_in_field", - description=( - "'Business ownership status' should" - " not contain duplicated values." - ), + description="'Business ownership status' should not contain duplicated values.", element_wise=True, ), SBLCheck( @@ -1562,9 +1467,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="num_principal_owners_flag.invalid_enum_value", - description=( - "'Number of principal owners: NP flag' must equal 900 or 988." - ), + description="'Number of principal owners: NP flag' must equal 900 or 988.", element_wise=True, accepted_values=[ "900", @@ -1777,10 +1680,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="num_principal_owners.invalid_enum_value", - description=( - "When present, 'number of principal owners' must equal " - "0, 1, 2, 3, or 4." - ), + description="When present, 'number of principal owners' must equal 0, 1, 2, 3, or 4.", element_wise=True, accepted_values=["0", "1", "2", "3", "4"], accept_blank=True, @@ -1832,10 +1732,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="po_1_ethnicity.duplicates_in_field", - description=( - "'Ethnicity of principal owner 1' should" - " not contain duplicated values." - ), + description="'Ethnicity of principal owner 1' should not contain duplicated values.", element_wise=True, ), SBLCheck( @@ -1939,10 +1836,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="po_1_race.duplicates_in_field", - description=( - "'Race of principal owner 1' should" - " not contain duplicated values." - ), + description="'Race of principal owner 1' should not contain duplicated values.", element_wise=True, ), SBLCheck( @@ -2096,10 +1990,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="po_1_gender_flag.invalid_enum_value", - description=( - "When present, 'sex/gender of principal" - " owner 1: NP flag' must equal 1, 966, or 988." - ), + description="When present, 'sex/gender of principal owner 1: NP flag' must equal 1, 966, or 988.", element_wise=True, accepted_values=[ "1", @@ -2174,10 +2065,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="po_2_ethnicity.duplicates_in_field", - description=( - "'Ethnicity of principal owner 2' should" - " not contain duplicated values." - ), + description="'Ethnicity of principal owner 2' should not contain duplicated values.", element_wise=True, ), SBLCheck( @@ -2281,10 +2169,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="po_2_race.duplicates_in_field", - description=( - "'Race of principal owner 2' should" - " not contain duplicated values." - ), + description="'Race of principal owner 2' should not contain duplicated values.", element_wise=True, ), SBLCheck( @@ -2438,10 +2323,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="po_2_gender_flag.invalid_enum_value", - description=( - "When present, 'sex/gender of principal" - " owner 2: NP flag' must equal 1, 966, or 988." - ), + description="When present, 'sex/gender of principal owner 2: NP flag' must equal 1, 966, or 988.", element_wise=True, accepted_values=[ "1", @@ -2516,10 +2398,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="po_3_ethnicity.duplicates_in_field", - description=( - "'Ethnicity of principal owner 3' should" - " not contain duplicated values." - ), + description="'Ethnicity of principal owner 3' should not contain duplicated values.", element_wise=True, ), SBLCheck( @@ -2623,10 +2502,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="po_3_race.duplicates_in_field", - description=( - "'Race of principal owner 3' should" - " not contain duplicated values." - ), + description="'Race of principal owner 3' should not contain duplicated values.", element_wise=True, ), SBLCheck( @@ -2780,10 +2656,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="po_3_gender_flag.invalid_enum_value", - description=( - "When present, 'sex/gender of principal" - " owner 3: NP flag' must equal 1, 966, or 988." - ), + description="When present, 'sex/gender of principal owner 3: NP flag' must equal 1, 966, or 988.", element_wise=True, accepted_values=[ "1", @@ -2858,10 +2731,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="po_4_ethnicity.duplicates_in_field", - description=( - "'Ethnicity of principal owner 4' should" - " not contain duplicated values." - ), + description="'Ethnicity of principal owner 4' should not contain duplicated values.", element_wise=True, ), SBLCheck( @@ -2965,10 +2835,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): is_unique_in_field, warning=True, name="po_4_race.duplicates_in_field", - description=( - "'Race of principal owner 4' should" - " not contain duplicated values." - ), + description="'Race of principal owner 4' should not contain duplicated values.", element_wise=True, ), SBLCheck( @@ -3122,10 +2989,7 @@ def get_phase_1_and_2_validations_for_lei(lei: str = None): SBLCheck( is_valid_enum, name="po_4_gender_flag.invalid_enum_value", - description=( - "When present, 'sex/gender of principal" - " owner 4: NP flag' must equal 1, 966, or 988." - ), + description="When present, 'sex/gender of principal owner 4: NP flag' must equal 1, 966, or 988.", element_wise=True, accepted_values=[ "1", diff --git a/src/validator/schema_template.py b/src/validator/schema_template.py index 468e1a67..99151117 100644 --- a/src/validator/schema_template.py +++ b/src/validator/schema_template.py @@ -208,10 +208,7 @@ ), "naics_code_flag": Column( str, - title=( - "Field 38: North American Industry Classification System (NAICS)" - " code: NP flag" - ), + title="Field 38: North American Industry Classification System (NAICS) code: NP flag", checks=[], ), "naics_code": Column( @@ -256,10 +253,7 @@ ), "po_1_ethnicity_ff": Column( str, - title=( - "Field 47: Ethnicity of principal owner 1: free-form text field for" - "other Hispanic or Latino ethnicity" - ), + title="Field 47: Ethnicity of principal owner 1: free-form text field forother Hispanic or Latino ethnicity", checks=[], ), "po_1_race": Column( @@ -277,26 +271,17 @@ ), "po_1_race_asian_ff": Column( str, - title=( - "Field 50: Race of principal owner 1: free-form text field for other" - "Asian race" - ), + title="Field 50: Race of principal owner 1: free-form text field for otherAsian race", checks=[], ), "po_1_race_baa_ff": Column( str, - title=( - "Field 51: Race of principal owner 1: free-form text field for other" - "Black or African American race" - ), + title="Field 51: Race of principal owner 1: free-form text field for otherBlack or African American race", checks=[], ), "po_1_race_pi_ff": Column( str, - title=( - "Field 52: Race of principal owner 1: free-form text field for other" - "Pacific Islander race" - ), + title="Field 52: Race of principal owner 1: free-form text field for otherPacific Islander race", checks=[], ), "po_1_gender_flag": Column( @@ -306,10 +291,7 @@ ), "po_1_gender_ff": Column( str, - title=( - "Field 54: Sex/gender of principal owner 1: free-form text field for" - "self-identified sex/gender" - ), + title="Field 54: Sex/gender of principal owner 1: free-form text field forself-identified sex/gender", checks=[], ), "po_2_ethnicity": Column( @@ -319,10 +301,7 @@ ), "po_2_ethnicity_ff": Column( str, - title=( - "Field 56: Ethnicity of principal owner 2: free-form text field for" - "other Hispanic or Latino ethnicity" - ), + title="Field 56: Ethnicity of principal owner 2: free-form text field forother Hispanic or Latino ethnicity", checks=[], ), "po_2_race": Column( @@ -340,26 +319,17 @@ ), "po_2_race_asian_ff": Column( str, - title=( - "Field 59: Race of principal owner 2: free-form text field for other" - "Asian race" - ), + title="Field 59: Race of principal owner 2: free-form text field for otherAsian race", checks=[], ), "po_2_race_baa_ff": Column( str, - title=( - "Field 60: Race of principal owner 2: free-form text field for other" - "Black or African American race" - ), + title="Field 60: Race of principal owner 2: free-form text field for otherBlack or African American race", checks=[], ), "po_2_race_pi_ff": Column( str, - title=( - "Field 61: Race of principal owner 2: free-form text field for other" - "Pacific Islander race" - ), + title="Field 61: Race of principal owner 2: free-form text field for otherPacific Islander race", checks=[], ), "po_2_gender_flag": Column( @@ -369,10 +339,7 @@ ), "po_2_gender_ff": Column( str, - title=( - "Field 63: Sex/gender of principal owner 2: free-form text field for" - "self-identified sex/gender" - ), + title="Field 63: Sex/gender of principal owner 2: free-form text field forself-identified sex/gender", checks=[], ), "po_3_ethnicity": Column( @@ -382,10 +349,7 @@ ), "po_3_ethnicity_ff": Column( str, - title=( - "Field 65: Ethnicity of principal owner 3: free-form text field for" - "other Hispanic or Latino ethnicity" - ), + title="Field 65: Ethnicity of principal owner 3: free-form text field forother Hispanic or Latino ethnicity", checks=[], ), "po_3_race": Column( @@ -403,26 +367,17 @@ ), "po_3_race_asian_ff": Column( str, - title=( - "Field 68: Race of principal owner 3: free-form text field for other" - "Asian race" - ), + title="Field 68: Race of principal owner 3: free-form text field for otherAsian race", checks=[], ), "po_3_race_baa_ff": Column( str, - title=( - "Field 69: Race of principal owner 3: free-form text field for other" - "Black or African American race" - ), + title="Field 69: Race of principal owner 3: free-form text field for otherBlack or African American race", checks=[], ), "po_3_race_pi_ff": Column( str, - title=( - "Field 70: Race of principal owner 3: free-form text field for other" - "Pacific Islander race" - ), + title="Field 70: Race of principal owner 3: free-form text field for otherPacific Islander race", checks=[], ), "po_3_gender_flag": Column( @@ -432,10 +387,7 @@ ), "po_3_gender_ff": Column( str, - title=( - "Field 72: Sex/gender of principal owner 3: free-form text field for" - "self-identified sex/gender" - ), + title="Field 72: Sex/gender of principal owner 3: free-form text field forself-identified sex/gender", checks=[], ), "po_4_ethnicity": Column( @@ -445,10 +397,7 @@ ), "po_4_ethnicity_ff": Column( str, - title=( - "Field 74: Ethnicity of principal owner 4: free-form text field for" - "other Hispanic or Latino ethnicity" - ), + title="Field 74: Ethnicity of principal owner 4: free-form text field forother Hispanic or Latino ethnicity", checks=[], ), "po_4_race": Column( @@ -466,26 +415,17 @@ ), "po_4_race_asian_ff": Column( str, - title=( - "Field 77: Race of principal owner 4: free-form text field for other" - "Asian race" - ), + title="Field 77: Race of principal owner 4: free-form text field for otherAsian race", checks=[], ), "po_4_race_baa_ff": Column( str, - title=( - "Field 78: Race of principal owner 4: free-form text field for other" - "Black or African American race" - ), + title="Field 78: Race of principal owner 4: free-form text field for otherBlack or African American race", checks=[], ), "po_4_race_pi_ff": Column( str, - title=( - "Field 79: Race of principal owner 4: free-form text field for other" - "Pacific Islander race" - ), + title="Field 79: Race of principal owner 4: free-form text field for otherPacific Islander race", checks=[], ), "po_4_gender_flag": Column( @@ -495,10 +435,7 @@ ), "po_4_gender_ff": Column( str, - title=( - "Field 81: Sex/gender of principal owner 4: free-form text field for" - "self-identified sex/gender" - ), + title="Field 81: Sex/gender of principal owner 4: free-form text field forself-identified sex/gender", checks=[], ), }