Skip to content

Add section-aware grounding context that scopes concept matches by note section #929

Description

@maziyarpanahi

Summary

The same term grounds differently by section (a drug under 'Allergies' is an allergen, under 'Medications' an active drug, under 'Family History' not the patient's). A grounding-context layer that biases and constrains candidate concepts by the detected section materially improves grounding precision.

Scope

  • Add clinical/grounding/section_context.py mapping detected sections to semantic-type biases and exclusions for grounding
  • Adjust ConceptMatch ranking and filter implausible concepts given the section (e.g. allergen vs medication)
  • Attach the governing section and any experiencer to each grounded concept for downstream filtering
  • Expose apply_section_context(matches, sections, experiencer)

Acceptance criteria

  • Golden fixture grounds the same term to different/biased concepts under Allergies vs Medications sections
  • Family-history-section concepts are tagged non-patient and down-ranked for the patient record
  • Section biases are data-driven and configurable, not hard-coded constants
  • Offline; no raw PHI persisted beyond offsets and concept ids

Out of scope

  • The clinical section detector itself (already shipped/wired)
  • Concept-normalization confidence calibration (separate task)

Files

  • openmed/clinical/grounding/section_context.py
  • tests/unit/clinical/grounding/test_section_context.py

Task: OM-572 · Milestone: v2.2 · Priority: P2 · Size: M
Depends on: OM-510 · Blocks: —
Roadmap: v2.2 trustworthy clinical data exchange follow-on wave
Spec: PLANS/V2/EXECUTION/tasks/OM-572.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2MediumimprovementHardening / refactor of existing coderoadmap-v2OpenMed V2 roadmap backlog

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions