Commit Graph
11 Commits
Author SHA1 Message Date
Abhinav Gupta 536334f9ef 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
2026-10-15 22:27:20 +05:30
Abhinav Gupta 0a9fd5cf3f fix(oncology): resolve metastatic concept normalization, reverse attributes, and profile latency 2026-10-15 15:31:03 +05:30
Abhinav Gupta 0b5996ad1b Fix compound diagnosis splitting, section boundaries, and attribute matching for secondary completeness 2026-10-12 12:40:30 +05:30
Abhinav Gupta 7885abf57d 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
2026-10-09 11:39:20 +05:30
Abhinav Gupta c161b09095 fix(pipeline): implement comprehensive improvements across five key areas on noise-fix
- Area 1: Complete clinical inventory generation with compound concept decomposition (secondary to/due to), laterality preservation, and deduplication
- Area 2: First-class assertion, negation, entity typing, and CMS Guideline I.B.4 integral symptom suppression
- Area 3: Semantic code validation beyond database existence via reverse attribute matching and specificity downgrading
- Area 4: Strict UHDDS primary vs secondary role separation with complete deduplication and HTML escape rendering in Streamlit components
- Area 5: Exact clinical provenance preservation and 6-metric diagnostic scorecard with comprehensive regression tests
2026-10-09 10:42:54 +05:30
Abhinav Gupta 7b40481e36 fix: resolve HTML tag rendering bug and ensure explicit primary diagnosis precedence over secondary and meta-narratives 2026-10-08 15:03:02 +05:30
Abhinav Gupta 6a02ca2438 fix(pipeline): correct output arrangement, isolate noise, and properly assign primary vs secondary diagnoses 2026-10-08 13:34:03 +05:30
Abhinav Gupta ecaae40bbe fix(pipeline): word-boundary site matching, historical exclusion, trauma code gate, and retrieval fallback hardening
- ranker.py: Use \b word boundaries in has_matching_site to prevent 'fibula'
  matching inside 'calcaneofibular' (fixes S93.412A beating S93.422A).
  Add traumatic S/T code gate (-0.40) for non-trauma documentation.
- classifier.py: Expanded acuity detection (sepsis, infarction, STEMI/NSTEMI).
  Added pure-symptom suppression when definitive diagnoses are available.
  Improved primary/secondary classification reasons with evidence quotes.
  Fixed organism detection to exclude sepsis from supplementary code penalty.
- clinical_extractor.py: Detect historical/resolved diagnoses and mark with
  HISTORICAL role, zero relevance, and -50 admitting score. Added section
  types (PERTINENT_NEGATIVES, ASSESSMENT, PLAN). Fix sentence splitting to
  preserve decimal numbers (e.g. 101.4F). Skip metadata section headers.
- nodes.py: Refactored retrieval to use lexical_retriever for expansion
  queries and BM25 fallback (eliminates 80k-row full scan).
- tokenizer.py: Extended CLINICAL_MORPHOLOGY with renal/kidney/nephropathy,
  injury/failure, infarction/infarct/STEMI/NSTEMI mappings.
- clinical_gate.py: Added pertinent negatives, documentation audit, and
  final coding summary to metadata patterns. Extended prescription syntax.
- reverse_attributes.py: Added coronary/artery/vessel/wall/vein to
  non-specificity words for better attribute extraction.
- pipeline.py: Extract failed node name from traceback for error reporting.
- schemas/icd.py: Added 'fallback_token_scan' and 'vector_numpy' retrieval methods.
2026-10-07 12:32:27 +05:30
Abhinav Gupta a75ec4700a feat(pipeline): complete multi-diagnosis classification, UHDDS role assignment, and robust ICD code retrieval 2026-10-07 11:02:19 +05:30
Abhinav Gupta f5ec8a66de fix(pipeline): enforce Master Directive clinical reasoning, taxonomy, hard candidate gate, and generic query synthesis on extraction-fix 2026-10-06 17:08:45 +05:30
Abhinav Gupta 72d0da1c22 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
2026-10-06 14:43:16 +05:30