diff --git a/app/clinical_evidence/compute_clinical_evidence.py b/app/clinical_evidence/compute_clinical_evidence.py index 0e7086f..b35d7eb 100644 --- a/app/clinical_evidence/compute_clinical_evidence.py +++ b/app/clinical_evidence/compute_clinical_evidence.py @@ -1,4 +1,5 @@ """Clinical Evidence Scoring.""" + import json import logging import numpy as np diff --git a/app/clinical_evidence/merge.py b/app/clinical_evidence/merge.py index 49c2791..5d949e8 100644 --- a/app/clinical_evidence/merge.py +++ b/app/clinical_evidence/merge.py @@ -1,4 +1,5 @@ """Script for combining multiple KGX node and edge files.""" + import glob import json import jsonlines @@ -63,9 +64,9 @@ } if "association" in edge: # from ehr - save_edge[ - "predicate" - ] = f"biolink:{edge['association']['predicate']}" + save_edge["predicate"] = ( + f"biolink:{edge['association']['predicate']}" + ) for attribute in edge["association"]["edge_attributes"]: if ( attribute["attribute_type_id"] @@ -91,16 +92,16 @@ == "biolink:log_odds_ratio_95_ci" and type(sub_attribute["value"]) != str ): - save_edge[ - "log_odds_ratio_95_ci" - ] = sub_attribute["value"] + save_edge["log_odds_ratio_95_ci"] = ( + sub_attribute["value"] + ) if ( sub_attribute["attribute_type_id"] == "biolink:total_sample_size" ): - save_edge[ - "total_sample_size" - ] = sub_attribute["value"] + save_edge["total_sample_size"] = ( + sub_attribute["value"] + ) elif "biolink:supporting_data_source" in edge: # from icees diff --git a/app/clinical_evidence/normalize.py b/app/clinical_evidence/normalize.py index 197605a..c945555 100644 --- a/app/clinical_evidence/normalize.py +++ b/app/clinical_evidence/normalize.py @@ -1,4 +1,5 @@ """Simple script for normalizing kgx node and edge files.""" + import httpx import jsonlines diff --git a/app/novelty/compute_novelty.py b/app/novelty/compute_novelty.py index f791d79..22da8b8 100644 --- a/app/novelty/compute_novelty.py +++ b/app/novelty/compute_novelty.py @@ -420,9 +420,11 @@ async def compute_novelty(message, logger): try: similarity_map = await molecular_sim(known, unknown, message) df["similarity"] = df.apply( - lambda row: similarity_map[row["drug"]][0][1] - if row["drug"] in similarity_map.keys() - else np.nan, + lambda row: ( + similarity_map[row["drug"]][0][1] + if row["drug"] in similarity_map.keys() + else np.nan + ), axis=1, ) except Exception as e: @@ -433,11 +435,15 @@ async def compute_novelty(message, logger): # Step 3: # calculating the recency df["recency"] = df.apply( - lambda row: recency_function_exp( - row["number_of_publ"], row["age_oldest_pub"], 100, 50 - ) - if not (np.isnan(row["number_of_publ"]) or np.isnan(row["age_oldest_pub"])) - else np.nan, + lambda row: ( + recency_function_exp( + row["number_of_publ"], row["age_oldest_pub"], 100, 50 + ) + if not ( + np.isnan(row["number_of_publ"]) or np.isnan(row["age_oldest_pub"]) + ) + else np.nan + ), axis=1, ) # diff --git a/app/ordering_components.py b/app/ordering_components.py index c598c27..1544faa 100644 --- a/app/ordering_components.py +++ b/app/ordering_components.py @@ -1,4 +1,5 @@ """Compute scores for each result in the given message.""" + import redis from tqdm import tqdm import traceback diff --git a/tests/clinical_response.py b/tests/clinical_response.py index 605a9ec..3a39cd0 100644 --- a/tests/clinical_response.py +++ b/tests/clinical_response.py @@ -1,4 +1,5 @@ """Mock Redis.""" + import fakeredis import json diff --git a/tests/test_clinical_evidence.py b/tests/test_clinical_evidence.py index 675c218..178a7d7 100644 --- a/tests/test_clinical_evidence.py +++ b/tests/test_clinical_evidence.py @@ -1,4 +1,5 @@ """Test Clinical Evidence function.""" + import logging from app.clinical_evidence.compute_clinical_evidence import compute_clinical_evidence