in files/lambda_code/call_cm_other_models_lambda.py [0:0]
def search_dict_for_breast_cancer_genes(the_dict=None):
'''search the comprehend medical output for breast cancer genes and augment the comprehend medical output. This modifies the input dictionary in place'''
list_to_search=the_dict['Entities'] #only search the entities found by comprehend medical.
for i in range(0,len(list_to_search)):
try:
dict_to_examine=list_to_search[i]
the_text=dict_to_examine['Text']
max_score=0
#get score of best matching gene
for j in range(0,len(list_of_genes)):
the_score=get_match_score(string_1=list_of_genes[j],string_2=the_text,normalize_max=False)
if the_score >= max_score:
max_score=the_score
gene_score=max_score
#hard code a score threshold. Do not report scores less than this.
if gene_score >=.75:
dict_to_append={"Name":"BREAST_CANCER_GENE",'Score':gene_score}
dict_to_examine['Traits'].append(dict_to_append)
except: #if the dictionary entry doesn't match, just skip it.
pass
return(the_dict)