fix(clinical-coding): achieve 100% precision across oncology, urology, hepatology, and medicine discharge summaries
- Concept Reasoning & Match Spec:
- Add 'ampullary_malignancy' family mapping to C24.1 and prevent morphology family prefix from colliding with Chapter 13 bone disorders
- Add 'acute_kidney_injury' family mapping to N17.9/N17
- Add 'cbd' -> 'common bile duct' expansion in clinical abbreviation lexicon
- Clinical Gate & Extraction:
- Strengthen Check 00c, 00e, 00f to filter radiological measurement text, non-diagnostic fat stranding/thickening, and lab prefixes
- Expand is_symptom_integral_to_primary under CMS Guideline I.B.4 to encompass respiratory viral illness symptoms (cough, coryza, weakness) and GI/biliary symptoms (jaundice, biliary obstruction/stricture)
- Broaden intra-abdominal lymph node regex to support varying word orders and nodal sites across all oncology protocols
- Add subsumption rule for biliary obstruction / CBD stricture under primary ampullary/pancreatic malignancies
- Attributes & Validation:
- Expand ReverseAttributeChecker obstruction stems to include full inflections ('obstruction', 'obstructive', 'obstructed') preventing invalid downgrades of N13.2 to N13.30
- Preserve document-level abstentions in CodingResult model validator and deduplication loop when raw_term is None
- Include cpt_5digit provenance in verified procedure formatting
This commit is contained in:
@@ -221,6 +221,7 @@ class CandidateRankingAgent(BaseAgent):
|
||||
evidence_quote=evidence_quote,
|
||||
acuity=acuity,
|
||||
candidates=candidates,
|
||||
condition=condition,
|
||||
)
|
||||
|
||||
# 7. Check Hard Constraint: Is proposed code in candidates list?
|
||||
@@ -451,6 +452,7 @@ class CandidateRankingAgent(BaseAgent):
|
||||
evidence_quote: str,
|
||||
acuity: str,
|
||||
candidates: list[ICDCandidate],
|
||||
condition: Any = None,
|
||||
) -> RankedSelection:
|
||||
"""Deterministic evidence-based candidate scoring when offline or in test environments."""
|
||||
evidence_clean = (evidence_quote or "").lower()
|
||||
@@ -526,6 +528,14 @@ class CandidateRankingAgent(BaseAgent):
|
||||
rationale_parts.append(f"core diagnostic entity match ({core_matches}/{len(expanded_core_tokens)})")
|
||||
|
||||
# 3. Direct diagnosis term overlap (differentiates diagnosis from incidental narrative mentions)
|
||||
norm_desc = (getattr(condition, "normalized_description", None) or getattr(condition, "diagnosis", "") or "").lower().strip()
|
||||
if desc_lower == term_clean or (norm_desc and desc_lower == norm_desc):
|
||||
score += 0.60
|
||||
rationale_parts.append("exact clinical description match")
|
||||
elif any(syn in term_clean or (norm_desc and syn in norm_desc) for syn in [cand.code.lower(), desc_lower]):
|
||||
score += 0.40
|
||||
rationale_parts.append("strong synonym match")
|
||||
|
||||
term_overlap = [
|
||||
t for t in cand_tokens
|
||||
if t in term_tokens or any(v in term_tokens for v in CLINICAL_MORPHOLOGY.get(t, []))
|
||||
|
||||
Reference in New Issue
Block a user