Spaces:
Sleeping
feat: structured eligibility assessment with per-criterion verdicts (#15)
Browse files- Add agents/eligibility.py: two-step pipeline — bulk LLM parse of
eligibility text into structured constraints, then deterministic
code evaluation (Path A) for known patient fields; research LLM
handles unclear criteria inline (Path B, no extra call)
- Add data/criterion_keys.json: canonical key → patient/platform
field mapping; extend without touching agent code
- Add data/tools/{parse_criteria,parse_criteria_bulk,assess_eligibility}.json
- Extend models.py: CriterionVerdict, ParsedConstraint, EligibilityCriterion,
CriterionAssessment, TrialEligibilityReport
- trials_api.py: extract full fields (sex, healthy_volunteers, std_ages,
study_type, enrollment, conditions, keywords, interventions); remove
1000/500-char truncations; pageSize 200 → 1000 (fewer round trips)
- agents/intake.py: accept onset_date/diagnosis_date (YYYY-MM) and
compute months in Python — fixes LLM arithmetic drift on current date
- agents/research.py: bulk parse + strip after each search; yield
("status", msg) events for live progress (per study type)
- app.py: handle status events; colorize ✓/✗/! verdicts with inline
HTML spans (green/red/yellow); sanitize_html=False on chatbot
- prompts.py: updated research format to render eligibility checklist
from parsed_criteria + deterministic_verdicts
- design/eligibility-assessment.md: full design doc
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>