Spaces:
Sleeping
Sleeping
Commit History
-
fix: enforce patient's phase preference in API call, not LLM guidance
KevinIsInCoding +1: Claude Sonnet 4.6Previously the research LLM was expected to forward profile.phases to the search tool — an unreliable pattern. Now the code sets phases directly from profile.phases for INTERVENTIONAL searches, ignoring whatever the LLM passed. EAP and OBSERVATIONAL searches are unaffected (phase filters don't apply there). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>276f805
-
perf: rank trials by phase, cap at 15, strip bloat, tighten defaults (#25)
KevinIsInCoding +1: Claude Sonnet 4.6Unverified signatureTrial ranking (Phase 4 > Phase 3 > ... > EAP > Observational) replaces pure distance sorting so the highest-value trials surface first. Token reduction (~60-80% of tool-result payload): - _rank_and_slim: cap at 15 trials before LLM, strip summary/conditions/ keywords/age fields/std_ages/eligibility, reduce nearest_sites 5→3, drop intervention descriptions - max_tokens: research 8096→3000, bulk-parse eligibility 8192→4096 Default search radius: 100 miles → 20 miles Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>a009989 -
test(critic-fixes): address brittleness, over-mocking, and missing edge cases (#20)
KevinIsInCoding +1: Claude Sonnet 4.6Unverified signatureFindings from post-wave-4 critic review: Missing edge cases (high): - test_models.py: add TestGeocodeZip covering valid Nominatim response and empty-results → ValueError (pytest-httpx) - test_eligibility.py: document that _resolve_patient_value("sex") returns found=False because PatientProfile has no sex field Missing edge cases (medium): - test_trials_api.py: add test_location_at_zero_lat_is_silently_dropped documenting that lat=0.0 is falsy and causes the site to be skipped - test_intake.py: add test_future_date_returns_negative documenting that _months_from_date does not clamp future dates to zero Brittleness fixes (medium): - test_eligibility.py: test_empty_eligibility_text_returns_pass now uses assert_not_called() instead of an unconsumed side_effect list - test_research.py: test_two_search_calls_before_end_turn now asserts the return value instead of only call_count - test_trials_api.py: test_geo_filter_formatted now asserts structure instead of exact float-to-st…3d5e588 -
test(wave-4): LLM orchestration tests for eligibility, intake, and research (#19)
KevinIsInCoding +1: Claude Sonnet 4.6Unverified signaturetests/agents/test_eligibility.py extended (54 tests total): - _parse_criteria: empty text skips API, criterion+constraint parsed, no-constraint→None, missing tool call→empty, exactly 1 API call - _assess_llm: empty→no call, pass/fail verdict mapping, unknown key skipped, missing tool call→all UNKNOWN - run_eligibility_check: deterministic criterion resolved without LLM assess, fail when criterion fails, empty eligibility→PASS, call counts - bulk_parse_and_strip: fields stripped, parsed_criteria/deterministic_verdicts added, verdict computed for known key, trials beyond top_n untouched, empty eligibility skipped, API failure returns empty verdicts tests/agents/test_intake.py (20 tests): - _months_from_date: same-month, 1-month, 12-month, year-boundary, multi-year, invalid string, empty string (freezegun) - _resolve_months: prefers date key, fallback to int, missing both→0, None→0 - stream_intake_turn: token events, text event+updated messages, identify_disease→reset_strea…a6f4696 -
test(wave-3): deterministic eligibility and trials_api tests (#18)
KevinIsInCoding +1: Claude Sonnet 4.6Unverified signaturetests/agents/test_eligibility.py (37 tests): - _evaluate_deterministic: every operator (<=, >=, ==, !=, in, not_in, between) × pass/fail; output shape (confidence=high, patient_value stringified, reason format, unit inclusion, TypeError→FAIL) - _resolve_patient_value: patient.* fields, platform.* with/without data, unknown key - _compute_overall: precedence rule FAIL>UNKNOWN>PASS, empty list→PASS tests/test_trials_api.py (30 tests): - _flatten_and_rank: sort order, None-distance sorts last, nearest_sites capped at 5, central-contact phone fallback, required key presence - search_trials_api aggFilters: all 8 case-matrix branches from the inline comment in trials_api.py - search_trials_api pagination: nextPageToken forwarded, multi-page accumulation, empty response - search_trials_api retry: succeeds after 1 failure, raises after 3 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>9e87f14 -
test(wave-1): add test infrastructure and conftest.py (#16)
KevinIsInCoding +1: Claude Sonnet 4.6Unverified signatureSet up pytest with pytest-mock, pytest-httpx, freezegun, and pytest-cov. Adds tests/conftest.py with shared fixtures (als_patient, mock_client) and factory functions (make_text_block, make_tool_use_block, make_message, FakeStream) that all subsequent test waves will depend on. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>01a873b