Skip to content

feat: assessment remediation — safety defaults, NER/OCR improvements, audit logging, compliance metadata#20

Merged
SPerekrestova merged 13 commits intomainfrom
fix/assessment-remediation
Mar 23, 2026
Merged

feat: assessment remediation — safety defaults, NER/OCR improvements, audit logging, compliance metadata#20
SPerekrestova merged 13 commits intomainfrom
fix/assessment-remediation

Conversation

@SPerekrestova
Copy link
Copy Markdown
Owner

@SPerekrestova SPerekrestova commented Mar 23, 2026

Summary

  • Phase 1 (Safety): Replace zero-shot severity classification with deterministic template parsing for DrugBank interactions (severity_parser.py); unknown severity now defaults to major; confidence gating added; uncertain field propagated to API responses
  • Phase 2 (NER/OCR): Swap NER model to PharmaDetect-BioPatient-108M; add OCR text preprocessor (ocr_cleaner.py) applied before NER; needs_confirmation flag added for low-confidence drug identifications
  • Phase 3 (MCP server): Build-time severity parsing added to build-db.js (mirrors Python logic); VERSION file generated at build; severity field passed through drugbank-api.js and Python client. Note: This is a forward-looking optimization — the DB is built by the upstream CI pipeline at openpharma-org/drugbank-mcp-server which requires a DrugBank API key. Until that pipeline rebuilds, the severity field will be null in the DB, and the Python runtime fallback (template parser → classifier) handles classification transparently.
  • Phase 4 (Observability): Structured audit logging middleware with contextvars (audit_log.py); wired into drug_analyzer.py and interaction_checker.py; cache TTL reduced to 4h; admin /admin/cache/clear endpoint added
  • Phase 5 (Compliance): data_sources version stamps on all API responses; limitations field with scope disclaimer on interaction responses

Test Plan

  • 148 tests passing (pytest tests/ -q)
  • NER model OpenMed/OpenMed-NER-PharmaDetect-BioPatient-108M verified accessible and outputs B-CHEM/I-CHEM labels (compatible with existing filter)
  • Deploy and smoke-test /interactions response for uncertain, data_sources, and limitations fields
  • Verify audit log JSON appears in application logs on a real request

🤖 Generated with Claude Code

@SPerekrestova SPerekrestova self-assigned this Mar 23, 2026
@SPerekrestova SPerekrestova merged commit f90267e into main Mar 23, 2026
3 checks passed
@SPerekrestova SPerekrestova deleted the fix/assessment-remediation branch March 23, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant