-
Notifications
You must be signed in to change notification settings - Fork 49
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
Added fuzzymatching to AttributesUtil.java #91
Conversation
There was a problem hiding this 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"; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
||
if (FUZZY_MATCHING == "true") { | ||
qidoPath.append("fuzzymatching=true" + "&"); | ||
} | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Code alignment
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.
There was a problem hiding this 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
throw new DicomWebException("test-generated exception", Status.InvalidAttributeValue); | ||
} | ||
}, Status.InvalidAttributeValue); |
There was a problem hiding this comment.
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);
There was a problem hiding this comment.
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.
import/src/test/java/com/google/cloud/healthcare/imaging/dicomadapter/CFindServiceTest.java
Show resolved
Hide resolved
added assertThat for with and without fuzzymatching
Thanks, everything looks good, but there's still some merge conflicts, could you please fix those? |
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh Okay
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.