-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: develop
Are you sure you want to change the base?
Changes from 5 commits
de8a8e6
34737ac
89add77
b4430c4
7aa342a
6099573
bd6e4c3
8fbde2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -21,6 +21,7 @@ | |||||
import static com.google.common.base.Strings.isNullOrEmpty; | ||||||
import static java.util.stream.Collectors.toUnmodifiableList; | ||||||
import static org.icgc_argo.workflow.search.model.SearchFields.ANALYSIS_ID; | ||||||
import static org.icgc_argo.workflow.search.model.SearchFields.STUDY_ID; | ||||||
import static org.icgc_argo.workflow.search.util.Converter.asImmutableMap; | ||||||
import static org.icgc_argo.workflow.search.util.JacksonUtils.convertValue; | ||||||
|
||||||
|
@@ -108,17 +109,21 @@ public AsyncDataFetcher<List<GqlRun>> getNestedRunInAnalysisDataFetcher() { | |||||
return environment -> { | ||||||
val analysis = (Analysis) environment.getSource(); | ||||||
val analysisId = analysis.getAnalysisId(); | ||||||
val studyId = analysis.getStudyId(); | ||||||
|
||||||
ImmutableMap<String, Object> filter = asImmutableMap(environment.getArgument("filter")); | ||||||
val filerAnalysisId = filter.getOrDefault(ANALYSIS_ID, analysisId); | ||||||
val filterStudyId = filter.getOrDefault(STUDY_ID, studyId); | ||||||
|
||||||
// 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))) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have updated the code. Can you please review. |
||||||
return Mono.empty(); | ||||||
} | ||||||
|
||||||
Map<String, Object> mergedFilter = new HashMap<>(filter); | ||||||
mergedFilter.put(ANALYSIS_ID, analysisId); | ||||||
mergedFilter.put(STUDY_ID, studyId); | ||||||
|
||||||
// Need to cast to get appropriate jackson annotation (camelCase property naming) | ||||||
return runService.getRuns(mergedFilter, null); | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,13 @@ public class RunRepository { | |
"parameters.analysis_id", | ||
"parameters.normal_aln_analysis_id", | ||
"parameters.tumour_aln_analysis_id"); | ||
|
||
private static final List<String> STUDY_SEARCH_FIELDS = | ||
List.of( | ||
"parameters.study_id", | ||
"parameters.normal_aln_study_id", | ||
"parameters.tumour_aln_study_id"); | ||
|
||
private static final Map<String, Function<String, AbstractQueryBuilder<?>>> QUERY_RESOLVER = | ||
argumentPathMap(); | ||
|
||
|
@@ -182,6 +189,13 @@ private static Map<String, Function<String, AbstractQueryBuilder<?>>> argumentPa | |
q.minimumShouldMatch("100%"); | ||
return q; | ||
}) | ||
.put( | ||
STUDY_ID, | ||
value -> { | ||
val q = new MultiMatchQueryBuilder(value, STUDY_SEARCH_FIELDS.toArray(String[]::new)); | ||
q.minimumShouldMatch("100%"); | ||
return q; | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is a TermQueryBuilder also I have made the changes accordingly. |
||
.put(REPOSITORY, RunRepository::repositoryQueryFunc) | ||
.build(); | ||
} | ||
|
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.
Do we need to handle the cases with just analysisId or just studyId? I think they are both optional
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.
both are optional but for the Analysis object creation we need both the arguments..