Skip to content

Commit

Permalink
if pydicom debug is on, store incoming datasets to private dir
Browse files Browse the repository at this point in the history
build only windows-2022, macos-13
  • Loading branch information
mdevans committed Oct 25, 2024
1 parent cdef026 commit 1441232
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, windows-latest, macos-13, macos-latest, ubuntu-latest]
os: [windows-2022, macos-13]

steps:
- name: Checkout repository
Expand Down
10 changes: 10 additions & 0 deletions src/controller/anonymizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,16 @@ def anonymize(self, source: DICOMNode | str, ds: Dataset) -> str | None:
"""
self._model_change_flag = True # for autosave manager

# If pydicom logging is on, trace phi UIDs and store incoming phi file in private/source
if self.model.logging_levels.pydicom:
logger.debug(f"=>{ds.PatientID}/{ds.StudyInstanceUID}/{ds.SeriesInstanceUID}/{ds.SOPInstanceUID}")
filename = self.local_storage_path(self.model.private_dir(), ds)
logger.debug(f"SOURCE STORE: {source} => {filename}")
try:
ds.save_as(filename)
except Exception as e:
logger.error(f"Error storing source file: {repr(e)}")

# Calculate date delta from StudyDate and PatientID:
date_delta = 0
if hasattr(ds, "StudyDate") and hasattr(ds, "PatientID"):
Expand Down
2 changes: 0 additions & 2 deletions src/controller/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,6 @@ def _handle_store(self, event: Event):
)
return C_SUCCESS

logger.info(f"=>{ds.PatientID}/{ds.StudyInstanceUID}/{ds.SeriesInstanceUID}/{ds.SOPInstanceUID}")

self.anonymizer.anonymize_dataset_ex(remote_scu, ds)
return C_SUCCESS

Expand Down

0 comments on commit 1441232

Please sign in to comment.