Skip to content

Commit

Permalink
Merge pull request #3250 from raft-tech/3224-audit-logger
Browse files Browse the repository at this point in the history
3224 Audit Logger
  • Loading branch information
elipe17 authored Nov 25, 2024
2 parents c230985 + 5c612f6 commit 357f9d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 6 additions & 2 deletions tdrs-backend/tdpservice/parsers/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def parse_value(self, line):
value = int(value)
return value
except ValueError:
logger.error(f"Error parsing field value: {value} to integer.")
logger.error(f"Error parsing field {self.name} value to integer.")
return None
case "string":
return value
Expand Down Expand Up @@ -83,4 +83,8 @@ def __init__(self, transform_func, item, name, friendly_name, type, startIndex,
def parse_value(self, line):
"""Parse and transform the value for a field given a line, startIndex, endIndex, and field type."""
value = super().parse_value(line)
return self.transform_func(value, **self.kwargs)
try:
return_value = self.transform_func(value, **self.kwargs)
return return_value
except Exception:
raise ValueError(f"Error transforming field value for field: {self.name}.")
5 changes: 2 additions & 3 deletions tdrs-backend/tdpservice/parsers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,12 @@ def remove_case_due_to_errors(self, should_remove, case_hash):

def generate_t1_t4_hashes(line, record):
"""Return hashes for duplicate and partial duplicate detection for T1 & T4 records."""
logger.debug(f"Partial Hash Field Values: {record.RecordType} {str(record.RPT_MONTH_YEAR)} {record.CASE_NUMBER}")
logger.debug(f"Partial Hash Field Values: for T1/T4: {record.RecordType} {str(record.RPT_MONTH_YEAR)} ")
return hash(line), hash(record.RecordType + str(record.RPT_MONTH_YEAR or '') + str(record.CASE_NUMBER or ''))

def generate_t2_t3_t5_hashes(line, record):
"""Return hashes for duplicate and partial duplicate detection for T2 & T3 & T5 records."""
logger.debug(f"Partial Hash Field Values: {record.RecordType} {str(record.RPT_MONTH_YEAR)} {record.CASE_NUMBER} " +
f"{str(record.FAMILY_AFFILIATION)} {record.DATE_OF_BIRTH} {record.SSN}")
logger.debug(f"Partial Hash Field Values: for T2/T3/T5: {record.RecordType} {str(record.RPT_MONTH_YEAR)} ")
return hash(line), hash(record.RecordType + str(record.RPT_MONTH_YEAR or '') + str(record.CASE_NUMBER or '') +
str(record.FAMILY_AFFILIATION or '') + str(record.DATE_OF_BIRTH or '') +
str(record.SSN or ''))
Expand Down
4 changes: 1 addition & 3 deletions tdrs-backend/tdpservice/parsers/validators/category3.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,17 +376,15 @@ def validate(record, row_schema):
return true_case
else:
return true_case
except Exception as e:
except Exception:
vals = {
"WORK_ELIGIBLE_INDICATOR": WORK_ELIGIBLE_INDICATOR,
"RELATIONSHIP_HOH": RELATIONSHIP_HOH,
"DOB": DOB
}
logger.debug(
"Caught exception in validator: validate__WORK_ELIGIBLE_INDICATOR__HOH__AGE. " +
f"With field values: {vals}."
)
logger.debug(f'Exception: {e}')
# Per conversation with Alex on 03/26/2024, returning the true case during exception handling to avoid
# confusing the STTs.
return true_case
Expand Down

0 comments on commit 357f9d4

Please sign in to comment.