"""Pipeline to convert .nirx to SNIRF."""

import logging

from almirah import index
from almirah import Layout
from almirah import Specification
from almirah.utils.convert import convert

logging.basicConfig(filename="logs/convert_nirs_to_SNIRF.log", level=logging.DEBUG)
logging.getLogger().addHandler(logging.StreamHandler())

SRC = ""
DST = ""

source_spec = Specification.create_from_file("configs/specifications/sourcedata.yaml")
src_lay = Layout(root=SRC, specification_name="sourcedata")

bids_spec = Specification.create_from_file("configs/specifications/bids.yaml")
dst_lay = Layout(root=DST, specification_name="bids")

src_lay.index(f"{SRC}/nirs")
index.commit()

files = src_lay.query(sourcetype="nirs", extension=".nirx")
anonymize = {"daysback": "", "keep_his": False}
convert(files, "SNIRF", dst_lay, anonymize=anonymize)
