Drug interactions and pharmacology API client — drugfyi.com
Project description
drugfyi
Python API client for drug interaction and pharmacology data. Check drug-drug interactions, look up side effect profiles, explore pharmacokinetic properties (absorption, metabolism, half-life), and query mechanism of action — all from DrugFYI, a drug reference platform built for healthcare developers and pharmacists.
DrugFYI aggregates pharmacological data including interaction severity ratings, cytochrome P450 enzyme pathways, therapeutic drug classes, contraindications, and adverse reaction frequencies — providing structured access to critical medication safety information.
Check drug interactions at drugfyi.com — search drugs, explore interactions, and browse drug classes.
Table of Contents
- Install
- Quick Start
- What You Can Do
- Command-Line Interface
- MCP Server (Claude, Cursor, Windsurf)
- REST API Client
- API Reference
- Learn More About Drugs
- Also Available
- Health FYI Family
- License
Install
pip install drugfyi # Core (zero deps)
pip install "drugfyi[cli]" # + Command-line interface
pip install "drugfyi[mcp]" # + MCP server for AI assistants
pip install "drugfyi[api]" # + HTTP client for drugfyi.com API
pip install "drugfyi[all]" # Everything
Quick Start
from drugfyi.api import DrugFYI
with DrugFYI() as api:
# Check interaction between two drugs
interaction = api.get_interaction("warfarin", "aspirin")
print(interaction["severity"]) # Major
print(interaction["description"]) # Increased bleeding risk
# Get complete drug profile
drug = api.get_drug("metformin")
print(drug["class"]) # Biguanides
print(drug["mechanism"]) # Decreases hepatic glucose production
# Search across all drugs
results = api.search("statin")
What You Can Do
Drug-Drug Interactions
Drug interactions occur when one medication affects the activity of another, potentially causing therapeutic failure or adverse effects. Interactions are classified by severity (major, moderate, minor) and mechanism (pharmacokinetic vs pharmacodynamic).
| Severity | Clinical Significance | Action Required |
|---|---|---|
| Major | Life-threatening or permanent damage | Avoid combination |
| Moderate | May require therapy modification | Monitor closely |
| Minor | Minimal clinical significance | Awareness only |
| Contraindicated | Absolutely avoid | Never co-prescribe |
from drugfyi.api import DrugFYI
with DrugFYI() as api:
# Check specific drug pair interaction
interaction = api.get_interaction("warfarin", "ibuprofen")
print(interaction["severity"]) # Major
print(interaction["mechanism"]) # CYP2C9 inhibition + antiplatelet effect
print(interaction["recommendation"])
# Get all interactions for a drug
interactions = api.list_interactions("warfarin")
major = [i for i in interactions if i["severity"] == "Major"]
print(f"Warfarin has {len(major)} major interactions")
Learn more: Drug Interactions · Glossary
Side Effect Profiles
Every medication carries a side effect profile derived from clinical trials and post-marketing surveillance. Side effects are categorized by frequency (very common >10%, common 1-10%, uncommon 0.1-1%, rare <0.1%) and organ system affected.
from drugfyi.api import DrugFYI
with DrugFYI() as api:
# Get side effect profile
drug = api.get_drug("metoprolol")
for effect in drug["side_effects"]:
print(f"{effect['name']}: {effect['frequency']}")
# Fatigue: Very Common (>10%)
# Dizziness: Common (1-10%)
# Bradycardia: Common (1-10%)
Learn more: Drug Side Effects · Guides
Pharmacokinetics
Pharmacokinetics — how the body processes a drug — follows four phases: Absorption (A), Distribution (D), Metabolism (M), and Elimination (E). Understanding ADME properties is critical for dosing, timing, and predicting interactions via shared metabolic pathways.
| Parameter | Meaning | Clinical Relevance |
|---|---|---|
| Bioavailability | % reaching systemic circulation | Oral vs IV dosing |
| Half-life | Time for 50% elimination | Dosing frequency |
| CYP enzymes | Metabolic pathway | Interaction prediction |
| Protein binding | % bound to albumin | Drug displacement interactions |
from drugfyi.api import DrugFYI
with DrugFYI() as api:
# Pharmacokinetic properties
drug = api.get_drug("atorvastatin")
pk = drug["pharmacokinetics"]
print(pk["bioavailability"]) # 14%
print(pk["half_life"]) # 14 hours
print(pk["metabolism"]) # CYP3A4
print(pk["protein_binding"]) # >98%
Learn more: Pharmacokinetics · Glossary
Drug Classifications
Drugs are organized by therapeutic class (what they treat), pharmacological class (how they work), and chemical class (molecular structure). The ATC (Anatomical Therapeutic Chemical) classification system provides a standardized 5-level hierarchy.
| Level | ATC Code | Meaning | Example |
|---|---|---|---|
| 1st | C | Cardiovascular system | — |
| 2nd | C10 | Lipid modifying agents | — |
| 3rd | C10A | Cholesterol/triglyceride reducers | — |
| 4th | C10AA | HMG-CoA reductase inhibitors | Statins |
| 5th | C10AA05 | Specific chemical | Atorvastatin |
from drugfyi.api import DrugFYI
with DrugFYI() as api:
# Browse drug classes
classes = api.list_classes()
for cls in classes[:5]:
print(f"{cls['name']}: {cls['drug_count']} drugs")
# Get all drugs in a class
statins = api.get_class("statins")
for drug in statins["drugs"]:
print(drug["name"])
Learn more: Drug Classes · API Documentation
Command-Line Interface
pip install "drugfyi[cli]"
drugfyi drug metformin # Drug details
drugfyi interaction warfarin aspirin # Check interaction
drugfyi interactions warfarin # All interactions for a drug
drugfyi search "ACE inhibitor" # Search drugs
drugfyi classes # List drug classes
MCP Server (Claude, Cursor, Windsurf)
pip install "drugfyi[mcp]"
{
"mcpServers": {
"drugfyi": {
"command": "uvx",
"args": ["--from", "drugfyi[mcp]", "python", "-m", "drugfyi.mcp_server"]
}
}
}
REST API Client
from drugfyi.api import DrugFYI
with DrugFYI() as api:
drug = api.get_drug("metformin") # GET /api/v1/drugs/metformin/
interaction = api.get_interaction("warfarin", "aspirin") # GET /api/v1/interactions/warfarin/aspirin/
classes = api.list_classes() # GET /api/v1/classes/
results = api.search("beta blocker") # GET /api/v1/search/?q=beta+blocker
Example
curl -s "https://drugfyi.com/api/v1/drugs/metformin/"
{
"slug": "metformin",
"generic_name": "Metformin",
"class": "Biguanides",
"mechanism": "Decreases hepatic glucose production",
"route": "Oral"
}
Full API documentation at drugfyi.com/developers/.
API Reference
| Function | Description |
|---|---|
api.get_drug(slug) |
Complete drug profile |
api.list_drugs() |
List all drugs |
api.get_interaction(drug1, drug2) |
Check specific interaction |
api.list_interactions(drug) |
All interactions for a drug |
api.list_classes() |
All therapeutic drug classes |
api.get_class(slug) |
Drug class details with member drugs |
api.search(query) |
Search across drugs and classes |
Learn More About Drugs
- Browse: Drug Database · Interactions · Drug Classes
- Guides: Pharmacology Guides · Glossary
- API: REST API Docs · OpenAPI Spec
Also Available
| Platform | Install | Link |
|---|---|---|
| npm | npm install drugfyi |
npm |
| MCP | uvx --from "drugfyi[mcp]" python -m drugfyi.mcp_server |
Config |
Health FYI Family
Part of the FYIPedia open-source developer tools ecosystem — human body, medicine, and nutrition.
| Package | PyPI | npm | Description |
|---|---|---|---|
| anatomyfyi | PyPI | npm | 14,692 anatomical structures, body systems, organs — anatomyfyi.com |
| pillfyi | PyPI | npm | Pill identification, FDA drug database — pillfyi.com |
| drugfyi | PyPI | npm | Drug interactions, pharmacology, side effects — drugfyi.com |
| nutrifyi | PyPI | npm | Nutrition data, food composition, dietary analysis — nutrifyi.com |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drugfyi-0.1.1.tar.gz.
File metadata
- Download URL: drugfyi-0.1.1.tar.gz
- Upload date:
- Size: 215.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
208cdceff1375a0f56d581974f2c9d16d174820af18c4d232c53782bcfc6b4f8
|
|
| MD5 |
5489b95b7da8bdb5212720918b83b492
|
|
| BLAKE2b-256 |
ed7589e9b8f164afcc09bac5d9feaa7d94ab57cea0ec7244dc435b5fa8e9b3eb
|
File details
Details for the file drugfyi-0.1.1-py3-none-any.whl.
File metadata
- Download URL: drugfyi-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02f5eb0c72b903c5f1afe3c9e14af5d673b99670e4c4bdb4873d3512208393bb
|
|
| MD5 |
8f5a0d51ee24803a59355909bdf2cb5b
|
|
| BLAKE2b-256 |
d1db2078b858dededddda6141673981c7a1c0ec6731b976b284a0fa5ae38e678
|