Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

59 correct series invalidity #60

Merged
merged 5 commits into from
Sep 5, 2024
Merged

59 correct series invalidity #60

merged 5 commits into from
Sep 5, 2024

Conversation

CavRiley
Copy link
Collaborator

Overview

This pull request addresses a bug where invalid inputs to non-required fields are not being caught, resulting in an "INVALID" modality classification error.

Implementation

  • Input Validation: Implemented a validation check for non-required fields to ensure that any invalid inputs are sanitized or ignored with a default value before processing.
  • Error Handling: Added error handling to catch and manage cases where invalid inputs were previously causing the system to classify the modality as "INVALID." Inputs that are numerical are verified to be able to convert to floats.

Testing

  • Automated Tests: Updated and added new unit tests to cover scenarios involving invalid or empty inputs in non-required fields.
  • Manual Testing: Performed manual testing using an anonymized dataset to verify that invalid inputs are now properly handled without causing modality classification errors.

Problems Faced

There were issues deciding upon what was the best way to catch cases with optional input fields that were empty. We decided to initialize every optional value in the data set dictionary with a default empty value and overrode the value if provided.

Notes

N/A

@CavRiley CavRiley linked an issue Aug 29, 2024 that may be closed by this pull request
@CavRiley CavRiley requested a review from mbrzus September 4, 2024 20:02
@@ -627,6 +652,23 @@ def sanitize_dicom_dataset(
return dataset_dictionary, True


def validate_numerical_dataset_element(element: str) -> str | float:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure this function is able to sanitize None Type values as well

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionally ansure unit testing for this function with different cases. Be careful using typehints and ensure that function won't crush the tool when encountering wrong type

dataset_dictionary[field] = dataset[field].value
dataset_dictionary[field] = validate_numerical_dataset_element(
dataset_value
)
elif field == "Manufacturer":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for fields that do not use the new "validate_numerical_dataset_element" function, ensure that they are sanitized for the None Type

@mbrzus
Copy link
Collaborator

mbrzus commented Sep 5, 2024

we have to ensure that the code is sanitized and test cover the None Type fields that I believe could be returned by pydicom in their DatasetElement object.

ENH: added catch for returning None value from dataset elements
DOC: updated pyproject version number to 0.9.3 (727c66c)

DOC: updated version number to 0.9.2 in pyproject (f5d38c5)
STYLE: black fixes

TEST: testing verbose printing for dicom tag error

ENH: separated operations for improved debugging

FIX?: git lfs files are pulled from remote on github action
Copy link
Collaborator

@mbrzus mbrzus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good work!

@mbrzus mbrzus merged commit 7cdf7be into main Sep 5, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Seemingly Correct Series are Being Discarded
2 participants