diff --git a/regtech_data_validator/checks.py b/regtech_data_validator/checks.py index b83ba192..20b936c5 100644 --- a/regtech_data_validator/checks.py +++ b/regtech_data_validator/checks.py @@ -2,16 +2,16 @@ Subclasses of Pandera's `Check` class """ -from enum import Enum, auto +from enum import StrEnum from typing import Any, Callable, Type from pandera import Check from pandera.backends.base import BaseCheckBackend from pandera.backends.pandas.checks import PandasCheckBackend -class Severity(Enum): - ERROR = auto() - WARNING = auto() +class Severity(StrEnum): + ERROR = 'error' + WARNING = 'warning' class SBLCheck(Check): """ diff --git a/regtech_data_validator/main.py b/regtech_data_validator/main.py index 0604d1e8..d00a61ed 100644 --- a/regtech_data_validator/main.py +++ b/regtech_data_validator/main.py @@ -5,10 +5,11 @@ Run from the terminal to see the generated output. """ -import pprint +import json import sys import pandas as pd + from regtech_data_validator.create_schemas import validate_phases @@ -22,10 +23,13 @@ def run_validation_on_df(df: pd.DataFrame, lei: str|None) -> None: the terminal. """ - pprint.pprint(validate_phases(df, lei)) + validation_dict = validate_phases(df, lei) + validation_json = json.dumps(validation_dict, indent=4) + print(validation_json) -if __name__ == "__main__": + +def main(): csv_path = None lei: str|None = None if len(sys.argv) == 1: @@ -40,3 +44,6 @@ def run_validation_on_df(df: pd.DataFrame, lei: str|None) -> None: df = csv_to_df(csv_path) run_validation_on_df(df, lei) + +if __name__ == "__main__": + main() \ No newline at end of file