Skip to main content

Drug-drug interaction check tool for clinical AI agents. Curated JSON data, RxNorm normalization, LangChain-ready.

Project description

clinical-ddi-check

Drug-drug interaction (DDI) check tool for clinical AI agents. Curated JSON data, RxNorm normalization, LangChain-ready.

Features

  • Curated DDI data – Bundled JSON with common interactions (aspirin/warfarin, metformin/contrast, etc.)
  • RxNorm normalization – Resolves "Aspirin 81mg" → "aspirin" via NLM RxNorm API
  • Structured output – Pydantic models with severity, description, clinical advice
  • LangChain adapter – Drop-in tool for LangGraph / OpenAI function calling

Installation

pip install clinical-ddi-check

For LangChain/LangGraph integration:

pip install clinical-ddi-check[langchain]

Quick Start

Standalone

from clinical_ddi_check import drug_interaction_check

# Check interactions between current meds
result = drug_interaction_check(medications=["warfarin", "aspirin"])
# result["count"] == 1, result["has_major_or_contraindicated"] == True

# Check proposed drug against current meds
result = drug_interaction_check(
    medications=["metformin"],
    proposed_drug="contrast media",
)
# result["interactions"][0]["severity"] == "contraindicated"

LangChain / LangGraph

from clinical_ddi_check import create_langchain_tool, LANGCHAIN_TOOL_SCHEMA

# Create a LangChain tool
tool = create_langchain_tool()
# Use with model.bind_tools([tool]) or in a LangGraph node

# Or use the raw schema for OpenAI function calling
# LANGCHAIN_TOOL_SCHEMA matches the format expected by bind_tools

Custom DDI Data

result = drug_interaction_check(
    medications=["drug_a", "drug_b"],
    ddi_data_path="/path/to/your/ddi.json",
)

DDI JSON format:

{
  "interactions": [
    {
      "drug_a": "aspirin",
      "drug_b": "warfarin",
      "severity": "major",
      "description": "Increased bleeding risk.",
      "clinical_advice": "Monitor for signs of bleeding."
    }
  ]
}

Severities: contraindicated, major, moderate, minor.

API

drug_interaction_check(medications, proposed_drug=None, patient_id=None, ddi_data_path=None)

Returns a dict:

  • Success: interactions, medications_checked, proposed_drug, patient_id, count, has_major_or_contraindicated
  • Error: error_code, message, details

normalize_medication_names(medications)

Normalizes drug names via RxNorm. Returns {"normalized": [...]} or error dict.

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clinical_ddi_check-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clinical_ddi_check-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file clinical_ddi_check-0.1.0.tar.gz.

File metadata

  • Download URL: clinical_ddi_check-0.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for clinical_ddi_check-0.1.0.tar.gz
Algorithm Hash digest
SHA256 890139dfcb05dfa368482a3c8a877c7cfedbc9fd65fb89012140b11d33b2910e
MD5 95c60a1d21ff8f2441f92291026ee0f7
BLAKE2b-256 8e14c665a3487ac37de82912689280069d0e438e470cd6cc7bd0a28c8ce8c3d0

See more details on using hashes here.

File details

Details for the file clinical_ddi_check-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for clinical_ddi_check-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b5b93006812c1e1b252fd4a90e747696ede948e4a9d8601acbf0f3d59a50ac0
MD5 8f5e5d7e14caf0d56013e2fa3c698da2
BLAKE2b-256 50b03b11800187c2384e1440783ce4da5f20188315293cab532b365d8e16de92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page