From 7aa04da902ee542668583055e9b3f6ba755fc05f Mon Sep 17 00:00:00 2001 From: Ankur Malik Date: Wed, 26 Nov 2025 11:55:08 -0500 Subject: [PATCH] Add hd_score_g2 support to Rules block --- block.py | 4 +++- request_schema.json | 4 ++++ response_schema.json | 4 ++++ rules_processing.py | 1 + test_block.py | 2 +- 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/block.py b/block.py index fc07805..1bd4de3 100644 --- a/block.py +++ b/block.py @@ -16,7 +16,8 @@ def __main__( email_cnt: int, rejected_app_count: float, app_dt_day_cnt: int, - hd_score_iso_m2: float + hd_score_iso_m2: float, + hd_score_g2: float ) -> dict: # Create a dictionary instead of using pandas DataFrame data = { @@ -28,6 +29,7 @@ def __main__( "rejected_app_count": rejected_app_count, "app_dt_day_cnt": app_dt_day_cnt, "hd_score_iso_m2": hd_score_iso_m2, + "hd_score_g2": hd_score_g2 } final = processing(data) diff --git a/request_schema.json b/request_schema.json index fbf2d89..77de915 100644 --- a/request_schema.json +++ b/request_schema.json @@ -10,6 +10,10 @@ "type": ["number", "null"], "description": "HD Fraud Score G1" }, + "hd_score_g2": { + "type": ["number", "null"], + "description": "HD Fraud Score G1" + }, "cluster_size_users_v2": { "type": ["number", "null"], "description": "Size of the user cluster in version 2." diff --git a/response_schema.json b/response_schema.json index bdfa09f..09d11c1 100644 --- a/response_schema.json +++ b/response_schema.json @@ -10,6 +10,10 @@ "type": ["number", "null"], "description": "HD Fraud Score G1" }, + "hd_score_g2": { + "type": ["number", "null"], + "description": "HD Fraud Score G1" + }, "hd_score_s1": { "type": ["number", "null"], "description": "HD Fraud Score S1" diff --git a/rules_processing.py b/rules_processing.py index bbe7005..d68dd75 100644 --- a/rules_processing.py +++ b/rules_processing.py @@ -50,6 +50,7 @@ def processing(data: dict) -> dict: "hd_score_s2": hd_score_s2, "hd_score_s3": hd_score_s3, "hd_score_iso_m2": data["hd_score_iso_m2"], + "hd_score_g2": data["hd_score_g2"] } diff --git a/test_block.py b/test_block.py index 06a235b..ae99298 100644 --- a/test_block.py +++ b/test_block.py @@ -1,7 +1,7 @@ import unittest from block import __main__ -data = {'hd_score_m1': 1093.0, 'hd_score_g1': 0.0, 'cluster_size_users_v2': 1.0, 'target_connected_30_sum': 0.0, 'email_cnt': 1.0, 'rejected_app_count': 0.0, 'app_dt_day_cnt': 1.0, 'hd_score_iso_m2': 1001.0} +data = {'hd_score_m1': 1093.0, 'hd_score_g1': 0.0, 'cluster_size_users_v2': 1.0, 'target_connected_30_sum': 0.0, 'email_cnt': 1.0, 'rejected_app_count': 0.0, 'app_dt_day_cnt': 1.0, 'hd_score_iso_m2': 1001.0, "hd_score_g2": 0.0} class TestBlock(unittest.TestCase): def test_main_success(self):