"""Check if the adjustment file has been validated.""" from lib import constants from lib.utils import ows from tasks.adjustment_file_upload import helpers def adjustment_file_validation_check(dag_run, **kwargs) -> bool: """Check if the adjustment file has been updated with a valid row count or error.""" event = helpers.get_event_from_params(dag_run, **kwargs) statement_period_adjustment_file_id = event.target_id adjustment_file_details = ows.get_statement_period_adjustment_file_details( statement_period_adjustment_file_id ) action_name = constants.STATEMENT_PERIOD_ADJUSTMENT_FILE_ACTIONS.UPLOAD_FILE action_status = helpers.get_abacus_state(action_name, event.target_id) if action_status.get('action_status') == constants.ABACUS_STATE_STATUSES.ERROR: return True return adjustment_file_details.get('valid_row_count') is not None