Skip to content

Commit

Permalink
Merge pull request #523 from bento-platform/fix/biosample-search-counts
Browse files Browse the repository at this point in the history
fix: biosamples search total count
  • Loading branch information
v-rocheleau authored Jul 17, 2024
2 parents 5848709 + 00cf6e7 commit 7391fcb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
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

0 comments on commit 7391fcb

Please sign in to comment.