This script imports SNOMED-CT RF2 files from an Edition package into DuckDB. It has been tested with the SNOMED-CT May 2025 International Edition release.
The script also launches a DuckDB UI for interactive queries. Query results can be converted to a Numpy array or Pandas DataFrame, and exported to various formats, including CSV, Parquet, Arrow, and Excel (with additional extensions enabled).
- Python 3.8+
- DuckDB Python library
- Clone the repository:
$ git clone https://github.com/IHTSDO/snomed-database-loader.git $ cd snomed-database-loader/python-duckdb - Install dependencies:
$ pip install -r requirements.txt
-
Download SNOMED-CT
- Obtain an Edition package of SNOMED-CT (see https://www.snomed.org/get-snomed)
- If you have an Extension package, please make sure to convert it into an Edition package before proceeding
-
Place the zip file in the releases directory
-
Run the script
- Execute the script with the path to your Edition package as an argument:
$ python snomed-duckdb.py --package ./releases/SnomedCT_InternationalRF2_PRODUCTION_20250501T120000Z.zip
- Execute the script with the path to your Edition package as an argument:
-
Interact with the DuckDB UI
- The DuckDB UI will start in your default web browser at http://localhost:4213
By default, the database runs in in-memory mode. To persist the database to a file, specify it with the --db parameter
$ python snomed-duckdb.py --package .... --db ./snomed_data.duckdb