@drug-database/sdk
v0.1.0
Published
Official Drug Database JS/TS SDK — Swiss drug master, ATC, interactions, change feed.
Downloads
158
Maintainers
Readme
@drug-database/sdk
Official JS/TS SDK for the Drug Database — a worldwide drug master + interactions API covering Switzerland, the European Union, and the United States (28 public sources). Typed methods for drug search, ATC lookup, interaction checks, change feed, and PHI-Gateway-routed prescription validation.
Install
npm i @drug-database/sdk(Marketing snippet — same as on the docs page.)
Requires Node 18+ or any modern runtime with a global fetch (browsers, Deno,
Bun, Cloudflare Workers, edge runtimes). Zero runtime dependencies.
Quickstart
import { DrugDatabase } from '@drug-database/sdk'
const ms = new DrugDatabase({ apiKey: 'ms_live_...' })
// Search any jurisdiction: CH / GB / FR / DE / IT / AT / ES / DK / SE / FI /
// NO / NL / BE / IE / PT / US.
const results = await ms.drugs.search({ q: 'Ibuprofen', country: 'DE', limit: 5 })
const interactions = await ms.interactions.check({
drugs: [{ atc_code: 'M01AE01' }, { atc_code: 'N02BE01' }],
})Configuration
new DrugDatabase({
apiKey: 'ms_live_...',
baseUrl: 'https://drug-database.com', // override for self-hosted enterprise tenants
timeoutMs: 30_000,
phiGatewayApiKey: 'phi_live_...', // required when patient context is used
})baseUrl also falls back to the DRUG_DATABASE_API_BASE env var if set.
API surface
All methods return typed payloads matching /v1/...:
ms.drugs.search({ q, country, atc, limit, cursor })
ms.drugs.get(id)
// Any identifier system: gtin, pharmacode, cip13, pzn, ndc11, rxcui, unii, dmd_amppid, …
ms.drugs.lookup({ system: 'ndc11', code: '00071015523' })
ms.drugs.monograph(id, 'de')
for await (const batch of ms.drugs.dump({ format: 'jsonl' })) { /* RAG ingest */ }
ms.atc.get('N02BE01')
ms.atc.children('N02BE')
ms.atc.drugs('N02BE01')
ms.interactions.check({ drugs: [{ atc_code: 'M01AE01' }, { atc_code: 'N02BE01' }] })
ms.changes.list({ since: '2026-01-01T00:00:00Z' })
for await (const change of ms.changes.subscribe({ intervalMs: 60_000 })) { /* webhook-like */ }
ms.prescriptions.validate({
patient: { age_band: '65-74', egfr_band: '30-59', conditions: ['I10'] },
current_medications: [{ atc_code: 'C09AA02' }],
proposed_drug: { atc_code: 'M01AE01', dose: '400mg', frequency: 'tid' },
})PHI handling
prescriptions.validate is the only PHI-touching method. The SDK refuses to
send patient context without a phiGatewayApiKey. Patient context is bucketed
(age band, eGFR band, condition codes) — never names, DOBs or MRNs. See
drug-database.com/phi.
License
MIT
