# Path: tinasoft/data/medline.py
# class Record(dict):
# class Importer(sourcefile.Importer):
#     def __init__(self):
#     def __init__(self, path, **options):
#     def get_record(self):
#     def _parse_period(self, record):
#     def next(self):
#     def __iter__(self):


from tinasoft.data import medline, Handler
from os.path import join
import logging
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

__author__="elishowk@nonutc.fr"


# get tinasoft's logger
_logger = logging.getLogger('TinaAppLogger')


class Importer(Handler):
    """
    Medline archive handler
    """
    def __init__(self, path, **config):
        if 'medlinearchive' in config:
            self.loadOptions(config['medlinearchive'])
        self.fileconfig = config['medline']
        self.path = path

    def walkArchive(self, periods):
        """
        For a given list of periods
        Yields a medline file reader for each period
        """
        for id in periods:
            abstractFilePath = join(self.path, id, id + '.txt')

# Path: tinasoft/data/medline.py
# class Record(dict):
# class Importer(sourcefile.Importer):
#     def __init__(self):
#     def __init__(self, path, **options):
#     def get_record(self):
#     def _parse_period(self, record):
#     def next(self):
#     def __iter__(self):


# Path: tinasoft/data/medlinearchive.py
from tinasoft.data import medline, Handler
from os.path import join
import logging

#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

__author__="elishowk@nonutc.fr"


# get tinasoft's logger
_logger = logging.getLogger('TinaAppLogger')


class Importer(Handler):
    """
    Medline archive handler
    """
    def __init__(self, path, **config):
        if 'medlinearchive' in config:
            self.loadOptions(config['medlinearchive'])
        self.fileconfig = config['medline']
        self.path = path

    def walkArchive(self, periods):
        """
        For a given list of periods
        Yields a medline file reader for each period
        """
        for id in periods:
            abstractFilePath = join(self.path, id, id + '.txt')

            reader = medline.Importer( abstractFilePath, **self.fileconfig )