POST /v1/interactions/graph-neighborhood

Coming Soon

Retrieve the complete interaction neighborhood for a single drug. Returns the drug node, all directly related drugs with pairwise interaction rules, pharmacological class memberships, metabolic mechanisms, pathway roles, risk domain memberships, and typed graph edges. Designed for graph visualization and clinical decision support dashboards.

This endpoint is not yet available for public use.

Graph neighborhood queries are currently in private beta. Register your interest to be notified when early access opens.

Request

POST /v1/interactions/graph-neighborhood
Content-Type: application/json
x-api-key: rxlg_your_api_key

Parameters

NameTypeRequiredDescription
rxcuistringrequiredRxCUI identifier of the drug whose neighborhood to retrieve. Use POST /v1/interactions/graph-search to resolve a drug name to its RxCUI.

Response Structure

The neighborhood response is assembled in two DynamoDB phases. Phase 1 queries all items under the drug partition key. Phase 2 batch-fetches referenced entity nodes (classes, mechanisms, pathways, risk domains) and pairwise rules in parallel.

FieldTypeDescription
centerDrugDrugNodeThe requested drug with all its class, mechanism, pathway, and risk domain IDs.
relatedDrugsDrugNode[]All drugs that have a direct pairwise interaction rule with the center drug.
classesDrugClassNode[]Pharmacological classes the center drug belongs to, with member RxCUI lists.
mechanismsMechanismNode[]Metabolic mechanisms (inhibitor, inducer, substrate, agonist, antagonist) relevant to the drug.
pathwaysPathwayNode[]Metabolic enzymes, transporters, receptors, or signaling pathways the drug is active on.
riskDomainsRiskDomainNode[]Risk domains (e.g., bleeding risk, QT prolongation, nephrotoxicity) the drug contributes to.
pairwiseRulesPairwiseRule[]All explicit pairwise interaction rules involving the center drug.
edgesGraphEdge[]Typed edges representing all relationships in the neighborhood, ready for graph visualization libraries.

Examples

cURL

curl -X POST "https://api.rxlabelguard.com/v1/interactions/graph-neighborhood" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"rxcui": "11289"}'

JavaScript

const response = await fetch("https://api.rxlabelguard.com/v1/interactions/graph-neighborhood", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "YOUR_API_KEY",
  },
  body: JSON.stringify({ rxcui: "11289" }), // warfarin
});

const neighborhood = await response.json();

// Build a graph visualization
const nodes = [
  neighborhood.centerDrug,
  ...neighborhood.relatedDrugs,
  ...neighborhood.classes,
  ...neighborhood.riskDomains,
];
const edges = neighborhood.edges; // { source, target, type, severity? }

Python

import requests

response = requests.post(
    "https://api.rxlabelguard.com/v1/interactions/graph-neighborhood",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={"rxcui": "11289"},
)

n = response.json()
print(f"Center: {n['centerDrug']['genericName']}")
print(f"Related drugs: {[d['genericName'] for d in n['relatedDrugs']]}")
print(f"Risk domains: {[r['displayName'] for r in n['riskDomains']]}")
print(f"Graph edges: {len(n['edges'])}")

Response Schema

{
  "centerDrug": {
    "rxcui": "11289",
    "genericName": "warfarin",
    "brandNames": ["COUMADIN", "JANTOVEN"],
    "splSetId": "abc-123",
    "classIds": ["ANTICOAGULANT"],
    "mechanismIds": ["CYP2C9_INHIBITION"],
    "pathwayIds": ["CYP2C9"],
    "riskDomainIds": ["BLEEDING_RISK"]
  },
  "relatedDrugs": [
    { "rxcui": "1191", "genericName": "aspirin", "brandNames": ["BAYER"], ... }
  ],
  "classes": [
    { "classId": "ANTICOAGULANT", "displayName": "Anticoagulants", "memberRxcuis": ["11289", ...] }
  ],
  "mechanisms": [
    {
      "mechanismId": "CYP2C9_INHIBITION",
      "displayName": "CYP2C9 Inhibition",
      "directionality": "inhibitor",
      "affectedPathwayId": "CYP2C9"
    }
  ],
  "pathways": [
    {
      "pathwayId": "CYP2C9",
      "displayName": "CYP2C9 Enzyme",
      "category": "metabolic_enzyme",
      "substrateDrugIds": ["11289"],
      "inhibitorDrugIds": ["1191"]
    }
  ],
  "riskDomains": [
    {
      "riskId": "BLEEDING_RISK",
      "displayName": "Bleeding Risk",
      "defaultSeverity": "major",
      "monitoringRequired": true,
      "fdaWarningPresent": true
    }
  ],
  "pairwiseRules": [
    {
      "ruleType": "PAIRWISE",
      "rxcuiA": "11289",
      "rxcuiB": "1191",
      "genericNameA": "warfarin",
      "genericNameB": "aspirin",
      "severity": "major",
      "mechanism": "Aspirin increases anticoagulant effect and GI bleeding risk.",
      "recommendation": "Monitor INR closely.",
      "evidenceSnippet": "...",
      "splSetIds": ["abc-123"]
    }
  ],
  "edges": [
    { "source": "DRUG#11289", "target": "DRUG#1191", "type": "INTERACTS_WITH", "severity": "major" },
    { "source": "DRUG#11289", "target": "DRUGCLASS#ANTICOAGULANT", "type": "BELONGS_TO_CLASS" },
    { "source": "DRUG#11289", "target": "MECHANISM#CYP2C9_INHIBITION", "type": "HAS_MECHANISM" },
    { "source": "DRUG#11289", "target": "PATHWAY#CYP2C9", "type": "ACTIVE_ON_PATHWAY" },
    { "source": "DRUG#11289", "target": "RISK#BLEEDING_RISK", "type": "IN_RISK_DOMAIN" }
  ]
}

Edge Types

typeSourceTargetNotes
INTERACTS_WITHDRUG#DRUG#Has severity field.
BELONGS_TO_CLASSDRUG#DRUGCLASS#Pharmacological class membership.
HAS_MECHANISMDRUG#MECHANISM#Metabolic action (inhibitor, inducer, substrate, etc.).
ACTIVE_ON_PATHWAYDRUG#PATHWAY#Enzyme, transporter, receptor, or signaling pathway.
IN_RISK_DOMAINDRUG#RISK#Risk category (bleeding, QT prolongation, hepatotoxicity, etc.).