Skip to content

Commit

Permalink
fix: biosamples search total count
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rocheleau committed Jul 17, 2024
1 parent 5848709 commit c67b156
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions chord_metadata_service/discovery/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,15 @@ async def bento_public_format_count_and_stats_list(

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(int(q["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

0 comments on commit c67b156

Please sign in to comment.