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

Fix grouping by lineage. #87

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

everaldorodrigo
Copy link
Collaborator

@everaldorodrigo everaldorodrigo commented Mar 25, 2023

Context

Getting HTTP 500 error in queries as:

/genomics/prevalence-by-location-all-lineages?location_id=USA&other_threshold=0.03&nday_threshold=5&ndays=60&window=60&ndays=60&cumulative=true&min_date=2022-01-22&max_date=2023-10-22

Solution

It was missing the column lineage in the dataframe after grouping by lineage.
The solution consists in adding the lineage column to data frame after the grouping by.
Also was considered the group_keys behavior changes from pandas 1.4 (1) to 1.5 (2).

Suggestion

Each transformation in the dataframe could be a testable function.

References

(1) https://pandas.pydata.org/pandas-docs/version/1.4/reference/api/pandas.DataFrame.groupby.html
(2) https://pandas.pydata.org/pandas-docs/version/1.5/reference/api/pandas.DataFrame.groupby.html

@mindoftea mindoftea self-requested a review June 12, 2023 22:49
Copy link
Collaborator

Choose a reason for hiding this comment

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

In order to fix the issue with all lineages being reported under "other", we need to update the get_major_lineage_prevalence function to consider the min_date and max_date, if available

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The function get_major_lineage_prevalence was updated to consider the min_date and max_date, if available.

Does this make sense, even if the ElasticSearch query is considering the min_date and max_date?

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