Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions healthchain/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import logging
import warnings

from .utils.logger import add_handlers
from .utils.logger import get_logger
from .config.base import ConfigManager, ValidationLevel


# Enable deprecation warnings
warnings.filterwarnings("always", category=DeprecationWarning, module="healthchain")

logger = logging.getLogger(__name__)

add_handlers(logger)
logger.setLevel(logging.INFO)
logger = get_logger(__name__)

# Export them at the top level
__all__ = ["ConfigManager", "ValidationLevel", "api", "ehr", "sandbox"]
Expand Down
4 changes: 2 additions & 2 deletions healthchain/config/base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import yaml
import logging
from healthchain.utils.logger import get_logger
import os
from pathlib import Path
from typing import Dict, Any, Optional, List

log = logging.getLogger(__name__)
log = get_logger(__name__)


def _deep_merge(target: Dict, source: Dict) -> None:
Expand Down
4 changes: 2 additions & 2 deletions healthchain/config/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
This module provides validation models and utilities for configuration files.
"""

import logging
from healthchain.utils.logger import get_logger
from pydantic import BaseModel, ValidationError, field_validator, ConfigDict
from typing import Dict, List, Any, Optional, Type, Union

logger = logging.getLogger(__name__)
logger = get_logger(__name__)

#
# Base Models
Expand Down
4 changes: 2 additions & 2 deletions healthchain/fhir/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

import pandas as pd
import logging
from healthchain.utils.logger import get_logger

from typing import Any, Dict, List, Union, Optional, Literal
from collections import defaultdict
Expand All @@ -20,7 +20,7 @@
encode_gender,
)

logger = logging.getLogger(__name__)
logger = get_logger(__name__)


# Resource handler registry
Expand Down
4 changes: 2 additions & 2 deletions healthchain/fhir/elementhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
as building blocks within FHIR resources (e.g., CodeableConcept, Attachment, Coding).
"""

import logging
from healthchain.utils.logger import get_logger
import base64
import datetime

Expand All @@ -13,7 +13,7 @@
if TYPE_CHECKING:
from healthchain.fhir.version import FHIRVersion

logger = logging.getLogger(__name__)
logger = get_logger(__name__)


