fix(validation): implement prioritized surgical oncology repair plan and semantic code validation
- Fix UI crash NameError: name 'Path' is not defined in medical_coding.ui.app - Item 1: Enforce semantic code validation first; reject laterality and anatomical site mismatches even if active and billable - Item 2: Segregate surgical procedures from diagnosis inventory (mastectomy, salpingo-oophorectomy in procedures, blocked from secondary diagnoses) - Item 3: Capture structured oncology context preserving histology, grade, ER/PR/HER2 receptors, Ki-67, and treatment response - Item 4: Extract operative findings separately with UHDDS eligibility gate (incidental findings excluded from secondary diagnosis coding) - Item 5: Ground audit claims in evidence-based semantic checks (LateralityMatch, AnatomicalSiteMatch, SemanticAttributeMatch) - Item 6: Accelerate candidate retrieval latency via query-level caching in HybridICDRetriever - Add UI presentation cards for procedures, structured oncology, operative findings, and enhanced audit trails - Add comprehensive test suite in tests/test_surgical_oncology_repair.py
This commit is contained in:
@@ -418,6 +418,8 @@ def extract_diagnoses_node(state: PipelineGraphState) -> dict[str, Any]:
|
||||
"extracted_diagnoses": legacy_extracted,
|
||||
"clinical_diagnosis_state": clinical_diag_state,
|
||||
"diagnosis_candidates": clinical_diag_state.all_candidates if clinical_diag_state else [],
|
||||
"extracted_procedures": getattr(clinical_diag_state, "procedures", []) if clinical_diag_state else [],
|
||||
"operative_findings": getattr(clinical_diag_state, "operative_findings", []) if clinical_diag_state else [],
|
||||
"current_stage": PipelineStage.EXTRACTION,
|
||||
}
|
||||
except Exception as e:
|
||||
@@ -1209,6 +1211,9 @@ def finalize_output_node(state: PipelineGraphState) -> dict[str, Any]:
|
||||
primary_diagnosis=primary_response,
|
||||
secondary_diagnoses=secondary_responses,
|
||||
abstentions=abstentions,
|
||||
procedures=state.get("extracted_procedures", []) or (getattr(diag_state, "procedures", []) if diag_state else []),
|
||||
operative_findings=state.get("operative_findings", []) or (getattr(diag_state, "operative_findings", []) if diag_state else []),
|
||||
oncology_context=diag_state.oncology_context.model_dump() if diag_state and getattr(diag_state, "oncology_context", None) else None,
|
||||
excluded_candidates=excluded_candidates,
|
||||
validation={
|
||||
"evidence_grounded": True,
|
||||
@@ -1225,6 +1230,9 @@ def finalize_output_node(state: PipelineGraphState) -> dict[str, Any]:
|
||||
"audit_trail": audit_trail,
|
||||
"validated_code_count": len(validated),
|
||||
"abstention_count": len(abstentions),
|
||||
"extracted_procedures": state.get("extracted_procedures", []) or (getattr(diag_state, "procedures", []) if diag_state else []),
|
||||
"operative_findings": state.get("operative_findings", []) or (getattr(diag_state, "operative_findings", []) if diag_state else []),
|
||||
"oncology_context": diag_state.oncology_context.model_dump() if diag_state and getattr(diag_state, "oncology_context", None) else None,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user