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

Added fuzzymatching to AttributesUtil.java #91

Merged
merged 15 commits into from
Jul 9, 2020

Conversation

satheesh09
Copy link
Contributor

The current version didn't specify configs to enable fuzzymatching attribute that will perform wildcard search on CFIND Requests specifically when partial patient name (first or last name) is supplied as an input parameter. The current version works in such a way that we need to provide the exact patient full name as such it appears in the DICOM tag which would be challenging for any user to provide that as an input to a CFIND query. As per the Google documentation on fuzzymatching (https://cloud.google.com/healthcare/docs/dicom#search_parameters), I added fuzzymatching attribute to negotiate fuzzy semantic patient name attribute matching.

Copy link
Collaborator

@danielbeaudreau danielbeaudreau left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@@ -42,6 +42,8 @@

private static final int INSTANCES_LIMIT = 50000;
private static final int STUDIES_SERIES_LIMIT = 5000;

private static final String FUZZY_MATCHING = "true";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make this a boolean flag registered in https://github.com/GoogleCloudPlatform/healthcare-dicom-dicomweb-adapter/blob/master/import/src/main/java/com/google/cloud/healthcare/imaging/dicomadapter/Flags.java so that users could enable or disable it if their backend doesn't support the fuzzy matching parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that's a good idea, I'll make that change and will request your review.

Comment on lines 123 to 127

if (FUZZY_MATCHING == "true") {
qidoPath.append("fuzzymatching=true" + "&");
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can also append fuzzy matching for an instances level retrieval, so I think this if statement could be moved outside of the switch statement, since it would apply for all query retrieve levels

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I have tried adding it out of the switch, but I got a build failure for doing fuzzy matching at INSTANCE level. That's why I put it inside STUDY and SERIES level.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What was the build failure? It might be a unit test that needs to be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is a unit test.

expected: instances?limit=50000&00080061=MG&
but was : instances?limit=50000&fuzzymatching=true&00080061=MG&
at com.google.cloud.healthcare.imaging.dicomadapter.AttributesUtilTest.testAttributesToQidoPathArray_manyModalitiesSet(AttributesUtilTest.java:105)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, can you please update the tests as well so that the build passes with fuzzy matching enabled for all three retrieval levels?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per our discussion I have added the fuzzymatching attribute to Flags and referenced it in code. Let me know if everything looks OK after you reviewed my changes.

Copy link
Contributor

@pavertomato pavertomato Jul 6, 2020

Choose a reason for hiding this comment

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

could you please add unit tests to check what url is have or have not fuzzymatching parameter on different retrieval levels?
also if you don't mind - squash commits into single one

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1, please add a unit test

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good overall though. I'm not sure why the contributor license agreement presubmit check isn't running, I'll need to figure that out before we submit this.

Copy link
Contributor Author

@satheesh09 satheesh09 Jul 9, 2020

Choose a reason for hiding this comment

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

added unit test for fuzzy matching.

Added changes to receive CFIND flags from ImportAdapter.java to construct RESTful URL with fuzzymatching
Added changes to send CFIND flags to CFindService.java to construct RESTful URL with fuzzymatching
Added fuzzymatching attribute to perform wildcard search on patient names.
Sending null flag to CFindService upon testing
added null check on flags
Added empty flag for CFIND test case.
Added Unit test for fuzzy matching.
Copy link
Collaborator

@danielbeaudreau danielbeaudreau left a comment

Choose a reason for hiding this comment

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

Thanks! I just have a couple more small comments then this is good to submit.

One more thing, can you please verify that you've signed the contributor license agreement with instructions here? https://github.com/GoogleCloudPlatform/healthcare-dicom-dicomweb-adapter/blob/master/CONTRIBUTING.md#contributor-license-agreement

Comment on lines 130 to 132
throw new DicomWebException("test-generated exception", Status.InvalidAttributeValue);
}
}, Status.InvalidAttributeValue);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this isn't testing an error case, I think we should return a dummy response and assert for a success status in both of these tests. E.g:

@OverRide
public JSONArray qidoRs(String path) throws DicomWebException {
JSONArray instances = new JSONArray();
instances.put(TestUtils.dummyQidorsInstance());
return instances;
}
}, Status.Success);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. I also double checked the contributor license agreement. I can find my Individual Agreements on file that I signed on Jul 02, 2020.

added assertThat for with and without fuzzymatching
@danielbeaudreau
Copy link
Collaborator

Thanks, everything looks good, but there's still some merge conflicts, could you please fix those?

@satheesh09
Copy link
Contributor Author

Conflicts resolved.

@@ -112,8 +112,8 @@ public static void main(String[] args) throws IOException, GeneralSecurityExcept

// Handle C-FIND
IDicomWebClient dicomWebClient =
new DicomWebClient(requestFactory, dicomwebAddress, STUDIES);
CFindService cFindService = new CFindService(dicomWebClient);
new DicomWebClient(requestFactory, flags.dicomwebAddress, STUDIES);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be just dicomwebAddress

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh Okay

@danielbeaudreau danielbeaudreau merged commit be7ae71 into GoogleCloudPlatform:master Jul 9, 2020
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.

3 participants