Admin User 56f6d480b1
Some checks failed
Build and Push Docker Image / test (push) Failing after 6s
Build and Push Docker Image / build_and_push (push) Has been skipped
Final Score block
2025-04-09 18:47:56 +00:00

67 lines
2.0 KiB
Python

import logging
# Configure logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s - %(message)s",
)
logger = logging.getLogger(__name__)
def __main__(
hd_score_m1: float
) -> dict:
"""
Computes recommended action based on hd_score_m1 and returns relevant details.
"""
score_threshold = 1200
# Compute recommended_action
try:
recommended_action = (
"Decline Application"
if hd_score_m1 > score_threshold
else "Pass Application"
)
logging.info(f"recommended_action: {recommended_action}")
except Exception as e:
logging.error(f"Error assigning recommended_action: {e}")
return {}
# Compute description
try:
if hd_score_m1 > score_threshold:
description = (
f"HD Fraud Score M1 is above the risk threshold {score_threshold}, "
f"Recommended action: Decline Application"
)
else:
description = (
f"HD Fraud Score M1 is below the risk threshold {score_threshold}, "
f"Recommended action: Pass Application"
)
logging.info(f"description: {description}")
except Exception as e:
logging.error(f"Error assigning description: {e}")
return {}
# Compute action_reasoncode
try:
# For multiple checks, you might iterate over a dictionary. For now, a single check suffices:
if hd_score_m1 > score_threshold:
hd_action_reasoncode = "M1 Triggered"
else:
hd_action_reasoncode = "Pass"
logging.info(f"action_reasoncode: {hd_action_reasoncode}")
except Exception as e:
logging.error(f"Error compiling action_reasoncode: {e}")
return {}
return {
"hd_score_m1": hd_score_m1,
"recommended_action": recommended_action,
"description": description,
"hd_action_reasoncode": hd_action_reasoncode,
}