Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements_web.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-e git+https://github.com/biothings/biothings.api.git@0.12.x#egg=biothings[web_extra]
pandas==1.4.3
pandas==1.5.3
pyjwt[crypto]==2.4.0
scipy==1.9.0
Jinja2==3.1.2
Expand Down
2 changes: 1 addition & 1 deletion web/handlers/genomics/prevalence.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def _get(self):
df_response = df_response.fillna("None")
df_response = df_response[["date", "total_count", "lineage_count", "lineage", "prevalence", "prevalence_rolling"]]
else:
df_response = df_response.groupby("lineage").apply(expand_dates, df_response["date"].min(), df_response["date"].max(), "date", "lineage").reset_index()
df_response = df_response.groupby("lineage", group_keys=False).apply(expand_dates, df_response["date"].min(), df_response["date"].max(), "date", "lineage").reset_index()
df_response = df_response.groupby("date").apply(compute_total_count, "lineage_count", "total_count").reset_index()
df_response = df_response.groupby("lineage").agg({"total_count": "sum", "lineage_count": "sum"}).reset_index()
df_response.loc[:,"prevalence"] = df_response["lineage_count"]/df_response["total_count"]
Expand Down
1 change: 0 additions & 1 deletion web/handlers/genomics/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def expand_dates(df, date_min, date_max, index_col, grp_col):
df
.set_index(index_col)
.reindex(idx, fill_value = 0)
.drop(grp_col, axis = 1)
.reset_index()
.rename(
columns = {
Expand Down
Copy link
Copy Markdown

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
Copy Markdown
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?

Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def _get(self):
]
else:
df_response = (
df_response.groupby("lineage")
df_response.groupby("lineage", group_keys=False)
.apply(
expand_dates,
df_response["date"].min(),
Expand Down