download_tgt_versioned

download_tgt_versioned(url_fmt, version=None, *, module_key, version_key, api_key=None, force=False, version_transform=None)[source]

Download a file via the UMLS ticket granting system.

Parameters:
  • url_fmt (str) – The URL format of the file to download where {version} is used as a placeholder (potentially multiple times), like in https://download.nlm.nih.gov/umls/kss/{version}/umls-{version}-mrconso.zip

  • version (Optional[str]) – The version of the file to download

  • module_key (str) – The key for the pystow submodule of “bio”

  • version_key (str) – The key to look up the version via bioversions if the version parameter is not given explicitly.

  • api_key (Optional[str]) – An API key. If not given, is looked up using pystow.get_config() with the umls module and api_key key.

  • force (bool) – Should the file be re-downloaded?

  • version_transform (Optional[Callable[[str], str]]) – A string transformation function, in case the version needs to be reformatted

Return type:

Path

Returns:

The local path to the downloaded versioned file

Raises:
  • ValueError – if the URL format string doesn’t have a {version} substring

  • RuntimeError – if no version is given and none can be looked up