Example #1
0
    def __init__(self, dal, **kwargs):

        self.dal = dal

        self.logger = create_logger(
            logger_name=type(self).__name__,
            logger_level=kwargs.get("logger_level", "DEBUG")
        )
Example #2
0
    def __init__(self, api_key: str, **kwargs):
        """Constructor and initialization.

        Args:
            api_key (str): The Google Places API key.
        """

        # Internalize arguments.
        self.api_key = api_key

        self.logger = create_logger(logger_name=type(self).__name__,
                                    logger_level=kwargs.get(
                                        "logger_level", "DEBUG"))
Example #3
0
from typing import Iterable, Optional, List

from ct_ingester.config import import_config
from ct_ingester.loggers import create_logger

import sqlalchemy.orm
from fform.dals_ct import DalClinicalTrials
from fform.orm_ct import Study
from fform.orm_ct import StudyFacility
from fform.orm_ct import StudyDates
from fform.orm_ct import Location

from ct_ingester.utils import chunk_generator
from ct_ingester.sentry import initialize_sentry

logger = create_logger(logger_name=__name__)


def find_recent_studies(
    session: sqlalchemy.orm.Session,
    num_days: Optional[int] = None,
    chunk_size: Optional[int] = 1000,
    skip_populated: Optional[bool] = False,
) -> Iterable[Iterable[Study]]:
    """ Retrieves recently updated studies."""

    query = session.query(Study)  # type: sqlalchemy.orm.Query
    query = query.join(Study.locations)

    # Add filter to ignore studies without locations.
    query = query.filter(Location.location_id != None)
Example #4
0
    def __init__(self, **kwargs):
        """ Constructor and initialization."""

        self.logger = create_logger(logger_name=type(self).__name__,
                                    logger_level=kwargs.get(
                                        "logger_level", "DEBUG"))