diff options
author | Alexander_Kabui | 2024-03-26 13:53:43 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-03-26 13:53:43 +0300 |
commit | 6fd0320510339d18a6d032e3df8c528a94c966df (patch) | |
tree | 4745978f6ff28b06f04f1216dd11dbc3d513faec | |
parent | 800200589a1961a6d2b2de51b8e37699c4f00c0d (diff) | |
download | genenetwork3-6fd0320510339d18a6d032e3df8c528a94c966df.tar.gz |
fetch pubmed file from /gn-meta/lit
-rw-r--r-- | gn3/api/llm.py | 4 | ||||
-rw-r--r-- | gn3/llms/process.py | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/gn3/api/llm.py b/gn3/api/llm.py index e857365..661d055 100644 --- a/gn3/api/llm.py +++ b/gn3/api/llm.py @@ -45,7 +45,7 @@ def gnqa(): try: auth_token = current_app.config.get("FAHAMU_AUTH_TOKEN") task_id, answer, refs = get_gnqa( - query, auth_token, current_app.config.get("TMPDIR", "/tmp")) + query, auth_token, current_app.config.get("DATA_DIR")) response = { "task_id": task_id, @@ -77,10 +77,10 @@ def rating(task_id): results.get("answer"), results.get("weight", 0)) - logging.debug("the user id %s", str(user_id)) # get base name for sqlite llm_path = os.path.join(os.path.dirname( current_app.config["AUTH_DB"]), "llm.db") + logging.info("lmdb path is %s",llm_path) with db.connection(llm_path) as conn: cursor = conn.cursor() create_table = """CREATE TABLE IF NOT EXISTS Rating( diff --git a/gn3/llms/process.py b/gn3/llms/process.py index b29d4c9..468f86a 100644 --- a/gn3/llms/process.py +++ b/gn3/llms/process.py @@ -71,26 +71,26 @@ def rate_document(task_id, doc_id, rating, auth_token): def load_file(filename, dir_path): """function to open and load json file""" - file_path = os.path.join(dir_path, f"/{filename}") + file_path = os.path.join(dir_path, f"{filename}") if not os.path.isfile(file_path): raise FileNotFoundError(f"{filename} was not found or is a directory") with open(file_path, "rb") as file_handler: return json.load(file_handler) -def fetch_pubmed(references, file_name, tmp_dir=""): +def fetch_pubmed(references, file_name, data_dir=""): """method to fetch and populate references with pubmed""" try: - pubmed = load_file(file_name, tmp_dir) + pubmed = load_file(file_name, os.path.join(data_dir, "gn-meta/lit")) for reference in references: if pubmed.get(reference["doc_id"]): reference["pubmed"] = pubmed.get(reference["doc_id"]) return references except FileNotFoundError: - logging.debug("failed to find pubmed_path for %s/%s", - tmp_dir, file_name) + logging.error("failed to find pubmed_path for %s/%s", + data_dir, file_name) return references |