def create_single_codeable_concept(
Expand Down
4 changes: 2 additions & 2 deletions healthchain/fhir/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
and reading data from FHIR resources.
"""

import logging
from healthchain.utils.logger import get_logger
import importlib
import re

from typing import Optional, Dict, Any, List
from fhir.resources.resource import Resource
from fhir.resources.documentreference import DocumentReference

logger = logging.getLogger(__name__)
logger = get_logger(__name__)


def _fix_timezone_naive_datetimes(data: Any) -> Any:
Expand Down
4 changes: 2 additions & 2 deletions healthchain/fhir/resourcehelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Parameters marked REQUIRED are required by FHIR specification.
"""

import logging
from healthchain.utils.logger import get_logger
import datetime

from typing import List, Optional, Dict, Any, Union, TYPE_CHECKING
Expand All @@ -29,7 +29,7 @@
if TYPE_CHECKING:
from healthchain.fhir.version import FHIRVersion

logger = logging.getLogger(__name__)
logger = get_logger(__name__)


def create_condition(
Expand Down
4 changes: 2 additions & 2 deletions healthchain/fhir/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"""

import importlib
import logging
from healthchain.utils.logger import get_logger
from contextlib import contextmanager
from enum import Enum
from typing import Any, Generator, Optional, Type, Union

logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class FHIRVersion(str, Enum):
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
healthcare-specific gateways, routes, middleware, and capabilities.
"""

import logging
from healthchain.utils.logger import get_logger

from contextlib import asynccontextmanager
from datetime import datetime
Expand All @@ -21,7 +21,7 @@
from healthchain.gateway.events.dispatcher import EventDispatcher
from healthchain.gateway.api.dependencies import get_app

logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class HealthChainAPI(FastAPI):
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
architecture of the gateway system.
"""

import logging
from healthchain.utils.logger import get_logger
import asyncio

from abc import ABC
Expand All @@ -16,7 +16,7 @@
from healthchain.gateway.api.protocols import EventDispatcherProtocol


logger = logging.getLogger(__name__)
logger = get_logger(__name__)


# Type variables for self-referencing return types and generic gateways
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/cds/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging
from healthchain.utils.logger import get_logger

from typing import Any, Callable, Dict, List, Optional, TypeVar, Union

Expand All @@ -14,7 +14,7 @@
from healthchain.sandbox.workflows import UseCaseMapping


logger = logging.getLogger(__name__)
logger = get_logger(__name__)

# Type variable for self-referencing return types
T = TypeVar("T", bound="CDSHooksService")
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/clients/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
management and refresh.
"""

import logging
from healthchain.utils.logger import get_logger
import os
import uuid
import asyncio
Expand All @@ -17,7 +17,7 @@
from pydantic import BaseModel


logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class OAuth2Config(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/clients/fhir/aio/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging
from healthchain.utils.logger import get_logger
import httpx

from typing import Any, Dict, Type, Union
Expand All @@ -11,7 +11,7 @@
from healthchain.gateway.clients.fhir.base import FHIRAuthConfig, FHIRServerInterface


logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class AsyncFHIRClient(FHIRServerInterface):
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/clients/fhir/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
import logging
from healthchain.utils.logger import get_logger
import httpx

from abc import ABC, abstractmethod
Expand All @@ -15,7 +15,7 @@
from pydantic import BaseModel


logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class FHIRClientError(Exception):
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/clients/fhir/sync/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging
from healthchain.utils.logger import get_logger
import httpx

from typing import Any, Dict, Type, Union
Expand All @@ -11,7 +11,7 @@
from healthchain.gateway.clients.fhir.base import FHIRAuthConfig, FHIRServerInterface


logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class FHIRClient(FHIRServerInterface):
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/clients/fhir/sync/connection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging
from healthchain.utils.logger import get_logger
import urllib.parse

from typing import Dict
Expand All @@ -7,7 +7,7 @@
from healthchain.gateway.fhir.errors import FHIRConnectionError


logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class FHIRConnectionManager:
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/events/dispatcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging
from healthchain.utils.logger import get_logger
import asyncio
from enum import Enum
from pydantic import BaseModel
Expand All @@ -10,7 +10,7 @@
from fastapi_events.middleware import EventHandlerASGIMiddleware


logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class EHREventType(Enum):
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/fhir/aio.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging
from healthchain.utils.logger import get_logger

from contextlib import asynccontextmanager
from typing import Any, Dict, Optional, Type
Expand All @@ -15,7 +15,7 @@
from healthchain.fhir import add_provenance_metadata


logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class AsyncFHIRGateway(BaseFHIRGateway):
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/fhir/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging
from healthchain.utils.logger import get_logger
import inspect
import warnings

Expand All @@ -14,7 +14,7 @@
from healthchain.gateway.base import BaseGateway


logger = logging.getLogger(__name__)
logger = get_logger(__name__)


# Type variable for FHIR Resource
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/fhir/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
including status code mapping, error formatting, and exception types.
"""

import logging
from healthchain.utils.logger import get_logger
from typing import Optional

logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class FHIRConnectionError(Exception):
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/fhir/sync.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging
from healthchain.utils.logger import get_logger

from typing import Any, Dict, Type, Optional

Expand All @@ -13,7 +13,7 @@
from healthchain.fhir import add_provenance_metadata


logger = logging.getLogger(__name__)
logger = get_logger(__name__)


class FHIRGateway(BaseFHIRGateway):
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/soap/fastapiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from healthchain.models.requests.cdarequest import CdaRequest
from healthchain.models.responses.cdaresponse import CdaResponse
import base64
import logging
from healthchain.utils.logger import get_logger
from pathlib import Path

logger = logging.getLogger(__name__)
logger = get_logger(__name__)

# SOAP namespace for envelope
SOAP_NS = "http://schemas.xmlsoap.org/soap/envelope/"
Expand Down
4 changes: 2 additions & 2 deletions healthchain/gateway/soap/notereader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Epic's CDA document processing services.
"""

import logging
from healthchain.utils.logger import get_logger

from typing import Any, Callable, Dict, Optional, TypeVar, Union

Expand All @@ -19,7 +19,7 @@
from healthchain.models.responses.cdaresponse import CdaResponse
from healthchain.gateway.soap.fastapiserver import create_fastapi_soap_router

logger = logging.getLogger(__name__)
logger = get_logger(__name__)


# Type variable for self-referencing return types
Expand Down
4 changes: 2 additions & 2 deletions healthchain/interop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .generators.cda import CDAGenerator
from .generators.fhir import FHIRGenerator

import logging
from healthchain.utils.logger import get_logger
from pathlib import Path
from typing import Optional, Union

Expand Down Expand Up @@ -106,7 +106,7 @@ def create_interop(
Raises:
ValueError: If config_dir doesn't exist or if validation_level/environment has invalid values
"""
logger = logging.getLogger(__name__)
logger = get_logger(__name__)

if config_dir is None:
# Use bundled configs as default
Expand Down
Loading