A modern, async Python SDK for the RxNorm API that provides comprehensive access to drug information and terminology
Project description
pynorm-sdk
A modern, async Python SDK for the RxNorm API that provides comprehensive access to drug information and terminology.
This SDK implements the official RxNorm API. For detailed API documentation, see: https://lhncbc.nlm.nih.gov/RxNav/APIs/RxNormAPIs.html
Features
- Complete RxNorm API Coverage: All 35+ endpoints implemented
- Async/Await Support: Built with aiohttp for high-performance async operations
- Type Safety: Full type hints with Pydantic v2 models
- Error Handling: Custom exception hierarchy for specific error types
- Production Ready: Comprehensive logging, session management, and error handling
- Thoroughly Tested: 100% test coverage with real API integration tests
Installation
pip install pynorm-sdk
Quick Start
import asyncio
from pynorm import RxNormClient
async def main():
async with RxNormClient() as client:
# Check API health
is_healthy = await client.check_health()
print(f"API is healthy: {is_healthy}")
# Search for a drug
rxcuis = await client.find_rxcui_by_string("aspirin")
if rxcuis:
rxcui = rxcuis[0]
print(f"Aspirin RXCUI: {rxcui}")
# Get drug properties
properties = await client.get_all_properties(rxcui)
for prop in properties:
print(f"{prop.propName}: {prop.propValue}")
asyncio.run(main())
API Coverage
Drug Search & Lookup
find_rxcui_by_string()- Find RXCUIs by drug namefind_rxcui_by_id()- Find RXCUIs by identifier (NDC, etc.)get_approximate_match()- Fuzzy drug name matchingget_spelling_suggestions()- Get spelling correctionsget_drugs()- Search drugs by name
Concept Information
get_rx_concept_properties()- Get concept detailsget_rx_norm_name()- Get concept name by RXCUIget_all_properties()- Get all concept propertiesget_rx_property()- Get specific properties
NDC Operations
get_ndcs()- Get NDCs for a conceptget_ndc_status()- Check NDC statusget_ndc_properties()- Get NDC propertiesfind_related_ndcs()- Find related NDCs
Relationships & Related Concepts
get_all_related_info()- Get all related conceptsget_related_by_type()- Get concepts by term typeget_related_by_relationship()- Get concepts by relationship
Filtering & Advanced Search
filter_by_property()- Filter concepts by propertiesget_multi_ingred_brand()- Find multi-ingredient brands
Metadata & Configuration
get_id_types()- Available identifier typesget_prop_categories()- Property categoriesget_prop_names()- Property namesget_term_types()- Term typesget_source_types()- Source vocabulariesget_rela_types()- Relationship types
Utility Functions
check_health()- API health checkget_rx_norm_version()- Get RxNorm version infoget_display_terms()- Auto-completion terms
Error Handling
The SDK provides specific exceptions for different error types:
from pynorm import RxNormClient
from pynorm.exceptions import RxNormHTTPError, RxNormValidationError
async with RxNormClient() as client:
try:
result = await client.find_rxcui_by_string("aspirin")
except RxNormHTTPError as e:
print(f"HTTP error: {e}")
except RxNormValidationError as e:
print(f"Validation error: {e}")
Configuration
The client can be configured with custom settings:
from pynorm import RxNormClient
# Custom configuration
async with RxNormClient(
base_url="https://rxnav.nlm.nih.gov/REST",
user_agent="MyApp/1.0"
) as client:
# Your code here
pass
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 pynorm_sdk-0.1.0.tar.gz.
File metadata
- Download URL: pynorm_sdk-0.1.0.tar.gz
- Upload date:
- Size: 63.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0c6a5147050754ac08cd3f198381b5029972252007c53f399502763a0516c46
|
|
| MD5 |
933ce52b80da316bc60df4b3510af41b
|
|
| BLAKE2b-256 |
e9958d1485a3d74e2eed042495cc4112b35b6320ba9b57c184f0f413a0e64379
|
Provenance
The following attestation bundles were made for pynorm_sdk-0.1.0.tar.gz:
Publisher:
python-publish.yml on akauper/pynorm-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynorm_sdk-0.1.0.tar.gz -
Subject digest:
b0c6a5147050754ac08cd3f198381b5029972252007c53f399502763a0516c46 - Sigstore transparency entry: 527381327
- Sigstore integration time:
-
Permalink:
akauper/pynorm-sdk@7b6ba58147cb371fea96f0b0f3b3388e7722d54d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/akauper
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7b6ba58147cb371fea96f0b0f3b3388e7722d54d -
Trigger Event:
release
-
Statement type:
File details
Details for the file pynorm_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pynorm_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d812f8950faa15f0ce0f804e4f6254420bea5de33567a440c3a5b1851fdeebe
|
|
| MD5 |
cf226e1e566f8a077526039dfad6d383
|
|
| BLAKE2b-256 |
d6c824953ae5e9da7a468993c2e901f2f419e8067a8e96b5c97c3a6377b0fcb4
|
Provenance
The following attestation bundles were made for pynorm_sdk-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on akauper/pynorm-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynorm_sdk-0.1.0-py3-none-any.whl -
Subject digest:
5d812f8950faa15f0ce0f804e4f6254420bea5de33567a440c3a5b1851fdeebe - Sigstore transparency entry: 527381347
- Sigstore integration time:
-
Permalink:
akauper/pynorm-sdk@7b6ba58147cb371fea96f0b0f3b3388e7722d54d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/akauper
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7b6ba58147cb371fea96f0b0f3b3388e7722d54d -
Trigger Event:
release
-
Statement type: