Skip to content

Commit

Permalink
Tweak logging for anonymisation (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefpiatek authored Nov 27, 2024
1 parent c57540c commit 76e35fc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions orthanc/orthanc-anon/plugin/pixl.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ def _import_study_from_raw(study_resource_id: str, study_uid: str) -> None:
zipped_study=zipped_study,
study_uid=study_uid,
)
except PixlDiscardError as discard:
logger.warning("Failed to anonymize study {}: {}", study_uid, discard)
except Exception: # noqa: BLE001
logger.exception("Failed to anonymize study: {} ", study_uid)
return
Expand Down Expand Up @@ -357,6 +359,7 @@ def _anonymise_study_instances(zipped_study: ZipFile, study_uid: str) -> tuple[l
message = f"All instances have been skipped for study {study_uid}"
raise PixlDiscardError(message)

logger.success("Finished anonymising file: {} for study: {}", file, study_uid)
return anonymised_instances_bytes, anonymised_study_uid


Expand Down
2 changes: 1 addition & 1 deletion pixl_dcmd/src/pixl_dcmd/_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def get_unexported_image(
"""
Get an existing, non-exported (for this project) image record from the database
identified by the study UID. If no result is found, retry with querying on
MRN + accession number. If this fails as well, raise a PixlDiscardError.
MRN + accession number. If this fails as well, raise a NoResultFound.
"""
try:
existing_image: Image = (
Expand Down
2 changes: 1 addition & 1 deletion pixl_dcmd/src/pixl_dcmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def anonymise_dicom(
msg = f"Dropping DICOM Modality: {dataset.Modality}"
raise PixlSkipInstanceError(msg)

logger.info("Anonymising received instance: {}", study_info)
logger.debug("Anonymising instance for: {}", study_info)

# Merge tag schemes
tag_operations = load_tag_operations(project_config)
Expand Down

0 comments on commit 76e35fc

Please sign in to comment.