Add min and max date filters to lineage-mutations.#92
Draft
everaldorodrigo wants to merge 1 commit intomasterfrom
Draft
Add min and max date filters to lineage-mutations.#92everaldorodrigo wants to merge 1 commit intomasterfrom
everaldorodrigo wants to merge 1 commit intomasterfrom
Conversation
mindoftea
reviewed
Jul 17, 2023
| lineages=query_pangolin_lineage, mutations=query_mutations | ||
| ) | ||
| # print(query) | ||
| parse_time_window_to_query(date_range_filter, query["query"]) |
There was a problem hiding this comment.
The current behavior looks like the date range filter isn't operating. I think the problem might be that we need to change this line to update the query with the new time window being calculated -- something like query["query"] = parse_time_window... maybe?
Collaborator
Author
There was a problem hiding this comment.
Looking into the range filter created here:
outbreak.api/web/handlers/genomics/util.py
Line 302 in 0fa9506
When making the request to the endpoint below for test purposes:
- /genomics/lineage-mutations?pangolin_lineage=BA.2&frequency=0&gene=ORF1a,ORF1b,S,ORF7b&min_date=2022-01-12&max_date=2022-10-22
The query created is below. The date range was added date_collected.
{
"size": 0,
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"term": {
"pangolin_lineage": "BA.2"
}
},
{
"range": {
"date_collected": {
"lte": "2022-10-22",
"gte": "2022-01-12"
}
}
}
]
}
}
]
}
},
"aggs": {
"mutations": {
"nested": {
"path": "mutations"
},
"aggs": {
"mutations": {
"terms": {
"field": "mutations.mutation",
"size": 10000
},
"aggs": {
"genomes": {
"reverse_nested": {}
}
}
}
}
}
}
}
The query dict is mutable and passed by reference when calling the function below:
parse_time_window_to_query(date_range_filter, query["query"])
Does it make sense?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.