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

use min validator on core tags for latest api #3056

Merged
merged 3 commits into from
Sep 22, 2023
Merged

Conversation

esmadau
Copy link
Contributor

@esmadau esmadau commented Sep 22, 2023

Description

  • Use minimum validator to generate error for core tags and know when to fail a post
  • continue to use fo-dicom validator to generate warnings, but continue to omit warning when is valid string aside from being padded with null values

Related issues

Addresses [AB#109809].

Testing

Added and updated tests. Added tests around expectations for in/valid core tags like patient id and uids

… to fail a post

- continue to use fo-dicom validator to generate warnings, but continue to omit warning when is valid string aside from being padded with null values
…sses minimum validator but not fo-dicom validator
@esmadau esmadau marked this pull request as ready for review September 22, 2023 18:46
@esmadau esmadau requested a review from a team as a code owner September 22, 2023 18:46
@@ -188,6 +187,27 @@ public async Task GivenV2Enabled_WhenNonRequiredTagNull_ExpectTagValidatedAndNoE
Assert.Empty(result.InvalidTagErrors);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the test that fails in main branch on core tag uid validation where the uid validation passes minimum validator but not fo-dicom validator


ValidationWarnings warning = ValidationWarnings.None;
if (dicomElement != null)
{
if (dicomElement.ValueRepresentation != queryTag.VR)
if (dicomElement.ValueRepresentation != dicomTag.GetDefaultVR())
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should we store the VR, rather than calling twice

/// <exception cref="ElementValidationException"/>
void Validate(DicomElement dicomElement);
void Validate(DicomElement dicomElement, bool withLeniency = false);
Copy link
Member

Choose a reason for hiding this comment

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

I think this should perhaps be an enum indicative of some sort of "ruleset", like:

Suggested change
void Validate(DicomElement dicomElement, bool withLeniency = false);
void Validate(DicomElement dicomElement, ValidationRules rules = ValidationRules.Default); // Or maybe "Strict"?

{
// validate with additional leniency
var validationWarning =
dicomDataset.ValidateDicomTag(requiredCoreTag, _minimumValidator, withLeniency: true);
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for this new boolean? I see ValidateDicomTag called from 2 places, one is STOW and other in Re-index. We can have the same in re-indexing too right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

none of us like this with Leniency flag- Monday I will encapsulate this within some type of rules/enum/something

@@ -250,15 +304,15 @@ string EnsureRequiredTagIsPresent(DicomTag dicomTag)
}
catch (DicomValidationException ex)
{
validationResultBuilder.Add(ex, item.Tag, isCoreTag: RequiredCoreTags.Contains(item.Tag));
validationResultBuilder.Add(ex, item.Tag, isCoreTag: false);
Copy link
Member

Choose a reason for hiding this comment

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

Is the implication here that the query tags cannot include core tags?

Copy link
Contributor

Choose a reason for hiding this comment

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

QueryTags can include since we validate the core tags in the previous step and I think it should still choose to check for isCoreTag

Copy link
Contributor

@bcarthic bcarthic left a comment

Choose a reason for hiding this comment

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

Left few minor comments that can be fixed later

@esmadau esmadau merged commit ee01239 into main Sep 22, 2023
@esmadau esmadau deleted the users/esmadau/useminvaltr branch September 22, 2023 23:03
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.

4 participants