Configuration and Caching
By default, downloaded specification documents (such as DICOM standards and IHE profiles) and generated data models (such as JSON files) are stored in a platform-specific cache directory. This location can be customized by specifying a configuration file.
Default Cache Directory
-
Default cache directory location:
🍏 MacOS
~/Library/Caches/dcmspec
🐧 Linux
~/.cache/dcmspec
🪟 Windows
%USERPROFILE%\AppData\Local\dcmspec\Cache
Configuration of Cache Directory
The cache directory used by API and CLI applications can be changed by providing a configuration file.
This file can be named config.json
and placed in the default configuration folder, or its location can be specified using the --config
command-line option or the DCMSPEC_CONFIG
environment variable.
-
Using the default config file
If no config file is specified, dcmspec searches forconfig.json
in the default configuration folder for the operating system:🍏 MacOS
~/Library/Application Support/dcmspec
🐧 Linux
~/.config/dcmspec
🪟 Windows
%USERPROFILE%\AppData\Local\dcmspec
or
%USERPROFILE%\AppData\Roaming\dcmspec
Example config.json
:
{
"cache_dir": "./cache"
}
- Using the
--config
option:
The path to the config file can be provided on the command line:
poetry run python -m src.dcmspec.cli.modattributes <table_id> --config myconfig.json
- Using the
DCMSPEC_CONFIG
environment variable:
The environment variable can be set to the path of the config file:
export DCMSPEC_CONFIG=./myconfig.json
poetry run python -m src.dcmspec.cli.modattributes <table_id>