Skip to content
moah0911Public

About

Medical document assistant linking diagnoses to ICD-10, meds to RxNorm, procedures to SNOMED CT — Strands Agents + Amazon Bedrock + NLM APIs

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Rack — Medical Document Processing Assistant

Python 3.10+ Strands Agents Amazon Bedrock ICD-10 RxNorm SNOMED CT

CLI assistant that extracts text from clinical documents and links diagnoses, medications, and treatments to standardized codes: ICD-10, RxNorm, and SNOMED CT — with confidence scores.

Built by Boyina Gowtham · AI Engineer × DevRel

Built with Strands Agents + Amazon Bedrock (Claude) + NLM terminology APIs.

Architecture

Architecture diagram

  • Customer sends medical charts (PDF/image/text) to the Medical document processing Agent.
  • Agent calls tools: file_read/process_document for intake, get_* for single-term lookup, link_* for bulk extraction with codes + confidence.
  • Lookups hit NLM Clinical Tables (ICD-10), NLM RxNav (RxNorm), Snowstorm (SNOMED CT-US); Bedrock is the fallback.
  • Amazon Bedrock LLM (us.anthropic.claude-sonnet-4-6) handles document extraction and structured linking; text PDFs fall back to PyPDF.

What it does

Input clinical PDF / image / free text → extract content → output structured coded entities with confidence scores:

  • Diagnoses → ICD-10
  • Medications (+ dosage/frequency) → RxNorm
  • Treatments/procedures → SNOMED CT

Features

  • Document intake: PDF, JPG, JPEG, PNG, TIFF, BMP via process_document tool.
    • PDFs/images sent to Bedrock for OCR-style extraction; text PDFs fall back to PyPDF if Bedrock fails.
  • Single-term lookup: get_icd, get_rx, get_snomed.
    • ICD-10: NLM Clinical Tables API (no auth).
    • RxNorm: NLM RxNav API (no auth).
    • SNOMED CT: Snowstorm terminology server (US Edition). Bedrock fallback if API fails.
  • Bulk linking: link_icd, link_rx, link_snomed — extract all entities from clinical text and return JSON arrays with codes + confidence_score.

Project structure

rack/
├── main.py                 # CLI loop + Strands Agent setup
├── document_processor.py   # process_document tool (Bedrock + PyPDF fallback)
├── medical_coding_tools.py # get_*/link_* tools (NLM/Snowstorm + Bedrock fallback)
├── requirements.txt
├── .env.example
└── images/architecture.png

Prerequisites

  • Python 3.10+
  • AWS account with Bedrock access in your region
  • Bedrock model access for us.anthropic.claude-sonnet-4-6 (default, configurable)

Installation

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env

Fill in .env:

Variable Required Default / Notes
AWS_ACCESS_KEY_ID yes —
AWS_SECRET_ACCESS_KEY yes —
AWS_REGION yes us-east-1
BEDROCK_MODEL_ID no us.anthropic.claude-sonnet-4-6
SNOMED_API_KEY no Only if Snowstorm requires auth

Dependencies: strands-agents, strands-agents-tools, boto3, pypdf, requests, python-dotenv, pillow, pandas.

Usage

python main.py

Options:

  1. Process a document — provide path to PDF or image.
  2. Process a clinical note — paste multi-line text (blank line to submit).
  3. Process a sample note — runs built-in example:
    Carlie had a seizure 2 weeks ago. She is complaining of frequent headaches
    Nausea is also present. She also complains of eye trouble with blurry vision
    Meds : Topamax 50 mgs at breakfast daily,
    Send referral order to neurologist
    Follow-up as scheduled
    
  4. Exit — prints accumulated usage metrics on exit.

Example output shapes

Diagnosis:

[{"diagnosis": "Atrial fibrillation", "ICD10_code": "I48.0", "description": "Paroxysmal atrial fibrillation", "confidence_score": "95%"}]

Medication:

[{"medication": "Topamax", "RxNorm_code": "36926", "description": "Topiramate 50 MG Oral Tablet", "dosage": "50 mg", "frequency": "daily", "confidence_score": "95%"}]

Procedure:

[{"procedure": "Referral to neurologist", "SNOMED_code": "306206005", "description": "Referral to neurology service", "confidence_score": "95%"}]

Supported inputs & limits

Input Handling
Text PDF PyPDF fast path if Bedrock unavailable and text layer > 50 chars
Scanned/image PDF Bedrock only; errors if Bedrock unreachable
JPG/JPEG/PNG/TIFF/BMP Bedrock only
Other extensions Returns {"error": "Unsupported file format"}
Missing file Returns {"error": "File not found: ..."}

NLM APIs need internet; all coding tools fall back to Bedrock on API failure and return confidence_score: "0%" with an error field on total failure.

Disclaimer

Assistive tooling only — not medical advice. Always verify codes with qualified clinical/coding staff before use in care, billing, or records. You are responsible for PHI handling and HIPAA/GDPR compliance when sending documents to AWS Bedrock or terminology APIs.

Troubleshooting

  • File not found — check path passed to option 1; CLI also validates with os.path.exists before calling the agent.
  • Bedrock AccessDenied — enable model access in Bedrock console and check AWS_REGION / BEDROCK_MODEL_ID.
  • Empty SNOMED/RxNorm results — API returned no match ("Not found", 0%); retry with generic term or rely on Bedrock fallback.

Author

Boyina Gowtham — AI Engineer × DevRel · GitHub · LinkedIn · Medium

About

Medical document assistant linking diagnoses to ICD-10, meds to RxNorm, procedures to SNOMED CT — Strands Agents + Amazon Bedrock + NLM APIs

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages