Skip to content

feat: Clinical RAG and Search Enhancements#40

Merged
BigSimmo merged 1 commit into
mainfrom
feat/rag-and-search-enhancements
Jun 19, 2026
Merged

feat: Clinical RAG and Search Enhancements#40
BigSimmo merged 1 commit into
mainfrom
feat/rag-and-search-enhancements

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

This PR implements logical improvements to the RAG pipeline, including LLM query re-writing, semantic chunking, and boilerplate suppression.

- Integrated LLM-based query re-writing for clinical optimization
- Implemented semantic-aware chunking for medical documents
- Enhanced boilerplate suppression in ranking logic
- Expanded clinical vocabulary and synonym groups
- Verified with type checking and tests
@BigSimmo
BigSimmo merged commit e7bde6e into main Jun 19, 2026
7 of 10 checks passed
@BigSimmo
BigSimmo deleted the feat/rag-and-search-enhancements branch June 19, 2026 06:07
BigSimmo added a commit that referenced this pull request Jun 19, 2026
…rged #38 (#41)

Re-applies the 6 blocking clinical-safety fixes (B1-B6) on top of current
main. PR #38 merged 22 RAG fixes before these blockers landed, and #39/#40
did not address them, so main still trusts wrong doses.

- B1: numeric verification now matches by exact normalized token-set
  membership instead of substring, so "2.5 mg" no longer verifies against
  "12.5 mg" (5x dose error). Fails closed.
- B2: fold unicode superscripts (×10⁹/L) to ASCII before extraction/match.
- B3: percentage branch no longer ends in \b (which could never match), so
  percentages extract and percentage mismatches are flagged.
- B4: numeric gate now scans answerSections[].body (medication_dose),
  scoped to each section's citation_chunk_ids.
- B5: safeFallbackAnswer fails closed on parse failure (ungrounded, no
  citation back-fill) and still runs the numeric gate; extractive recovery
  and strong-retry routing updated accordingly.
- B6: retry route reset is a single conditional UPDATE guarded on
  status/locked_at; 0 rows affected => 409, closing the TOCTOU race.
- N1: verifyAnswerNumbers fails closed when no cited chunk maps to a result.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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