Skip to content

Commit

Permalink
Apply code review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
surchs committed Dec 16, 2024
1 parent 395306d commit 6591e64
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/api/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,12 @@ async def get(
for (dataset_uuid, dataset_name), group in results_df.groupby(
by=dataset_cols
):
num_matching_subjects = group["sub_id"].nunique()
# TODO: The current implementation is valid in that we do not return
# results for datasets with fewer than min_cell_count subjects. But
# ideally we would handle this directly inside SPARQL so we don't even
# get the results in the first place. See #267 for a solution.
if group["sub_id"].nunique() < util.MIN_CELL_SIZE.val:
if num_matching_subjects < util.MIN_CELL_SIZE.val:
continue
if util.RETURN_AGG.val:
subject_data = "protected"
Expand Down Expand Up @@ -292,7 +293,7 @@ async def get(
if not group["dataset_portal_uri"].isna().any()
else None
),
num_matching_subjects=group["sub_id"].nunique(),
num_matching_subjects=num_matching_subjects,
records_protected=util.RETURN_AGG.val,
subject_data=subject_data,
image_modals=list(
Expand Down

0 comments on commit 6591e64

Please sign in to comment.