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: biosamples search total count #523

Merged
merged 2 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 8 additions & 10 deletions chord_metadata_service/discovery/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,18 @@ async def bento_public_format_count_and_stats_list(
stats_list: list[BinWithValue] = []
total: int = 0

# TODO: improve censorship tests for search/beacon counts/stats
async for q in annotated_queryset:
label = q["label"]
value = thresholded_count(int(q["value"]), discovery, low_counts_censored)
raw_value = int(q["value"])
thresholded_value = thresholded_count(raw_value, discovery, low_counts_censored)

# Be careful not to leak values if they're in the database but below threshold
if value == 0:
continue
# increment with raw count for accurate total
total += raw_value

# Skip 'missing' values
if label is None:
continue

total += value
stats_list.append({"label": label, "value": value})
# Be careful not to leak values if they're in the database but below threshold
if label is not None and thresholded_value > 0:
stats_list.append({"label": label, "value": thresholded_value})

return thresholded_count(total, discovery, low_counts_censored), stats_list

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "chord_metadata_service" # can be renamed to katsu if inner module directory is renamed too
version = "8.0.0"
version = "8.0.1"
description = "An implementation of a clin/pheno metadata store for the Bento platform."
authors = [
"Ksenia Zaytseva",
Expand Down