Keep eligibility assessment enabled when CoT is disabled - #34
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
One critical and two moderate unresolved review findings must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR decouples eligibility assessment from CoT prompting, adds direct-JSON assessment, provenance-aware resume behavior, retrieval-only reporting, and related documentation.
Changes:
- Uses
rag.enabledas the assessment gate. - Records assessment controls, modes, outputs, and trial IDs.
- Adds stale-output suppression, fallback handling, reranking metadata preservation, and expanded validation.
File summaries
| File | Summary |
|---|---|
tests/test_resume_and_atomicity.py |
Updates resume and completion-marker coverage. |
tests/test_audit_fixes_batch8.py |
Updates resume fixtures. |
tests/test_assessment_modes.py |
Adds assessment-mode and resume coverage. |
src/trialmatchai/services/preflight.py |
Shares assessment gating. |
src/trialmatchai/orchestration.py |
Tracks controls for resume invalidation. |
src/trialmatchai/matching/trial_ranker.py |
Preserves run metadata during ranking. |
src/trialmatchai/matching/eligibility_base.py |
Supports forced output regeneration. |
src/trialmatchai/matching/assessment.py |
Defines assessment settings and provenance; retains two moderate issues concerning shortlist-budget invalidation and unavailable-run retryability. |
src/trialmatchai/main.py |
Dispatches assessment modes and fallback ranking; has a critical stale-output path after early assessment returns. |
src/trialmatchai/interop/exporters/templates/report.html |
Displays assessment status labels. |
src/trialmatchai/interop/exporters/html_report.py |
Suppresses stale or unavailable assessment data. |
src/trialmatchai/config/settings.py |
Documents independent assessment controls. |
src/trialmatchai/config/config.json |
Enables assessment explicitly by default. |
scripts/installed_smoke.py |
Validates retrieval-only metadata and reports. |
README.md |
Documents modes and migration. |
docs/production-validation.md |
Records validation results. |
docs/pipeline.md |
Documents assessment controls and provenance. |
docs/index.md |
Updates the workflow overview. |
docs/assets/readme-overview.svg |
Shows default assessment behavior. |
docs/assets/matching-flow.svg |
Shows assessment and retrieval-only paths. |
CHANGELOG.md |
Records unreleased behavior changes. |
Review details
Suppressed comments (1)
src/trialmatchai/matching/assessment.py:50
- When assessment remains enabled but every per-trial response is missing or an error, the new run is recorded as
assessment_status: "unavailable"with a retrieval fallback, but this predicate still marks it complete as soon as the controls match. A subsequent--resumetherefore skips the patient and never retries the error sidecars, even thoughBaseTrialProcessor.process_trialsexplicitly treats those files as retryable. Keep enabled/unavailable runs pending (while retainingno_candidatesas a terminal state) so assessment can be regenerated.
return (
isinstance(result.get("RankedTrials"), list)
and run.get("schema_version") == 1
and run.get("assessment") == assessment_settings(config)
)
- Files reviewed: 19/21 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disabling
use_cot_reasoningpreviously skipped the entire eligibility-assessment stage, despite both model processors supporting direct JSON assessment. The flowchart also presented assessment as an optional side branch.This change makes
rag.enabledthe shared stage gate for runtime and preflight.use_cot_reasoningselects the CoT or direct JSON prompt, with assessment still enabled by default. The SVGs now show assessment on the main workflow and an explicit retrieval-only bypass.Ranked results record assessment controls, mode, output availability, and assessed trial IDs. Reports label retrieval-only/partial results and suppress old assessments and reasoning text from prior runs. Switching assessment controls invalidates match completion and forces regeneration of per-trial outputs; unchanged, successful results retain resume. The shortlist budget is included in the controls. Partial or unavailable assessments stay pending, and retries reuse only compatible successful outputs. Deleted/corrupt assessment outputs also trigger a retry. Each attempt stages its outputs separately so early returns and failed writes cannot revive prior verdicts. Reranking preserves the metadata and cannot revive old assessments in a retrieval-only result. An all-missing/error assessment result uses the retrieval fallback.
Migration
Set
rag.enabled: falseto disable assessment.use_cot_reasoning: falsealone now selects direct JSON assessment. Legacy matches without the newRunmetadata are recomputed when matching resumes. The README and changelog mark this behavior as unreleased after 0.9.0; this PR does not publish another package version.Validation
This binds assessment controls only. Complete patient/corpus/model evidence identity, clinical completeness/decision semantics, and actual GPU qualification remain roadmap work. No benchmark improvement is claimed.