rxnormie
v1.0.8
Published
A simple but robust TypeScript client for the RxNorm API — for normies. This package provides a simple and intuitive way to interact with the RxNorm API.
Maintainers
Readme
RxNormie
A simple but robust TypeScript client for the RxNorm API — for normies. This package provides a simple and intuitive way to interact with the RxNorm API.
Installation
npm install rxnormieUsage
import { RxNormie } from "rxnormie";
// Create a new instance with default options (JSON format)
const rxnormie = new RxNormie();
// Or specify options
const rxnormieWithOptions = new RxNormie({
format: "json", // 'json' or 'xml', defaults to 'json'
apiKey: "your-api-key", // Optional API key
});
// Example: Get drug information
async function getDrugInfo() {
const drugs = await rxnormie.getDrugs("ibuprofen");
console.log(drugs);
}
// Example: Find RxCUI by NDC
async function findRxCUIByNDC() {
const result = await rxnormie.findRxcuiById("00071015773", "NDC");
console.log(result);
}API Reference
The SDK provides methods for all RxNorm API endpoints. All methods return promises that resolve to typed objects.
Constructor
new RxNormie(options?: { apiKey?: string; format?: 'json' | 'xml' })apiKey(optional): API key for authenticationformat(optional): Response format, either 'json' or 'xml'. Defaults to 'json'
Methods
filterByProperty
filterByProperty(rxcui: string, propName: string, propValues: string): Promise<string | null>Returns RxCUI if the predicate is true, null otherwise.
findRelatedNDCs
findRelatedNDCs(
ndc: string,
relation: 'concept' | 'product' | 'drug',
ndcStatus: 'active' | 'obsolete' | 'alien' | 'ALL' = 'active'
): Promise<NDCInfo[]>Find NDCs related to a given NDC by concept, product, or drug.
findRxcuiById
findRxcuiById(id: string, idType: string): Promise<IdGroup | null>Find RxCUI by ID.
findRxcuiByString
findRxcuiByString(name: string, searchType: 'Exact' | 'Contains' = 'Exact'): Promise<IdGroup | null>Find RxCUI by name.
getAllConceptsByStatus
getAllConceptsByStatus(status: string): Promise<MinConcept[]>Get all concepts by status.
getAllConceptsByTTY
getAllConceptsByTTY(tty: string): Promise<MinConcept[]>Get all concepts by term type.
getAllHistoricalNDCs
getAllHistoricalNDCs(rxcui: string): Promise<HistoricalNDC[]>Get all historical NDCs for a concept.
getAllNDCsByStatus
getAllNDCsByStatus(status: string): Promise<NDCInfo[]>Get all NDCs by status.
getAllProperties
getAllProperties(rxcui: string, prop?: string): Promise<RxNormProperty[]>Get all properties for a concept.
getAllRelatedInfo
getAllRelatedInfo(rxcui: string): Promise<RelatedGroup | null>Get all related information for a concept.
getApproximateMatch
getApproximateMatch(term: string, maxEntries: number = 20, option?: string): Promise<MinConcept[]>Get approximate match for a term.
getDisplayTerms
getDisplayTerms(term: string, option?: string): Promise<string[]>Get display terms for auto-completion.
getDrugs
getDrugs(name: string, expand?: 'psn'): Promise<DrugGroup | null>Get drug products associated with a specified name.
getIdTypes
getIdTypes(): Promise<string[]>Get ID types.
getMultiIngredBrand
getMultiIngredBrand(ingredients: string): Promise<MinConcept[]>Get brands containing specified ingredients.
getNDCProperties
getNDCProperties(id: string): Promise<NDCProperty[]>Get NDC properties.
getNDCStatus
getNDCStatus(ndc: string): Promise<NDCStatus | null>Get NDC status.
getNDCs
getNDCs(rxcui: string): Promise<string[]>Get NDCs for a concept.
getPropCategories
getPropCategories(): Promise<PropertyCategory[]>Get property categories.
getPropNames
getPropNames(category?: string): Promise<PropertyName[]>Get property names.
getProprietaryInformation
getProprietaryInformation(rxcui: string, sourceTypes?: string): Promise<ProprietaryInfo | null>Get proprietary information for a concept.
getReformulationConcepts
getReformulationConcepts(rxcui: string): Promise<MinConcept[]>Get reformulation concepts.
getRelaTypes
getRelaTypes(): Promise<RelaType[]>Get relationship types.
getRelatedByRelationship
getRelatedByRelationship(rxcui: string, rela: string): Promise<ConceptProperty[]>Get related concepts by relationship.
getRelatedByType
getRelatedByType(rxcui: string, tty: string): Promise<ConceptProperty[]>Get related concepts by type.
getRxConceptProperties
getRxConceptProperties(rxcui: string): Promise<RxConceptProperties | null>Get RxNorm concept properties.
getRxNormName
getRxNormName(rxcui: string): Promise<string | null>Get RxNorm name for a concept.
getRxNormVersion
getRxNormVersion(): Promise<RxNormVersions | null>Get RxNorm version information.
getRxProperty
getRxProperty(rxcui: string, propName: string): Promise<string | null>Get a specific property for a concept.
getRxcuiHistoryStatus
getRxcuiHistoryStatus(rxcui: string): Promise<RxcuiHistoryStatus | null>Get RxCUI history status.
getSourceTypes
getSourceTypes(): Promise<SourceType[]>Get source types.
getSpellingSuggestions
getSpellingSuggestions(term: string): Promise<string[]>Get spelling suggestions for a term.
getTermTypes
getTermTypes(): Promise<TermType[]>Get term types.
License
ISC
