From d588c7cc2f62f0c35fff0fd343193123ac00b128 Mon Sep 17 00:00:00 2001 From: adish-rmr Date: Sun, 16 Nov 2025 18:52:48 +0100 Subject: [PATCH] update conn string --- old/debug_echa_find.py | 4 ++-- old/echa_find.py | 2 +- src/pif_compiler/api/routes/api_echa.py | 2 +- src/pif_compiler/{services => functions}/common_log.py | 0 src/pif_compiler/{services => functions}/db_utils.py | 6 +++--- src/pif_compiler/main.py | 2 +- src/pif_compiler/services/__init__.py | 4 ++-- src/pif_compiler/services/cosing_service.py | 2 +- src/pif_compiler/services/srv_echa.py | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) rename src/pif_compiler/{services => functions}/common_log.py (100%) rename src/pif_compiler/{services => functions}/db_utils.py (91%) diff --git a/old/debug_echa_find.py b/old/debug_echa_find.py index ddb7f93..0920c21 100644 --- a/old/debug_echa_find.py +++ b/old/debug_echa_find.py @@ -17,7 +17,7 @@ def _(): @app.cell def _(): - from pif_compiler.services.common_log import get_logger + from pif_compiler.functions.common_log import get_logger log = get_logger() return (log,) @@ -128,7 +128,7 @@ def _(response_dossier_json, substance): @app.cell def _(): - from pif_compiler.services.db_utils import get_client + from pif_compiler.functions.db_utils import get_client client = get_client() diff --git a/old/echa_find.py b/old/echa_find.py index 3fda9f6..85b625f 100644 --- a/old/echa_find.py +++ b/old/echa_find.py @@ -4,7 +4,7 @@ import re as standardre import json from bs4 import BeautifulSoup from datetime import datetime -from pif_compiler.services.common_log import get_logger +from pif_compiler.functions.common_log import get_logger logger = get_logger() diff --git a/src/pif_compiler/api/routes/api_echa.py b/src/pif_compiler/api/routes/api_echa.py index 7bb22c9..0f2bafb 100644 --- a/src/pif_compiler/api/routes/api_echa.py +++ b/src/pif_compiler/api/routes/api_echa.py @@ -3,7 +3,7 @@ from pydantic import BaseModel, Field from typing import Optional, Dict, Any from pif_compiler.services.srv_echa import orchestrator -from pif_compiler.services.common_log import get_logger +from pif_compiler.functions.common_log import get_logger logger = get_logger() diff --git a/src/pif_compiler/services/common_log.py b/src/pif_compiler/functions/common_log.py similarity index 100% rename from src/pif_compiler/services/common_log.py rename to src/pif_compiler/functions/common_log.py diff --git a/src/pif_compiler/services/db_utils.py b/src/pif_compiler/functions/db_utils.py similarity index 91% rename from src/pif_compiler/services/db_utils.py rename to src/pif_compiler/functions/db_utils.py index de85302..9b1fc58 100644 --- a/src/pif_compiler/services/db_utils.py +++ b/src/pif_compiler/functions/db_utils.py @@ -4,7 +4,7 @@ from urllib.parse import quote_plus from dotenv import load_dotenv from pymongo import MongoClient -from pif_compiler.services.common_log import get_logger +from pif_compiler.functions.common_log import get_logger # config log and env logger = get_logger() @@ -16,8 +16,8 @@ def get_client(): MONGO_HOST = os.getenv("MONGO_HOST") MONGO_PORT = os.getenv("MONGO_PORT") - MONGO_PORT = MONGO_PORT ADMIN_PASSWORD = quote_plus(ADMIN_PASSWORD) + ADMIN_USER = quote_plus(ADMIN_USER) client = MongoClient( f"mongodb://{ADMIN_USER}:{ADMIN_PASSWORD}@{MONGO_HOST}:{MONGO_PORT}/?authSource=admin", @@ -42,7 +42,7 @@ def db_connect(db_name : str = 'toxinfo', collection_name : str = 'substance_ind if __name__ == "__main__": coll = db_connect() - if coll: + if coll is not None: logger.info("Database connection successful.") else: logger.error("Database connection failed.") \ No newline at end of file diff --git a/src/pif_compiler/main.py b/src/pif_compiler/main.py index ab9d4b1..92489f5 100644 --- a/src/pif_compiler/main.py +++ b/src/pif_compiler/main.py @@ -5,7 +5,7 @@ from fastapi.exceptions import RequestValidationError from contextlib import asynccontextmanager import time -from pif_compiler.services.common_log import get_logger +from pif_compiler.functions.common_log import get_logger # Import dei tuoi router from pif_compiler.api.routes import api_echa diff --git a/src/pif_compiler/services/__init__.py b/src/pif_compiler/services/__init__.py index fa24331..71a8a5e 100644 --- a/src/pif_compiler/services/__init__.py +++ b/src/pif_compiler/services/__init__.py @@ -30,11 +30,11 @@ from pif_compiler.services.pubchem_service import ( ) # Logging -from pif_compiler.services.common_log import ( +from pif_compiler.functions.common_log import ( get_logger, ) -from pif_compiler.services.db_utils import get_client +from pif_compiler.functions.db_utils import get_client __all__ = [ diff --git a/src/pif_compiler/services/cosing_service.py b/src/pif_compiler/services/cosing_service.py index e327674..f40adb5 100644 --- a/src/pif_compiler/services/cosing_service.py +++ b/src/pif_compiler/services/cosing_service.py @@ -2,7 +2,7 @@ import json as js import re import requests as req from typing import Union -from pif_compiler.services.common_log import get_logger +from pif_compiler.functions.common_log import get_logger logger = get_logger() diff --git a/src/pif_compiler/services/srv_echa.py b/src/pif_compiler/services/srv_echa.py index e008f6d..7278011 100644 --- a/src/pif_compiler/services/srv_echa.py +++ b/src/pif_compiler/services/srv_echa.py @@ -7,8 +7,8 @@ from bs4 import BeautifulSoup from dotenv import load_dotenv from playwright.sync_api import sync_playwright -from pif_compiler.services.common_log import get_logger -from pif_compiler.services.db_utils import db_connect +from pif_compiler.functions.common_log import get_logger +from pif_compiler.functions.db_utils import db_connect log = get_logger() load_dotenv()