dalgu90 / icd-coding-benchmark

Automatic ICD coding benchmark based on the MIMIC dataset
MIT License
35 stars 5 forks source link

Load ConfigMapper objects without explicit import statements #32

Closed dalgu90 closed 2 years ago

dalgu90 commented 2 years ago

To set objects of the ConfigMapper, we explicitly import modules that contain the objects we want to get from the ConfigMapper. For example, in run.py, we need to import modules at line (1) to load dataset classes at line (2). This happens in many files in the repo, and create unnecessary import statements. We may need a way to implicitly import all the modules that ConfigMapper needs to load.

...
from src.datasets import *  <- (1)
from src.models import *
from src.trainers import *
from src.utils.configuration import Config
from src.utils.import_related_ops import pandas_related_ops
from src.utils.mapper import ConfigMapper
...

    train_data = ConfigMapper.get_object("datasets", config.dataset.name)(
        config.dataset.params.train
    ) <- (2)
dalgu90 commented 2 years ago

Resolved in #47