@@ -379,9 +379,6 @@ def file_transformation_step(
379379 failed .append ((submission_info , submission_status ))
380380 else :
381381 success .append ((submission_info , submission_status ))
382- except AttributeError as exc :
383- self ._logger .error (f"File transformation raised exception: { exc } " )
384- raise exc
385382 except PERMISSIBLE_EXCEPTIONS as exc :
386383 self ._logger .warning (
387384 f"File transformation raised exception: { exc } . Will be retried later."
@@ -509,9 +506,6 @@ def data_contract_step(
509506 submission_info : SubmissionInfo
510507 submission_status : SubmissionStatus
511508 submission_info , submission_status = future .result ()
512- except AttributeError as exc :
513- self ._logger .error (f"Data Contract raised exception: { exc } " )
514- raise exc
515509 except PERMISSIBLE_EXCEPTIONS as exc :
516510 self ._logger .warning (
517511 f"Data Contract raised exception: { exc } . Will be retried later."
@@ -616,8 +610,19 @@ def apply_business_rules( # pylint: disable=R0914
616610 submission_status .processing_failed = True
617611
618612 for entity_name , entity in entity_manager .entities .items ():
613+ # Note BI filtering done within the apply_rules
614+ self ._logger .info (f"applying data contract filter to { entity_name } ." )
615+ if not entity_name .startswith ("Original" ):
616+ filtered_entity = self ._step_implementations .filter_data_contract_record_rejections (
617+ working_directory ,
618+ entity ,
619+ entity_name ,
620+ )
621+ else :
622+ self ._logger .info (f"Skipping { entity_name } . Marked original." )
623+ filtered_entity = entity
619624 projected = self ._step_implementations .write_parquet ( # type: ignore
620- entity ,
625+ filtered_entity ,
621626 fh .joinuri (
622627 self .processed_files_path ,
623628 submission_info .submission_id ,
@@ -629,6 +634,7 @@ def apply_business_rules( # pylint: disable=R0914
629634 projected
630635 )
631636
637+ # todo - add to submission_status around records that have passed record validations/rejected
632638 submission_status .number_of_records = self .get_entity_count (
633639 entity = entity_manager .entities [
634640 f"""Original{ rules .global_variables .get (
@@ -682,9 +688,6 @@ def business_rule_step(
682688 unsucessful_files .append ((submission_info , submission_status )) # type: ignore
683689 else :
684690 successful_files .append ((submission_info , submission_status )) # type: ignore
685- except AttributeError as exc :
686- self ._logger .error (f"Business Rules raised exception: { exc } " )
687- raise exc
688691 except PERMISSIBLE_EXCEPTIONS as exc :
689692 self ._logger .warning (
690693 f"Business Rules raised exception: { exc } . Will be retried later."
@@ -758,10 +761,12 @@ def _get_error_dataframes(self, submission_id: str):
758761
759762 df = pl .DataFrame (errors , schema = {key : pl .Utf8 () for key in errors [0 ]}) # type: ignore
760763 df = df .with_columns (
761- pl .when (pl .col ("Status" ) == pl .lit ("error" )) # type: ignore
764+ pl .when (pl .col ("Status" ) == pl .lit ("informational" ))
765+ .then (pl .lit ("Warning" ))
766+ .when (pl .col ("FailureType" ) == pl .lit ("submission" )) # type: ignore
762767 .then (pl .lit ("Submission Failure" )) # type: ignore
763- .otherwise (pl .lit ("Warning " )) # type: ignore
764- .alias ("error_type" )
768+ .otherwise (pl .lit ("Record Rejection " )) # type: ignore
769+ .alias ("error_type" ) # type: ignore
765770 )
766771 df = df .select (
767772 pl .col ("Entity" ).alias ("Table" ), # type: ignore
@@ -823,7 +828,8 @@ def error_report(
823828 sub_stats = SubmissionStatisticsRecord (
824829 submission_id = submission_info .submission_id ,
825830 record_count = submission_status .number_of_records ,
826- number_record_rejections = err_types .get ("Submission Failure" , 0 ),
831+ number_submission_rejections = err_types .get ("Submission Failure" , 0 ),
832+ number_record_rejections = err_types .get ("Record Rejection" , 0 ),
827833 number_warnings = err_types .get ("Warning" , 0 ),
828834 )
829835
@@ -835,7 +841,7 @@ def error_report(
835841 summary_items = er .SummaryItems (
836842 submission_status = submission_status ,
837843 summary_dict = summary_dict ,
838- row_headings = ["Submission Failure" , "Warning" ],
844+ row_headings = ["Submission Failure" , "Record Rejection" , " Warning" ],
839845 )
840846
841847 workbook = er .ExcelFormat (
@@ -894,9 +900,6 @@ def error_report_step(
894900 try :
895901 submission_info , submission_status , submission_stats , feedback_uri = future .result ()
896902 reports .append ((submission_info , submission_status , submission_stats , feedback_uri ))
897- except AttributeError as exc :
898- self ._logger .error (f"Error reports raised exception: { exc } " )
899- raise exc
900903 except PERMISSIBLE_EXCEPTIONS as exc :
901904 self ._logger .warning (
902905 f"Error reports raised exception: { exc } . Will be retried later."
0 commit comments