Skip to content

Commit

Permalink
consolidated utils into single module
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Nov 16, 2023
1 parent 937bbca commit ea2bc67
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 184 deletions.
11 changes: 9 additions & 2 deletions xnat_ingest/cli/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
from tqdm import tqdm
from .base import cli
from ..session import ImagingSession
from ..utils import logger
from .utils import DicomField, LogFile, LogEmail, MailServer, set_logger_handling
from ..utils import (
DicomField,
logger,
LogFile,
LogEmail,
MailServer,
set_logger_handling,
)


@cli.command(
Expand Down Expand Up @@ -84,6 +90,7 @@
"--log-file",
default=None,
type=LogFile,
metavar="<path> <loglevel>",
envvar="XNAT_INGEST_LOGFILE",
help=(
'Location to write the output logs to, defaults to "upload-logs" in the '
Expand Down
6 changes: 4 additions & 2 deletions xnat_ingest/cli/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
from arcana.xnat import Xnat
from .base import cli
from ..session import ImagingSession
from ..utils import logger, add_exc_note
from .utils import (
from ..utils import (
logger,
add_exc_note,
LogFile,
LogEmail,
MailServer,
Expand Down Expand Up @@ -57,6 +58,7 @@
"--log-file",
default=None,
type=LogFile,
metavar="<path> <loglevel>",
envvar="XNAT_INGEST_LOGFILE",
help=(
'Location to write the output logs to, defaults to "upload-logs" in the '
Expand Down
173 changes: 0 additions & 173 deletions xnat_ingest/cli/utils.py

This file was deleted.

12 changes: 7 additions & 5 deletions xnat_ingest/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,14 @@ def test_stage_and_upload(
[
str(dicoms_dir),
str(staging_dir),
"--assoc-files-glob",
str(associated_files_dir)
+ "/{PatientName.given_name}_{PatientName.family_name}*.ptd",
# "--assoc-files-glob",
# str(associated_files_dir)
# + "/{PatientName.given_name}_{PatientName.family_name}*.ptd",
"--log-file",
str(log_file),
"--raise-errors",
"--delete",
"info",
# "--raise-errors",
# "--delete",
]
)

Expand All @@ -209,6 +210,7 @@ def test_stage_and_upload(
str(staging_dir),
"--log-file",
str(log_file),
"info",
"--raise-errors",
"--include-dicoms",
"--delete",
Expand Down
Loading

0 comments on commit ea2bc67

Please sign in to comment.