Compare commits
No commits in common. "final-score" and "main" have entirely different histories.
final-scor
...
main
79
block.py
79
block.py
@ -1,66 +1,21 @@
|
|||||||
import logging
|
@flowx_block
|
||||||
|
def example_function(request: dict) -> dict:
|
||||||
|
|
||||||
# Configure logging
|
# Processing logic here...
|
||||||
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 {
|
return {
|
||||||
"hd_score_m1": hd_score_m1,
|
"meta_info": [
|
||||||
"recommended_action": recommended_action,
|
{
|
||||||
"description": description,
|
"name": "created_date",
|
||||||
"hd_action_reasoncode": hd_action_reasoncode,
|
"type": "string",
|
||||||
|
"value": "2024-11-05"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"type": "",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1 @@
|
|||||||
{
|
{}
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"hd_score_m1": {
|
|
||||||
"type": ["number", "null"],
|
|
||||||
"description": "HD Fraud Score M1 value."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": []
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
jmespath == 1.0.1
|
{}
|
||||||
|
|||||||
@ -1,23 +1 @@
|
|||||||
{
|
{}
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"hd_score_m1": {
|
|
||||||
"type": ["number", "null"],
|
|
||||||
"description": "HD Fraud Score M1"
|
|
||||||
},
|
|
||||||
"recommended_action": {
|
|
||||||
"type": ["string", "null"],
|
|
||||||
"description": "Outcome of the score check (Pass or Decline)"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": ["string", "null"],
|
|
||||||
"description": "Explanation or summary of the recommended action"
|
|
||||||
},
|
|
||||||
"hd_action_reasoncode": {
|
|
||||||
"type": ["string", "null"],
|
|
||||||
"description": "Reason code describing why the recommended action was chosen"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": []
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user