wags_tails.rxnorm#
Provide source fetching for RxNorm.
- class wags_tails.rxnorm.RxNormData(data_dir=None, silent=True)[source]#
Provide access to RxNorm database.
Requires environment variable
UMLS_API_KEYto be available. Will raise RemoteDataError otherwise.- __init__(data_dir=None, silent=True)[source]#
Set common class parameters.
- Parameters:
data_dir (
Optional[Path]) – direct location to store data files in, if specified. Seeget_data_dir()in thestorage_utilsmodule for further configuration details.silent (
bool) – if True, don’t print any info/updates to console
- get_latest(from_local=False, force_refresh=False)[source]#
Get path to latest version of data.
Provides logic for both versioned and unversioned data here, rather than in the
UnversionedDataSourcechild class, to supportCustomDatainstances regardless of whether they’re versioned.- Parameters:
from_local (
bool) – if True, use latest available local fileforce_refresh (
bool) – if True, fetch and return data from remote regardless of whether a local copy is present
- Return type:
tuple[Path,str]- Returns:
Path to location of data, and version value of it
- Raises:
ValueError – if both
force_refreshandfrom_localare True