Welcome to UMLS RAT’s documentation!¶
UMLS RAT (REST API Tool) provides a reasonable interface to the UMLS Metathesaurus via the REST API. We cache responses using requests cache to speed things up. Ultimately, you will only end up downloading as much data as you need which for most use cases is a relatively small portion of the whole. If you need the entire Metathesaurus, this is not the best tool.
Install¶
pip install umls-rat
API Key¶
Before you get started, you first need to get an API key from UMLS. By default, your API key will be read from the environment variable
UMLS_API_KEY
. If this variable is not set, you must pass your key to theumlsrat.api.rat_session.MetaThesaurusSession
constructor.
SSL¶
Note that you may need to add an SSL certificate which can be done by setting the REQUESTS_CA_BUNDLE
environment variable. See here for more info.
Development¶
Install poetry environment.
poetry install
Execute unit tests. Set UMLS_API_KEY
or pass in with --api-key
arg.
poetry run python -m pytest -sv tests
Cached requests are stored in ~/.cache/umls-rat
. Caching can be disabled when running the tests, with the --no-cache
flag, eg
poetry run python -m pytest -sv tests --cache=False
The default version of UMLS used is a constant umlsrat.const.DEFAULT_UMLS_VERSION
. The version used for testing can be modified at runtime with the --umls-version
arg, eg
poetry run python -m pytest -sv tests --cache=False --umls-version current
Build Documentation¶
Install docs dependencies.
poetry install --with docs
Buidl the docs
poetry run make -C docs clean html