diff --git a/focus_validator/config_objects/focus_to_pandera_schema_converter.py b/focus_validator/config_objects/focus_to_pandera_schema_converter.py index 826836c..410fc51 100644 --- a/focus_validator/config_objects/focus_to_pandera_schema_converter.py +++ b/focus_validator/config_objects/focus_to_pandera_schema_converter.py @@ -1,3 +1,4 @@ +import os from itertools import groupby from typing import Dict, List, Optional, Set, Union @@ -151,7 +152,7 @@ def generate_pandera_schema( for rule in rules: if isinstance(rule, InvalidRule): checklist[rule.rule_path] = ChecklistObject( - check_name=rule.rule_path, + check_name=os.path.splitext(os.path.basename(rule.rule_path))[0], column_id="Unknown", error=f"{rule.error_type}: {rule.error}", status=ChecklistObjectStatus.ERRORED, diff --git a/focus_validator/config_objects/rule.py b/focus_validator/config_objects/rule.py index ddf71f7..2ac2bdc 100644 --- a/focus_validator/config_objects/rule.py +++ b/focus_validator/config_objects/rule.py @@ -1,3 +1,4 @@ +import os from typing import Optional, Union import yaml @@ -46,6 +47,8 @@ def root_val(cls, values): """ Root validator that checks for all options passed in the config and generate missing options. """ + if values is None: + values = {} check = values.get("check") check_friendly_name = values.get("check_friendly_name") @@ -59,10 +62,10 @@ def root_val(cls, values): check_type_friendly_name = check.__class__.__name__ values["check_type_friendly_name"] = check_type_friendly_name - if check_friendly_name is None and column_id is not None: - values["check_friendly_name"] = generate_check_friendly_name( - check=check, column_id=column_id - ) + if check_friendly_name is None and column_id is not None: + values["check_friendly_name"] = generate_check_friendly_name( + check=check, column_id=column_id + ) return values @@ -70,6 +73,8 @@ def root_val(cls, values): def load_yaml( rule_path, column_namespace: Optional[str] = None ) -> Union["Rule", InvalidRule]: + rule_path_basename = os.path.splitext(os.path.basename(rule_path))[0] + try: with open(rule_path, "r") as f: rule_obj = yaml.safe_load(f) @@ -81,10 +86,15 @@ def load_yaml( ): rule_obj["column"] = f"{column_namespace}:{rule_obj['column']}" + if isinstance(rule_obj, dict) and "check_id" not in rule_obj: + rule_obj["check_id"] = rule_path_basename + return Rule.model_validate(rule_obj) except Exception as e: return InvalidRule( - rule_path=rule_path, error=str(e), error_type=e.__class__.__name__ + rule_path=rule_path_basename, + error=str(e), + error_type=e.__class__.__name__, ) diff --git a/focus_validator/data_loaders/data_loader.py b/focus_validator/data_loaders/data_loader.py index 5232192..b00d0b3 100644 --- a/focus_validator/data_loaders/data_loader.py +++ b/focus_validator/data_loaders/data_loader.py @@ -19,13 +19,13 @@ def __init__(self, data_filename): def find_data_loader(self): file_mime_type = get_file_mime_type(self.data_filename) - if file_mime_type in ["ASCII text", "CSV text"]: + if file_mime_type in ["ASCII text", "CSV text", "CSV ASCII text"]: return CSVDataLoader elif file_mime_type == "Apache Parquet": return ParquetDataLoader else: raise FocusNotImplementedError( - msg=f"Validator for file_type {file_mime_type} not implemented yet." + msg=f"Validator for file_type '{file_mime_type}' not implemented yet." ) def load(self): diff --git a/focus_validator/outputter/outputter_console.py b/focus_validator/outputter/outputter_console.py index 9c6260d..a72d166 100644 --- a/focus_validator/outputter/outputter_console.py +++ b/focus_validator/outputter/outputter_console.py @@ -1,4 +1,5 @@ import math + import pandas as pd from tabulate import tabulate @@ -61,35 +62,42 @@ def write(self, result_set: ValidationResult): print(tabulate(checklist, headers="keys", tablefmt="psql")) if result_set.failure_cases is not None: - aggregated_failures = result_set.failure_cases.groupby(by=['Check Name', 'Column', 'Description'], as_index=False).aggregate(lambda x: maybe_collapse_range(x.unique().tolist())) + aggregated_failures = result_set.failure_cases.groupby( + by=["Check Name", "Column", "Description"], as_index=False + ).aggregate(lambda x: collapse_occurrence_range(x.unique().tolist())) print("Checks summary:") print( tabulate( - tabular_data=aggregated_failures, # type: ignore + tabular_data=aggregated_failures, # type: ignore headers="keys", tablefmt="psql", ) ) -def maybe_collapse_range(l): + +def collapse_occurrence_range(occurrence_range: list): start = None i = None collapsed = [] - for n in sorted(l): + for n in sorted(occurrence_range): if not isinstance(n, int) and not (isinstance(n, float) and not math.isnan(n)): - return l + return occurrence_range elif i is None: - start = i = n + start = i = int(n) elif n == i + 1: - i = n + i = int(n) elif i: - if i == start: collapsed.append(f'{int(start)}') - else: collapsed.append(f'{int(start)}-{int(i)}') - start = i = n + if i == start: + collapsed.append(f"{start}") + else: + collapsed.append(f"{start}-{i}") + start = i = int(n) if start is not None: - if i == start: collapsed.append(int(start)) - else: collapsed.append(f'{int(start)}-{int(i)}') + if i == start: + collapsed.append(f"{start}") + else: + collapsed.append(f"{start}-{i}") return collapsed diff --git a/focus_validator/rules/base_rule_definitions/FV-M002-0001.yaml b/focus_validator/rules/base_rule_definitions/AmortizedCost_IsDecimal.yaml similarity index 69% rename from focus_validator/rules/base_rule_definitions/FV-M002-0001.yaml rename to focus_validator/rules/base_rule_definitions/AmortizedCost_IsDecimal.yaml index b05e342..0d70c5c 100644 --- a/focus_validator/rules/base_rule_definitions/FV-M002-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/AmortizedCost_IsDecimal.yaml @@ -1,4 +1,3 @@ -check_id: FV-M002-0001 column_id: AmortizedCost check: data_type: decimal diff --git a/focus_validator/rules/base_rule_definitions/FV-M002-0002.yaml b/focus_validator/rules/base_rule_definitions/AmortizedCost_NotNull.yaml similarity index 69% rename from focus_validator/rules/base_rule_definitions/FV-M002-0002.yaml rename to focus_validator/rules/base_rule_definitions/AmortizedCost_NotNull.yaml index 274fe38..dc45435 100644 --- a/focus_validator/rules/base_rule_definitions/FV-M002-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/AmortizedCost_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-M002-0002 column_id: AmortizedCost check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-M002-0003.yaml b/focus_validator/rules/base_rule_definitions/AmortizedCost_Required.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-M002-0003.yaml rename to focus_validator/rules/base_rule_definitions/AmortizedCost_Required.yaml index 6eadde2..1225820 100644 --- a/focus_validator/rules/base_rule_definitions/FV-M002-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/AmortizedCost_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-M002-0003 column_id: AmortizedCost check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D014-0001.yaml b/focus_validator/rules/base_rule_definitions/AvailabilityZone_IsString.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D014-0001.yaml rename to focus_validator/rules/base_rule_definitions/AvailabilityZone_IsString.yaml index 571abbe..05a737a 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D014-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/AvailabilityZone_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D014-0001 column_id: AvailabilityZone check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D014-0002.yaml b/focus_validator/rules/base_rule_definitions/AvailabilityZone_Nullable.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D014-0002.yaml rename to focus_validator/rules/base_rule_definitions/AvailabilityZone_Nullable.yaml index 5c3522c..326126e 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D014-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/AvailabilityZone_Nullable.yaml @@ -1,4 +1,3 @@ -check_id: FV-D014-0002 column_id: AvailabilityZone check: allow_nulls: true diff --git a/focus_validator/rules/base_rule_definitions/FV-M001-0001.yaml b/focus_validator/rules/base_rule_definitions/BilledCost_IsDecimal.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-M001-0001.yaml rename to focus_validator/rules/base_rule_definitions/BilledCost_IsDecimal.yaml index 554cac5..ff3039a 100644 --- a/focus_validator/rules/base_rule_definitions/FV-M001-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/BilledCost_IsDecimal.yaml @@ -1,4 +1,3 @@ -check_id: FV-M001-0001 column_id: BilledCost check: data_type: decimal diff --git a/focus_validator/rules/base_rule_definitions/FV-M001-0002.yaml b/focus_validator/rules/base_rule_definitions/BilledCost_NotNull.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-M001-0002.yaml rename to focus_validator/rules/base_rule_definitions/BilledCost_NotNull.yaml index fcac9d7..d18817f 100644 --- a/focus_validator/rules/base_rule_definitions/FV-M001-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/BilledCost_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-M001-0002 column_id: BilledCost check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-M001-0003.yaml b/focus_validator/rules/base_rule_definitions/BilledCost_Required.yaml similarity index 67% rename from focus_validator/rules/base_rule_definitions/FV-M001-0003.yaml rename to focus_validator/rules/base_rule_definitions/BilledCost_Required.yaml index 35a9787..7407c46 100644 --- a/focus_validator/rules/base_rule_definitions/FV-M001-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/BilledCost_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-M001-0003 column_id: BilledCost check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D010-0001.yaml b/focus_validator/rules/base_rule_definitions/BilledCurrency_IsCurrencyCode.yaml similarity index 72% rename from focus_validator/rules/base_rule_definitions/FV-D010-0001.yaml rename to focus_validator/rules/base_rule_definitions/BilledCurrency_IsCurrencyCode.yaml index 49dca29..5a26704 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D010-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/BilledCurrency_IsCurrencyCode.yaml @@ -1,4 +1,3 @@ -check_id: FV-D010-0001 column_id: BilledCurrency check: data_type: currency-code diff --git a/focus_validator/rules/base_rule_definitions/FV-D010-0002.yaml b/focus_validator/rules/base_rule_definitions/BilledCurrency_NotNull.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D010-0002.yaml rename to focus_validator/rules/base_rule_definitions/BilledCurrency_NotNull.yaml index ddae15e..1094457 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D010-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/BilledCurrency_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D010-0002 column_id: BilledCurrency check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D010-0003.yaml b/focus_validator/rules/base_rule_definitions/BilledCurrency_Required.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D010-0003.yaml rename to focus_validator/rules/base_rule_definitions/BilledCurrency_Required.yaml index 9dcd117..76a1828 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D010-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/BilledCurrency_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D010-0003 column_id: BilledCurrency check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D006-0001.yaml b/focus_validator/rules/base_rule_definitions/BillingAccountId_IsString.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D006-0001.yaml rename to focus_validator/rules/base_rule_definitions/BillingAccountId_IsString.yaml index d8effe8..ce3124a 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D006-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingAccountId_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D006-0001 column_id: BillingAccountId check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D006-0002.yaml b/focus_validator/rules/base_rule_definitions/BillingAccountId_NotNull.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D006-0002.yaml rename to focus_validator/rules/base_rule_definitions/BillingAccountId_NotNull.yaml index f8eebe0..2fbb907 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D006-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingAccountId_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D006-0002 column_id: BillingAccountId check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D006-0003.yaml b/focus_validator/rules/base_rule_definitions/BillingAccountId_Required.yaml similarity index 69% rename from focus_validator/rules/base_rule_definitions/FV-D006-0003.yaml rename to focus_validator/rules/base_rule_definitions/BillingAccountId_Required.yaml index d08c2e0..3e61188 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D006-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingAccountId_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D006-0003 column_id: BillingAccountId check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D005-0001.yaml b/focus_validator/rules/base_rule_definitions/BillingAccountName_IsString.yaml similarity index 71% rename from focus_validator/rules/base_rule_definitions/FV-D005-0001.yaml rename to focus_validator/rules/base_rule_definitions/BillingAccountName_IsString.yaml index 46e7872..8408869 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D005-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingAccountName_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D005-0001 column_id: BillingAccountName check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D005-0002.yaml b/focus_validator/rules/base_rule_definitions/BillingAccountName_Nullable.yaml similarity index 71% rename from focus_validator/rules/base_rule_definitions/FV-D005-0002.yaml rename to focus_validator/rules/base_rule_definitions/BillingAccountName_Nullable.yaml index ac2c851..9115bbf 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D005-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingAccountName_Nullable.yaml @@ -1,4 +1,3 @@ -check_id: FV-D005-0002 column_id: BillingAccountName check: allow_nulls: True diff --git a/focus_validator/rules/base_rule_definitions/FV-D005-0003.yaml b/focus_validator/rules/base_rule_definitions/BillingAccountName_Required.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D005-0003.yaml rename to focus_validator/rules/base_rule_definitions/BillingAccountName_Required.yaml index 8d091b3..672716f 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D005-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingAccountName_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D005-0003 column_id: BillingAccountName check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D011-0001.yaml b/focus_validator/rules/base_rule_definitions/BillingPeriodEnd_IsDateTime.yaml similarity index 71% rename from focus_validator/rules/base_rule_definitions/FV-D011-0001.yaml rename to focus_validator/rules/base_rule_definitions/BillingPeriodEnd_IsDateTime.yaml index d97835b..dbe136a 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D011-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingPeriodEnd_IsDateTime.yaml @@ -1,4 +1,3 @@ -check_id: FV-D011-0001 column_id: BillingPeriodEnd check: data_type: datetime diff --git a/focus_validator/rules/base_rule_definitions/FV-D011-0002.yaml b/focus_validator/rules/base_rule_definitions/BillingPeriodEnd_NotNull.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D011-0002.yaml rename to focus_validator/rules/base_rule_definitions/BillingPeriodEnd_NotNull.yaml index 1210ee0..f8a50cf 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D011-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingPeriodEnd_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D011-0002 column_id: BillingPeriodEnd check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D011-0003.yaml b/focus_validator/rules/base_rule_definitions/BillingPeriodEnd_Required.yaml similarity index 69% rename from focus_validator/rules/base_rule_definitions/FV-D011-0003.yaml rename to focus_validator/rules/base_rule_definitions/BillingPeriodEnd_Required.yaml index 75224a1..b864b76 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D011-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingPeriodEnd_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D011-0003 column_id: BillingPeriodEnd check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D012-0001.yaml b/focus_validator/rules/base_rule_definitions/BillingPeriodStart_IsDateTime.yaml similarity index 71% rename from focus_validator/rules/base_rule_definitions/FV-D012-0001.yaml rename to focus_validator/rules/base_rule_definitions/BillingPeriodStart_IsDateTime.yaml index f6d695f..58e567e 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D012-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingPeriodStart_IsDateTime.yaml @@ -1,4 +1,3 @@ -check_id: FV-D012-0001 column_id: BillingPeriodStart check: data_type: datetime diff --git a/focus_validator/rules/base_rule_definitions/FV-D012-0002.yaml b/focus_validator/rules/base_rule_definitions/BillingPeriodStart_NotNull.yaml similarity index 71% rename from focus_validator/rules/base_rule_definitions/FV-D012-0002.yaml rename to focus_validator/rules/base_rule_definitions/BillingPeriodStart_NotNull.yaml index b7d93bf..7c9b272 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D012-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingPeriodStart_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D012-0002 column_id: BillingPeriodStart check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D012-0003.yaml b/focus_validator/rules/base_rule_definitions/BillingPeriodStart_Required.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D012-0003.yaml rename to focus_validator/rules/base_rule_definitions/BillingPeriodStart_Required.yaml index 049e524..d2ae0c2 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D012-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/BillingPeriodStart_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D012-0003 column_id: BillingPeriodStart check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D017-0001.yaml b/focus_validator/rules/base_rule_definitions/ChargePeriodEnd_IsDateTime.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D017-0001.yaml rename to focus_validator/rules/base_rule_definitions/ChargePeriodEnd_IsDateTime.yaml index 78bcef0..2e5f049 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D017-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/ChargePeriodEnd_IsDateTime.yaml @@ -1,4 +1,3 @@ -check_id: FV-D017-0001 column_id: ChargePeriodEnd check: data_type: datetime diff --git a/focus_validator/rules/base_rule_definitions/FV-D017-0002.yaml b/focus_validator/rules/base_rule_definitions/ChargePeriodEnd_NotNull.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D017-0002.yaml rename to focus_validator/rules/base_rule_definitions/ChargePeriodEnd_NotNull.yaml index 15b43c4..5157bdd 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D017-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/ChargePeriodEnd_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D017-0002 column_id: ChargePeriodEnd check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D017-0003.yaml b/focus_validator/rules/base_rule_definitions/ChargePeriodEnd_Required.yaml similarity index 69% rename from focus_validator/rules/base_rule_definitions/FV-D017-0003.yaml rename to focus_validator/rules/base_rule_definitions/ChargePeriodEnd_Required.yaml index 08e058e..b91ee77 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D017-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/ChargePeriodEnd_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D017-0003 column_id: ChargePeriodEnd check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D016-0001.yaml b/focus_validator/rules/base_rule_definitions/ChargePeriodStart_IsDateTime.yaml similarity index 71% rename from focus_validator/rules/base_rule_definitions/FV-D016-0001.yaml rename to focus_validator/rules/base_rule_definitions/ChargePeriodStart_IsDateTime.yaml index 4ea40e2..4b9ad12 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D016-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/ChargePeriodStart_IsDateTime.yaml @@ -1,4 +1,3 @@ -check_id: FV-D016-0001 column_id: ChargePeriodStart check: data_type: datetime diff --git a/focus_validator/rules/base_rule_definitions/FV-D016-0002.yaml b/focus_validator/rules/base_rule_definitions/ChargePeriodStart_NotNull.yaml similarity index 71% rename from focus_validator/rules/base_rule_definitions/FV-D016-0002.yaml rename to focus_validator/rules/base_rule_definitions/ChargePeriodStart_NotNull.yaml index bed8364..d40abd4 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D016-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/ChargePeriodStart_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D016-0002 column_id: ChargePeriodStart check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D016-0003.yaml b/focus_validator/rules/base_rule_definitions/ChargePeriodStart_Required.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D016-0003.yaml rename to focus_validator/rules/base_rule_definitions/ChargePeriodStart_Required.yaml index d62ca89..aca0c01 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D016-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/ChargePeriodStart_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D016-0003 column_id: ChargePeriodStart check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D001-0003.yaml b/focus_validator/rules/base_rule_definitions/ChargeType_Enum.yaml similarity index 81% rename from focus_validator/rules/base_rule_definitions/FV-D001-0003.yaml rename to focus_validator/rules/base_rule_definitions/ChargeType_Enum.yaml index 825ad29..694456f 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D001-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/ChargeType_Enum.yaml @@ -1,4 +1,3 @@ -check_id: FV-D001-0003 column_id: ChargeType check: value_in: diff --git a/focus_validator/rules/base_rule_definitions/FV-D001-0001.yaml b/focus_validator/rules/base_rule_definitions/ChargeType_IsString.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D001-0001.yaml rename to focus_validator/rules/base_rule_definitions/ChargeType_IsString.yaml index 48277c2..8369e69 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D001-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/ChargeType_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D001-0001 column_id: ChargeType check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D001-0004.yaml b/focus_validator/rules/base_rule_definitions/ChargeType_NotNull.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D001-0004.yaml rename to focus_validator/rules/base_rule_definitions/ChargeType_NotNull.yaml index 0a37e9e..e3a8e80 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D001-0004.yaml +++ b/focus_validator/rules/base_rule_definitions/ChargeType_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D001-0004 column_id: ChargeType check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D001-0002.yaml b/focus_validator/rules/base_rule_definitions/ChargeType_Required.yaml similarity index 66% rename from focus_validator/rules/base_rule_definitions/FV-D001-0002.yaml rename to focus_validator/rules/base_rule_definitions/ChargeType_Required.yaml index 794bb8b..de31444 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D001-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/ChargeType_Required.yaml @@ -1,3 +1,2 @@ -check_id: FV-D001-0002 column_id: ChargeType check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D003-0001.yaml b/focus_validator/rules/base_rule_definitions/InvoiceIssuer_IsString.yaml similarity index 69% rename from focus_validator/rules/base_rule_definitions/FV-D003-0001.yaml rename to focus_validator/rules/base_rule_definitions/InvoiceIssuer_IsString.yaml index 15848b9..a98271b 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D003-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/InvoiceIssuer_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D003-0001 column_id: InvoiceIssuer check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D003-0002.yaml b/focus_validator/rules/base_rule_definitions/InvoiceIssuer_NotNull.yaml similarity index 69% rename from focus_validator/rules/base_rule_definitions/FV-D003-0002.yaml rename to focus_validator/rules/base_rule_definitions/InvoiceIssuer_NotNull.yaml index 5347a76..5e4060a 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D003-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/InvoiceIssuer_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D003-0002 column_id: InvoiceIssuer check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D004-0001.yaml b/focus_validator/rules/base_rule_definitions/Provider_IsString.yaml similarity index 67% rename from focus_validator/rules/base_rule_definitions/FV-D004-0001.yaml rename to focus_validator/rules/base_rule_definitions/Provider_IsString.yaml index 5b79316..6b5e61f 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D004-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/Provider_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D004-0001 column_id: Provider check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D004-0002.yaml b/focus_validator/rules/base_rule_definitions/Provider_NotNull.yaml similarity index 67% rename from focus_validator/rules/base_rule_definitions/FV-D004-0002.yaml rename to focus_validator/rules/base_rule_definitions/Provider_NotNull.yaml index 52e2f9e..dfdea5f 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D004-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/Provider_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D004-0002 column_id: Provider check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D004-0003.yaml b/focus_validator/rules/base_rule_definitions/Provider_Required.yaml similarity index 66% rename from focus_validator/rules/base_rule_definitions/FV-D004-0003.yaml rename to focus_validator/rules/base_rule_definitions/Provider_Required.yaml index 17e18d1..88906a7 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D004-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/Provider_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D004-0003 column_id: Provider check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D007-0001.yaml b/focus_validator/rules/base_rule_definitions/Publisher_IsString.yaml similarity index 67% rename from focus_validator/rules/base_rule_definitions/FV-D007-0001.yaml rename to focus_validator/rules/base_rule_definitions/Publisher_IsString.yaml index 4bba250..8502a38 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D007-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/Publisher_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D007-0001 column_id: Publisher check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D007-0002.yaml b/focus_validator/rules/base_rule_definitions/Publisher_NotNull.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D007-0002.yaml rename to focus_validator/rules/base_rule_definitions/Publisher_NotNull.yaml index 4f82b78..122fa87 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D007-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/Publisher_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D007-0002 column_id: Publisher check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D007-0003.yaml b/focus_validator/rules/base_rule_definitions/Publisher_Required.yaml similarity index 66% rename from focus_validator/rules/base_rule_definitions/FV-D007-0003.yaml rename to focus_validator/rules/base_rule_definitions/Publisher_Required.yaml index 94b52d4..9d4dc1e 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D007-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/Publisher_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D007-0003 column_id: Publisher check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D013-0001.yaml b/focus_validator/rules/base_rule_definitions/Region_IsString.yaml similarity index 66% rename from focus_validator/rules/base_rule_definitions/FV-D013-0001.yaml rename to focus_validator/rules/base_rule_definitions/Region_IsString.yaml index fc77602..8733163 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D013-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/Region_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D013-0001 column_id: Region check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D013-0002.yaml b/focus_validator/rules/base_rule_definitions/Region_NotNull.yaml similarity index 66% rename from focus_validator/rules/base_rule_definitions/FV-D013-0002.yaml rename to focus_validator/rules/base_rule_definitions/Region_NotNull.yaml index 19ba00c..fcc15a5 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D013-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/Region_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D013-0002 column_id: Region check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D013-0003.yaml b/focus_validator/rules/base_rule_definitions/Region_Required.yaml similarity index 65% rename from focus_validator/rules/base_rule_definitions/FV-D013-0003.yaml rename to focus_validator/rules/base_rule_definitions/Region_Required.yaml index e27245d..60968e1 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D013-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/Region_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D013-0003 column_id: Region check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D002-0001.yaml b/focus_validator/rules/base_rule_definitions/ResourceID_IsString.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D002-0001.yaml rename to focus_validator/rules/base_rule_definitions/ResourceID_IsString.yaml index fa8f571..42913bb 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D002-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/ResourceID_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D002-0001 column_id: ResourceID check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D002-0002.yaml b/focus_validator/rules/base_rule_definitions/ResourceID_Nullable.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D002-0002.yaml rename to focus_validator/rules/base_rule_definitions/ResourceID_Nullable.yaml index 862411d..f855723 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D002-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/ResourceID_Nullable.yaml @@ -1,4 +1,3 @@ -check_id: FV-D002-0002 column_id: ResourceID check: allow_nulls: true diff --git a/focus_validator/rules/base_rule_definitions/FV-D008-0001.yaml b/focus_validator/rules/base_rule_definitions/ResourceName_IsString.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D008-0001.yaml rename to focus_validator/rules/base_rule_definitions/ResourceName_IsString.yaml index 6aafb9c..06bc202 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D008-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/ResourceName_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D008-0001 column_id: ResourceName check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D008-0002.yaml b/focus_validator/rules/base_rule_definitions/ResourceName_Nullable.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D008-0002.yaml rename to focus_validator/rules/base_rule_definitions/ResourceName_Nullable.yaml index fd9878e..bcd02f8 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D008-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/ResourceName_Nullable.yaml @@ -1,4 +1,3 @@ -check_id: FV-D008-0002 column_id: ResourceName check: allow_nulls: true diff --git a/focus_validator/rules/base_rule_definitions/FV-D008-0003.yaml b/focus_validator/rules/base_rule_definitions/ResourceName_Required.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D008-0003.yaml rename to focus_validator/rules/base_rule_definitions/ResourceName_Required.yaml index 1821b6b..b713ea3 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D008-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/ResourceName_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D008-0003 column_id: ResourceName check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D015-0004.yaml b/focus_validator/rules/base_rule_definitions/ServiceCategory_Enum.yaml similarity index 95% rename from focus_validator/rules/base_rule_definitions/FV-D015-0004.yaml rename to focus_validator/rules/base_rule_definitions/ServiceCategory_Enum.yaml index fb68aae..85f90f3 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D015-0004.yaml +++ b/focus_validator/rules/base_rule_definitions/ServiceCategory_Enum.yaml @@ -1,4 +1,3 @@ -check_id: FV-D015-0004 column_id: ServiceCategory check_friendly_name: "ServiceCategory must have a value defined in spec." check: diff --git a/focus_validator/rules/base_rule_definitions/FV-D015-0001.yaml b/focus_validator/rules/base_rule_definitions/ServiceCategory_IsString.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D015-0001.yaml rename to focus_validator/rules/base_rule_definitions/ServiceCategory_IsString.yaml index 629223b..f359331 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D015-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/ServiceCategory_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D015-0001 column_id: ServiceCategory check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D015-0002.yaml b/focus_validator/rules/base_rule_definitions/ServiceCategory_NotNull.yaml similarity index 70% rename from focus_validator/rules/base_rule_definitions/FV-D015-0002.yaml rename to focus_validator/rules/base_rule_definitions/ServiceCategory_NotNull.yaml index a5f600b..e2825f6 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D015-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/ServiceCategory_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D015-0002 column_id: ServiceCategory check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D015-0003.yaml b/focus_validator/rules/base_rule_definitions/ServiceCategory_Required.yaml similarity index 69% rename from focus_validator/rules/base_rule_definitions/FV-D015-0003.yaml rename to focus_validator/rules/base_rule_definitions/ServiceCategory_Required.yaml index 7290024..ea364b3 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D015-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/ServiceCategory_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D015-0003 column_id: ServiceCategory check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D009-0001.yaml b/focus_validator/rules/base_rule_definitions/ServiceName_IsString.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D009-0001.yaml rename to focus_validator/rules/base_rule_definitions/ServiceName_IsString.yaml index b5956f1..7429b14 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D009-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/ServiceName_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D009-0001 column_id: ServiceName check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D009-0002.yaml b/focus_validator/rules/base_rule_definitions/ServiceName_NotNull.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D009-0002.yaml rename to focus_validator/rules/base_rule_definitions/ServiceName_NotNull.yaml index 8d0b787..2c62718 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D009-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/ServiceName_NotNull.yaml @@ -1,4 +1,3 @@ -check_id: FV-D009-0002 column_id: ServiceName check: allow_nulls: false diff --git a/focus_validator/rules/base_rule_definitions/FV-D009-0003.yaml b/focus_validator/rules/base_rule_definitions/ServiceName_Required.yaml similarity index 67% rename from focus_validator/rules/base_rule_definitions/FV-D009-0003.yaml rename to focus_validator/rules/base_rule_definitions/ServiceName_Required.yaml index fdede46..5c07502 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D009-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/ServiceName_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D009-0003 column_id: ServiceName check: column_required diff --git a/focus_validator/rules/base_rule_definitions/FV-D018-0001.yaml b/focus_validator/rules/base_rule_definitions/SubAccountName_IsString.yaml similarity index 69% rename from focus_validator/rules/base_rule_definitions/FV-D018-0001.yaml rename to focus_validator/rules/base_rule_definitions/SubAccountName_IsString.yaml index 904895a..5847d66 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D018-0001.yaml +++ b/focus_validator/rules/base_rule_definitions/SubAccountName_IsString.yaml @@ -1,4 +1,3 @@ -check_id: FV-D018-0001 column_id: SubAccountName check: data_type: string diff --git a/focus_validator/rules/base_rule_definitions/FV-D018-0002.yaml b/focus_validator/rules/base_rule_definitions/SubAccountName_Nullable.yaml similarity index 69% rename from focus_validator/rules/base_rule_definitions/FV-D018-0002.yaml rename to focus_validator/rules/base_rule_definitions/SubAccountName_Nullable.yaml index 8520687..d861749 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D018-0002.yaml +++ b/focus_validator/rules/base_rule_definitions/SubAccountName_Nullable.yaml @@ -1,4 +1,3 @@ -check_id: FV-D018-0002 column_id: SubAccountName check: allow_nulls: true diff --git a/focus_validator/rules/base_rule_definitions/FV-D018-0003.yaml b/focus_validator/rules/base_rule_definitions/SubAccountName_Required.yaml similarity index 68% rename from focus_validator/rules/base_rule_definitions/FV-D018-0003.yaml rename to focus_validator/rules/base_rule_definitions/SubAccountName_Required.yaml index 25ab012..f7a9d68 100644 --- a/focus_validator/rules/base_rule_definitions/FV-D018-0003.yaml +++ b/focus_validator/rules/base_rule_definitions/SubAccountName_Required.yaml @@ -1,4 +1,3 @@ -check_id: FV-D018-0003 column_id: SubAccountName check: column_required diff --git a/focus_validator/rules/version_sets.yaml b/focus_validator/rules/version_sets.yaml index 86a15d6..2a601a2 100644 --- a/focus_validator/rules/version_sets.yaml +++ b/focus_validator/rules/version_sets.yaml @@ -1,60 +1,60 @@ '0.5': -- FV-D001-0001.yaml -- FV-D001-0002.yaml -- FV-D001-0003.yaml -- FV-D001-0004.yaml -- FV-D002-0001.yaml -- FV-D002-0002.yaml -- FV-D003-0001.yaml -- FV-D003-0002.yaml -- FV-D004-0001.yaml -- FV-D004-0002.yaml -- FV-D004-0003.yaml -- FV-D005-0001.yaml -- FV-D005-0002.yaml -- FV-D005-0003.yaml -- FV-D006-0001.yaml -- FV-D006-0002.yaml -- FV-D006-0003.yaml -- FV-D007-0001.yaml -- FV-D007-0002.yaml -- FV-D007-0003.yaml -- FV-D008-0001.yaml -- FV-D008-0002.yaml -- FV-D008-0003.yaml -- FV-D009-0001.yaml -- FV-D009-0002.yaml -- FV-D009-0003.yaml -- FV-D010-0001.yaml -- FV-D010-0002.yaml -- FV-D010-0003.yaml -- FV-D011-0001.yaml -- FV-D011-0002.yaml -- FV-D011-0003.yaml -- FV-D012-0001.yaml -- FV-D012-0002.yaml -- FV-D012-0003.yaml -- FV-D013-0001.yaml -- FV-D013-0002.yaml -- FV-D013-0003.yaml -- FV-D014-0001.yaml -- FV-D014-0002.yaml -- FV-D015-0001.yaml -- FV-D015-0002.yaml -- FV-D015-0003.yaml -- FV-D015-0004.yaml -- FV-D016-0001.yaml -- FV-D016-0002.yaml -- FV-D016-0003.yaml -- FV-D017-0001.yaml -- FV-D017-0002.yaml -- FV-D017-0003.yaml -- FV-D018-0001.yaml -- FV-D018-0002.yaml -- FV-D018-0003.yaml -- FV-M001-0001.yaml -- FV-M001-0002.yaml -- FV-M001-0003.yaml -- FV-M002-0001.yaml -- FV-M002-0002.yaml -- FV-M002-0003.yaml +- AmortizedCost_IsDecimal.yaml +- AmortizedCost_NotNull.yaml +- AmortizedCost_Required.yaml +- AvailabilityZone_IsString.yaml +- AvailabilityZone_Nullable.yaml +- BilledCost_IsDecimal.yaml +- BilledCost_NotNull.yaml +- BilledCost_Required.yaml +- BilledCurrency_IsCurrencyCode.yaml +- BilledCurrency_NotNull.yaml +- BilledCurrency_Required.yaml +- BillingAccountId_IsString.yaml +- BillingAccountId_NotNull.yaml +- BillingAccountId_Required.yaml +- BillingAccountName_IsString.yaml +- BillingAccountName_Nullable.yaml +- BillingAccountName_Required.yaml +- BillingPeriodEnd_IsDateTime.yaml +- BillingPeriodEnd_NotNull.yaml +- BillingPeriodEnd_Required.yaml +- BillingPeriodStart_IsDateTime.yaml +- BillingPeriodStart_NotNull.yaml +- BillingPeriodStart_Required.yaml +- ChargePeriodEnd_IsDateTime.yaml +- ChargePeriodEnd_NotNull.yaml +- ChargePeriodEnd_Required.yaml +- ChargePeriodStart_IsDateTime.yaml +- ChargePeriodStart_NotNull.yaml +- ChargePeriodStart_Required.yaml +- ChargeType_Enum.yaml +- ChargeType_IsString.yaml +- ChargeType_NotNull.yaml +- ChargeType_Required.yaml +- InvoiceIssuer_IsString.yaml +- InvoiceIssuer_NotNull.yaml +- Provider_IsString.yaml +- Provider_NotNull.yaml +- Provider_Required.yaml +- Publisher_IsString.yaml +- Publisher_NotNull.yaml +- Publisher_Required.yaml +- Region_IsString.yaml +- Region_NotNull.yaml +- Region_Required.yaml +- ResourceID_IsString.yaml +- ResourceID_Nullable.yaml +- ResourceName_IsString.yaml +- ResourceName_Nullable.yaml +- ResourceName_Required.yaml +- ServiceCategory_Enum.yaml +- ServiceCategory_IsString.yaml +- ServiceCategory_NotNull.yaml +- ServiceCategory_Required.yaml +- ServiceName_IsString.yaml +- ServiceName_NotNull.yaml +- ServiceName_Required.yaml +- SubAccountName_IsString.yaml +- SubAccountName_Nullable.yaml +- SubAccountName_Required.yaml diff --git a/setup.cfg b/setup.cfg index 9d6fa07..8e65e3b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,3 +13,6 @@ line_length=88 [mypy] plugins = pandera.mypy + +[coverage:run] +omit = focus_validator/utils/*.py diff --git a/tests/config_objects/test_load_bad_rule_config_file.py b/tests/config_objects/test_load_bad_rule_config_file.py index 66b5f19..a8c10d3 100644 --- a/tests/config_objects/test_load_bad_rule_config_file.py +++ b/tests/config_objects/test_load_bad_rule_config_file.py @@ -48,30 +48,29 @@ def test_load_schema(self): _, checklist = FocusToPanderaSchemaConverter.generate_pandera_schema( rules=rules, override_config=None ) + self.assertEqual( - checklist["FV-D001-0001"].status, ChecklistObjectStatus.PENDING + checklist["bad_rule_config_empty_file"].status, ChecklistObjectStatus.ERRORED ) - self.assertIsNone(checklist["FV-D001-0001"].error) - self.assertIsNotNone(checklist["FV-D001-0001"].friendly_name) - self.assertEqual(checklist["FV-D001"].column_id, "ChargeType") - self.assertEqual(checklist["FV-D001"].status, ChecklistObjectStatus.PENDING) - self.assertIsNone(checklist["FV-D001"].error) - self.assertIsNotNone(checklist["FV-D001"].friendly_name) + self.assertEqual(checklist["valid_rule_config_column_metadata"].column_id, "ChargeType") + self.assertEqual(checklist["valid_rule_config_column_metadata"].status, ChecklistObjectStatus.PENDING) + self.assertIsNone(checklist["valid_rule_config_column_metadata"].error) + self.assertIsNotNone(checklist["valid_rule_config_column_metadata"].friendly_name) self.assertEqual( - checklist["FV-D001"].friendly_name, "Ensures that column is of string type." + checklist["valid_rule_config_column_metadata"].friendly_name, "Ensures that column is of string type." ) - for errored_file_paths in [ - "tests/samples/rule_configs/bad_rule_config_empty_file.yaml", - "tests/samples/rule_configs/bad_rule_config_missing_check.yaml", + for errored_checks in [ + 'bad_rule_config_empty_file', + 'bad_rule_config_missing_check' ]: self.assertEqual( - checklist[errored_file_paths].status, ChecklistObjectStatus.ERRORED + checklist[errored_checks].status, ChecklistObjectStatus.ERRORED ) - self.assertIsNotNone(checklist[errored_file_paths].error) - self.assertIsNone(checklist[errored_file_paths].friendly_name) - self.assertEqual(checklist[errored_file_paths].column_id, "Unknown") + self.assertIsNotNone(checklist[errored_checks].error) + self.assertIsNone(checklist[errored_checks].friendly_name) + self.assertEqual(checklist[errored_checks].column_id, "Unknown") def test_load_schema_without_valid_column_metadata(self): rules = [ @@ -88,11 +87,11 @@ def test_load_schema_without_valid_column_metadata(self): rules=rules, override_config=None ) self.assertEqual( - checklist["FV-D001-0001"].status, ChecklistObjectStatus.ERRORED + checklist["bad_rule_config_missing_check"].status, ChecklistObjectStatus.ERRORED ) - self.assertEqual( - checklist["FV-D001-0001"].error, - "ConfigurationError: No configuration found for column.", + self.assertRegex( + checklist["bad_rule_config_missing_check"].error, + "ValidationError:.*", ) - self.assertIsNotNone(checklist["FV-D001-0001"].friendly_name) - self.assertEqual(checklist["FV-D001-0001"].column_id, "ChargeType") + self.assertIsNotNone(checklist["valid_rule_config"].friendly_name) + self.assertEqual(checklist["valid_rule_config"].column_id, "ChargeType") diff --git a/tests/outputter/test_outputter_console.py b/tests/outputter/test_outputter_console.py index a947a39..bef733d 100644 --- a/tests/outputter/test_outputter_console.py +++ b/tests/outputter/test_outputter_console.py @@ -4,7 +4,7 @@ from focus_validator.config_objects.focus_to_pandera_schema_converter import ( FocusToPanderaSchemaConverter, ) -from focus_validator.outputter.outputter_console import ConsoleOutputter +from focus_validator.outputter.outputter_console import ConsoleOutputter, collapse_occurrence_range from focus_validator.rules.spec_rules import ValidationResult from focus_validator.validator import Validator @@ -34,6 +34,16 @@ def test_failure_output(self): ], ) + def test_collapse_range(self): + self.assertEqual( + collapse_occurrence_range([1, 5, 6, 7, 23.0]), + '1,5-7,23' + ) + self.assertEqual( + collapse_occurrence_range(['category', 'category2', 'category3']), + 'category,category2,category3' + ) + def test_output_with_bad_configs_loaded(self): schema, checklist = FocusToPanderaSchemaConverter.generate_pandera_schema( rules=[ @@ -50,6 +60,7 @@ def test_output_with_bad_configs_loaded(self): outputter = ConsoleOutputter(output_destination=None) checklist = outputter.__restructure_check_list__(result_set=validation_result) + outputter.write(validation_result) self.assertEqual( checklist.to_dict(orient="records"), [ diff --git a/tests/samples/rule_configs/bad_rule_config_empty_file.yaml b/tests/samples/rule_configs/bad_rule_config_empty_file.yaml index 8179223..e69de29 100644 --- a/tests/samples/rule_configs/bad_rule_config_empty_file.yaml +++ b/tests/samples/rule_configs/bad_rule_config_empty_file.yaml @@ -1,4 +0,0 @@ -check_id: FV-D001-0001 -column: ChargeType -validation_config: - check_friendly_name: "ChargeType must have a value from the list: {values}." diff --git a/tests/samples/rule_configs/bad_rule_config_missing_check.yaml b/tests/samples/rule_configs/bad_rule_config_missing_check.yaml index e69de29..8242360 100644 --- a/tests/samples/rule_configs/bad_rule_config_missing_check.yaml +++ b/tests/samples/rule_configs/bad_rule_config_missing_check.yaml @@ -0,0 +1,3 @@ +column_id: ChargeType +validation_config: + check_friendly_name: "ChargeType must have a value from the list: {values}." diff --git a/tests/samples/rule_configs/valid_rule_config.yaml b/tests/samples/rule_configs/valid_rule_config.yaml index 7d0c2bd..0c20356 100644 --- a/tests/samples/rule_configs/valid_rule_config.yaml +++ b/tests/samples/rule_configs/valid_rule_config.yaml @@ -1,4 +1,3 @@ -check_id: FV-D001-0001 column_id: ChargeType check_friendly_name: "ChargeType must have a value from the list: {values}." check: diff --git a/tests/samples/rule_configs/valid_rule_config_column_metadata.yaml b/tests/samples/rule_configs/valid_rule_config_column_metadata.yaml index a89f1e8..8369e69 100644 --- a/tests/samples/rule_configs/valid_rule_config_column_metadata.yaml +++ b/tests/samples/rule_configs/valid_rule_config_column_metadata.yaml @@ -1,4 +1,3 @@ -check_id: FV-D001 column_id: ChargeType check: data_type: string diff --git a/tests/test_validate_default_configs.py b/tests/test_validate_default_configs.py index 17d79d8..c994ab7 100644 --- a/tests/test_validate_default_configs.py +++ b/tests/test_validate_default_configs.py @@ -29,59 +29,3 @@ def test_version_sets_have_valid_config(self): self.assertIsNot( result.checklist[check_id].status, ChecklistObjectStatus.ERRORED ) - - def test_default_rules_with_sample_data(self): - check_id_pattern = re.compile(r"FV-[D,M]\d{3}-\d{4}$") - - for root, dirs, files in os.walk( - "focus_validator/rules/version_sets", topdown=False - ): - column_test_suites = [] - for file_path in files: - rule_path = os.path.join(root, file_path) - rule = Rule.load_yaml(rule_path=rule_path) - self.assertIsInstance(rule, Rule) - - column_id = rule.column_id - self.assertIsNotNone(re.match(check_id_pattern, rule.check_id)) - - check_column_id = rule.check_id.split("-")[1] - local_check_id = rule.check_id.split("-")[2] - column_test_suites.append((column_id, check_column_id, local_check_id)) - - # sort column test suites to allow grouping by column - column_test_suites = sorted(column_test_suites, key=lambda item: item[0]) - for _, test_suites in groupby(column_test_suites, key=lambda item: item[0]): - test_suites = list(test_suites) - self.assertEqual( - len(set([test_suite[1] for test_suite in test_suites])), 1 - ) - local_check_ids = [int(test_suite[2]) for test_suite in test_suites] - # check all ids are in order - self.assertEqual( - sorted(local_check_ids), list(range(1, len(local_check_ids) + 1)) - ) - - def test_metric_file_format_metric_vs_dimension(self): - metric_check_id_pattern = re.compile(r"FV-M\d{3}-\d{4}$") - dimension_check_id_pattern = re.compile(r"FV-D\d{3}-\d{4}$") - - for root, dirs, files in os.walk( - "focus_validator/rules/version_sets", topdown=False - ): - for file_path in files: - rule_path = os.path.join(root, file_path) - rule = Rule.load_yaml(rule_path=rule_path) - self.assertIsInstance(rule, Rule) - - if isinstance(rule.check, DataTypeCheck): - if rule.check.data_type == DataTypes.DECIMAL: - self.assertIsNotNone( - re.match(metric_check_id_pattern, rule.check_id), - "For metric column type check_id format should be FV-MYYY-YYYY", - ) - else: - self.assertIsNotNone( - re.match(dimension_check_id_pattern, rule.check_id), - "For metric column type check_id format should be FV-DYYY-YYYY", - )