Update db_lookup SQL and request schema
This commit is contained in:
parent
e19f1562af
commit
1639935933
6
main.sql
6
main.sql
@ -22,7 +22,8 @@ current_app AS (
|
||||
SELECT
|
||||
application_key AS current_app_key,
|
||||
application_timestamp AS current_app_created_at,
|
||||
$hd_score_m1 AS hd_score_m1
|
||||
$hd_score_m1 AS hd_score_m1,
|
||||
$hd_score_iso_m2 AS hd_score_iso_m2
|
||||
FROM abc
|
||||
WHERE application_key = $application_key
|
||||
),
|
||||
@ -41,6 +42,7 @@ clusters_alt AS (
|
||||
b.current_app_key,
|
||||
b.current_app_created_at,
|
||||
b.hd_score_m1,
|
||||
b.hd_score_iso_m2,
|
||||
CASE
|
||||
WHEN LOWER(CAST(a.originated_loan_is_fraud AS TEXT)) != 'true'
|
||||
AND a.originated_loan_is_never_paid IS NULL THEN NULL
|
||||
@ -76,6 +78,7 @@ clusters AS (
|
||||
SELECT
|
||||
a.current_app_key AS application_key,
|
||||
CAST(MAX(hd_score_m1) AS FLOAT) AS hd_score_m1,
|
||||
CAST(MAX(hd_score_iso_m2) AS FLOAT) AS hd_score_iso_m2,
|
||||
COUNT(DISTINCT a.user_connected_v2) AS cluster_size_users_v2,
|
||||
MAX(b.target_connected_30_sum) AS target_connected_30_sum,
|
||||
COUNT(DISTINCT a.connected_email) AS email_cnt,
|
||||
@ -90,6 +93,7 @@ clusters AS (
|
||||
|
||||
SELECT
|
||||
COALESCE(MAX(hd_score_m1), $hd_score_m1) AS hd_score_m1,
|
||||
COALESCE(MAX(hd_score_iso_m2), $hd_score_iso_m2) AS hd_score_iso_m2,
|
||||
COALESCE(MAX(cluster_size_users_v2), 0) AS cluster_size_users_v2,
|
||||
COALESCE(MAX(target_connected_30_sum), 0) AS target_connected_30_sum,
|
||||
COALESCE(MAX(email_cnt), 0) AS email_cnt,
|
||||
|
||||
@ -10,6 +10,10 @@
|
||||
"type": ["number", "null"],
|
||||
"description": "HD fraud score M1."
|
||||
},
|
||||
"hd_score_iso_m2": {
|
||||
"type": ["number", "null"],
|
||||
"description": "HD fraud score M2."
|
||||
},
|
||||
"connected_application_keys": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user