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

#162 add study id for runs #163

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Conversation

Azher2Ali
Copy link
Contributor

Updated the code to incorporate the study id in runs filter and in runs method along with current analysis id filter

Updated schema file for adding study id
Updated Data fetcher code to incorporate study id filter
Updated Search fields with study id
Updated Analysis with study id field
Updated Run repository to include study id related fields
@Azher2Ali Azher2Ali requested a review from joneubank March 7, 2023 20:26
Copy link
Member

@joneubank joneubank left a comment

Choose a reason for hiding this comment

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

Thanks, looks like a couple places where changes are needed.

if (analysisId instanceof String) {
return Mono.just(new Analysis((String) analysisId));
final Object studyId = values.get("studyId");
if (analysisId instanceof String && studyId instanceof String) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to handle the cases with just analysisId or just studyId? I think they are both optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both are optional but for the Analysis object creation we need both the arguments..


// short circuit here since can't find runs for invalid analysisId
if (isNullOrEmpty(analysisId) || !analysisId.equals(filerAnalysisId)) {
if ((isNullOrEmpty(analysisId) || !analysisId.equals(filerAnalysisId))
&& (isNullOrEmpty(studyId) || !analysisId.equals(filterStudyId))) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
&& (isNullOrEmpty(studyId) || !analysisId.equals(filterStudyId))) {
&& (isNullOrEmpty(studyId) || !studyId.equals(filterStudyId))) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the code. Can you please review.

Comment on lines 192 to 198
.put(
STUDY_ID,
value -> {
val q = new MultiMatchQueryBuilder(value, STUDY_SEARCH_FIELDS.toArray(String[]::new));
q.minimumShouldMatch("100%");
return q;
})
Copy link
Member

Choose a reason for hiding this comment

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

Should this be TermQueryBuilder instead of a MultiMatchQueryBuilder ? I think a run can have multiple analysis_ids but only a single Study ID ever.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a TermQueryBuilder also I have made the changes accordingly.

Updated Data fetchers code based on the review comments
Updated Run repository code based on the review comments
@Azher2Ali Azher2Ali requested a review from joneubank March 8, 2023 15:47
return Mono.just(new Analysis((String) analysisId, (String) studyId));
final Object studyId = values.get("studyId");
if (analysisId instanceof String || studyId instanceof String) {
return Mono.just(new Analysis((String) analysisId, (String) studyId);
Copy link
Member

Choose a reason for hiding this comment

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

Just confirming before approval, will this handle properly null values for analysisId and studyId?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I have updated the Analysis.java constructor logic to check the null values.

Updated null check for analysisId and studyId
@Azher2Ali Azher2Ali requested a review from joneubank March 9, 2023 19:26
Comment on lines +41 to +53
public Analysis(String analysisId, String studyId) {
if (null!=analysisId) {
this.analysisId = analysisId;
} else {
this.analysisId = "";
}
if (null!=studyId) {
this.studyId = studyId;
} else {
this.studyId = "";
}
}

Copy link
Member

Choose a reason for hiding this comment

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

Can this be accomplished with @AllArgsConstructor and some annotations for default values? Its also possible that for the filters having null works better than empty string, might change the matching behavior.

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.

2 participants