Skip to content

Commit

Permalink
Works with the issue GoogleCloudPlatform#6
Browse files Browse the repository at this point in the history
  • Loading branch information
dviorel committed May 27, 2020
1 parent 19fafd7 commit a204488
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions functions/gcs/gcs_location_matching_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,14 @@ def _run_location_matching(table, destination_table, bq_client, algorithm):
returns float64
language js as \"\"\"
var rawScore = 50*(1-chain_match) + 50*(1-addr_match);
var score =
(chain_match == 0 || addr_match == 0) ? 100 :
chain_match > 1 && addr_match >= .5 ? Math.min(5, rawScore) :
chain_match >= .8 && addr_match >= .5 ? Math.min(15, rawScore) :
addr_match >= .8 && chain_match >= .5 ? Math.min(15, rawScore) :
chain_match >= .3 && addr_match >= .9 ? Math.min(20, rawScore) :
rawScore;
var score =
(chain_match == 0) ? 100 :
chain_match > 1 && addr_match >= .5 ? Math.min(5, rawScore) :
chain_match >= .8 && addr_match >= .5 ? Math.min(15, rawScore) :
addr_match >= .8 && chain_match >= .5 ? Math.min(15, rawScore) :
chain_match >= .3 && addr_match >= .9 ? Math.min(20, rawScore) :
chain_match > 1 ? Math.min(20, rawScore) :
rawScore;
return score;
\"\"\"
OPTIONS (
Expand Down Expand Up @@ -770,6 +771,7 @@ def process_location_matching(data, context):


# process_location_matching({'name': '[email protected]/simple_list___no_mv_gcs.txt'}, None)
process_location_matching({'name': '[email protected]/Matching_list_nozip___no_mv_gcs.txt'}, None)
# process_location_matching({'name': '[email protected]/Matching_list_nozip___no_mv_gcs.txt'}, None)
process_location_matching({'name': '[email protected]/walmart_list_with_match_issue_6___no_mv_gcs.txt'}, None)
# process_location_matching({'name': '[email protected]/walmart_list_with_match_issue___no_mv_gcs.txt'}, None)
# _send_mail('[email protected]', ['[email protected]'], 'My test', 'The body')

0 comments on commit a204488

Please sign in to comment.