feat(pipeline): complete healing and hardening of clinical reasoning and matching pipeline
- Implement soft dimensional compatibility and 3-way attribute logic (SUPPORTED, CONTRADICTED, UNKNOWN) - Replace binary hardwall rejection with nuanced compatibility scoring - Isolate context per diagnosis to prevent cross-condition contamination (MD Sec 41) - Generalize disease families (liver sarcoma, net, asthma, acl) and category priors - Add regex word boundary acuity checking and laterality alignment scoring in ranker - Fix candidate sort by sorting on unconstrained multi-factor raw score before output clamping - Preserve zero-modification immutability of local Database_2.xlsx - Pass 100% of full regression test suite (158/158 tests) and ruff linting
This commit is contained in:
@@ -78,7 +78,7 @@ class HybridICDRetriever(BaseICDRetriever):
|
||||
return []
|
||||
|
||||
# Retrieve candidates from both local engines with an expanded initial window
|
||||
search_window = max(k * 3, 20)
|
||||
search_window = max(k * 10, 350)
|
||||
lexical_hits = self.lexical_retriever.retrieve(clean_query, top_k=search_window)
|
||||
vector_hits = self.vector_retriever.retrieve(clean_query, top_k=search_window)
|
||||
|
||||
@@ -140,7 +140,13 @@ class HybridICDRetriever(BaseICDRetriever):
|
||||
sem = info["semantic_score"]
|
||||
lex = info["lexical_score"]
|
||||
|
||||
hybrid_score = (self.weight_semantic * sem) + (self.weight_lexical * lex)
|
||||
if sem > 0.0 and lex > 0.0:
|
||||
hybrid_score = (self.weight_semantic * sem) + (self.weight_lexical * lex)
|
||||
elif sem > 0.0:
|
||||
hybrid_score = sem * 0.85
|
||||
else:
|
||||
hybrid_score = lex * 0.85
|
||||
|
||||
rounded_score = max(0.0, min(1.0, round(hybrid_score, 4)))
|
||||
|
||||
# Filter against relevance threshold
|
||||
|
||||
Reference in New Issue
Block a user