Use THX SSN hash for IP velocity
All checks were successful
Build and Push Docker Image / build_and_push (push) Successful in 30s
Build and Push Docker Image / setup (push) Successful in 4s

This commit is contained in:
Ankur Malik 2026-05-21 13:31:49 -04:00
parent 9b85dfc164
commit f4190d2154
2 changed files with 10 additions and 4 deletions

View File

@ -14,6 +14,7 @@ WITH abc AS (
CAST(NULLIF(NULLIF(LOWER(TRIM(thx.summary_risk_score::text)), ''), 'none') AS DOUBLE PRECISION) AS summary_risk_score, CAST(NULLIF(NULLIF(LOWER(TRIM(thx.summary_risk_score::text)), ''), 'none') AS DOUBLE PRECISION) AS summary_risk_score,
CAST(NULLIF(NULLIF(LOWER(TRIM(thx.cpu_clock::text)), ''), 'none') AS DOUBLE PRECISION) AS cpu_clock, CAST(NULLIF(NULLIF(LOWER(TRIM(thx.cpu_clock::text)), ''), 'none') AS DOUBLE PRECISION) AS cpu_clock,
CAST(NULLIF(NULLIF(thx.true_ip_first_seen::text, ''), 'None') AS DATE) AS true_ip_first_seen, CAST(NULLIF(NULLIF(thx.true_ip_first_seen::text, ''), 'None') AS DATE) AS true_ip_first_seen,
NULLIF(NULLIF(LOWER(TRIM(thx.ssn_hash::text)), ''), 'none') AS ssn_hash,
CAST(NULLIF(NULLIF(thx.ssn_hash_first_seen::text, ''),'None') AS DATE) AS ssn_hash_first_seen, CAST(NULLIF(NULLIF(thx.ssn_hash_first_seen::text, ''),'None') AS DATE) AS ssn_hash_first_seen,
thx.account_email_attributes, thx.account_email_attributes,
CAST(NULLIF(NULLIF(LOWER(TRIM(thx.tps_ip_latitude::text)), ''), 'none') AS DOUBLE PRECISION) AS tps_ip_latitude, CAST(NULLIF(NULLIF(LOWER(TRIM(thx.tps_ip_latitude::text)), ''), 'none') AS DOUBLE PRECISION) AS tps_ip_latitude,
@ -56,6 +57,7 @@ current_app AS (
application_ssn, application_ssn,
application_customer_type, application_customer_type,
zip, zip,
NULLIF(NULLIF(LOWER(TRIM($input_ssn_hash::text)), ''), 'none') AS ssn_hash,
$input_ip_address AS input_ip_address, $input_ip_address AS input_ip_address,
$input_ip_connection_type AS input_ip_connection_type, $input_ip_connection_type AS input_ip_connection_type,
$input_ip_isp AS input_ip_isp, $input_ip_isp AS input_ip_isp,
@ -259,7 +261,7 @@ clusters_g2 AS (
input_ip_velocity_population AS ( input_ip_velocity_population AS (
SELECT SELECT
cur.current_app_key, cur.current_app_key,
NULLIF(app.application_ssn, '') AS application_ssn, NULLIF(NULLIF(LOWER(TRIM(thx.ssn_hash::text)), ''), 'none') AS ssn_hash,
NULLIF(NULLIF(LOWER(TRIM(up.zip::text)), ''), 'none') AS zip NULLIF(NULLIF(LOWER(TRIM(up.zip::text)), ''), 'none') AS zip
FROM current_app cur FROM current_app cur
JOIN public.thx AS thx JOIN public.thx AS thx
@ -277,7 +279,7 @@ input_ip_velocity_population AS (
SELECT SELECT
current_app_key, current_app_key,
application_ssn, ssn_hash,
zip zip
FROM current_app FROM current_app
WHERE input_ip_address IS NOT NULL WHERE input_ip_address IS NOT NULL
@ -288,8 +290,8 @@ input_ip_velocity AS (
SELECT SELECT
current_app_key, current_app_key,
COUNT(DISTINCT CASE COUNT(DISTINCT CASE
WHEN LOWER(TRIM(application_ssn::text)) NOT IN ('', 'nan', 'null', 'none', 'n/a') WHEN LOWER(TRIM(ssn_hash::text)) NOT IN ('', 'nan', 'null', 'none', 'n/a')
THEN application_ssn THEN ssn_hash
ELSE NULL ELSE NULL
END) AS input_ip_distinct_ssn_24h, END) AS input_ip_distinct_ssn_24h,
COUNT(DISTINCT CASE COUNT(DISTINCT CASE

View File

@ -32,6 +32,10 @@
"input_ip_isp": { "input_ip_isp": {
"type": ["string", "null"], "type": ["string", "null"],
"description": "Current application THX input IP ISP." "description": "Current application THX input IP ISP."
},
"input_ssn_hash": {
"type": ["string", "null"],
"description": "Current application THX SSN hash."
} }
}, },
"required": [] "required": []