Skip to content

Signal approximate totals for age-only trial count searches#217

Merged
imaurer merged 2 commits intomainfrom
signal-age-count-approximation
Mar 14, 2026
Merged

Signal approximate totals for age-only trial count searches#217
imaurer merged 2 commits intomainfrom
signal-age-count-approximation

Conversation

@imaurer
Copy link
Copy Markdown
Collaborator

@imaurer imaurer commented Mar 14, 2026

Summary

  • Age-only --count-only trial searches now signal that the returned total is approximate, since BioMCP's age post-filter runs during full search rather than the fast count path
  • Text output appends (approximate, age post-filtered) to the total; JSON output adds "approximate": true
  • The --age help text notes the approximation behavior for CTGov-only fast-count paths
  • COUNT_TRAVERSAL_PAGE_CAP is hoisted to the module-level constant block alongside other traversal constants

Details

When a user runs biomcp search trial --age N --count-only, BioMCP previously returned CTGov's upstream total without indicating that the actual result set may be smaller after client-side age filtering. This change makes that approximation explicit.

A new TrialCount enum (Exact, Approximate, Unknown) annotates the return type of count_all_with_ctgov_client and count_all. The Approximate variant fires only on the CTGov age-only fast path. All other count paths continue returning Exact or Unknown as before, with no change to their output.

Test plan

  • make build passes
  • make test passes (632 tests)
  • make check passes (clippy + fmt)
  • make spec passes (113 passed, 5 skipped)
  • Age-only --count-only text output shows (approximate, age post-filtered) qualifier
  • Age-only --count-only JSON output includes "approximate": true
  • Non-age --count-only output is unchanged (no qualifier, no approximate field)

@imaurer imaurer merged commit 430459b into main Mar 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant