This guide is for maintainers who need to build, update, or manage the DuckDB database files used by the findingmodel and anatomic-locations packages.
The packages use DuckDB as the default backend for indexing finding models and anatomic locations. DuckDB provides high-performance vector search (HNSW indexing) and full-text search capabilities in a single-file database.
For most users, databases auto-download on first use - no manual setup required. This guide is for maintainers who need to create or update database files.
Package note: Build and publish operations live in the
oidm-maintenancepackage (oidm-maintainCLI). The user-facingfindingmodelandanatomic-locationspackages only provide read-only database access.
The finding models index stores:
- Finding model metadata (name, description, synonyms, tags)
- Contributor information (people and organizations)
- Full-text search indexes
- Base contributors (4 people, 7 organizations) automatically loaded
Default location: Platform-native data directory via platformdirs
- macOS:
~/Library/Application Support/findingmodel/ - Linux:
~/.local/share/findingmodel/ - Windows:
%LOCALAPPDATA%\findingmodel\
Default filename: finding_models.duckdb
The anatomic locations database stores:
- Anatomic location concepts from multiple ontologies
- Vector embeddings for semantic search
- Text indexes for keyword search
- Data from anatomic_locations, RadLex, and SNOMED CT
Default location: Platform-native data directory via platformdirs
Default filename: anatomic_locations.duckdb
Configure automatic downloads by setting environment variables in .env:
# Finding models index
FINDINGMODEL_REMOTE_DB_URL=https://your-server.com/finding_models.duckdb
FINDINGMODEL_REMOTE_DB_HASH=sha256:your_hash_here
# Anatomic locations database
ANATOMIC_REMOTE_DB_URL=https://your-server.com/anatomic_locations.duckdb
ANATOMIC_REMOTE_DB_HASH=sha256:your_hash_hereBoth URL and SHA256 hash must be provided. The package uses Pooch for:
- Automatic downloads on first use
- Hash verification (re-downloads if hash mismatches)
- Caching in platform-native directories
All build and publish commands use the oidm-maintain CLI from the oidm-maintenance package.
# Build from a directory of .fm.json files
oidm-maintain findingmodel build /path/to/defs/
# Build with custom output path
oidm-maintain findingmodel build /path/to/defs/ --index /custom/path/index.duckdbCreates a new DuckDB index by scanning a directory tree for *.fm.json files.
# Build from definitions and publish to S3
oidm-maintain findingmodel publish --defs-dir /path/to/defs/
# Publish an existing database file
oidm-maintain findingmodel publish --database /path/to/existing.duckdbAutomates database publishing workflow:
- Builds database from definitions (if using
--defs-dir) or uses existing database - Runs sanity checks: record count, sample OIFM IDs, model JSON validation
- Computes SHA256 hash and file size
- Uploads database to S3/Tigris storage with date-based filename
- Updates and publishes
manifest.jsonwith new version info - Creates automatic manifest backup in
manifests/archive/
Requirements: AWS credentials in .env file (Tigris S3-compatible storage):
OIDM_MAINTAIN_AWS_ACCESS_KEY_ID=your_access_key
OIDM_MAINTAIN_AWS_SECRET_ACCESS_KEY=your_secret_keyfindingmodel stats# Build from default URL (configured in package)
oidm-maintain anatomic build
# Build from local file
oidm-maintain anatomic build --source /path/to/anatomic_locations.json
# Force overwrite existing database
oidm-maintain anatomic build --forceWhat it does:
- Downloads/loads anatomic location data
- Generates OpenAI embeddings for each concept
- Creates DuckDB database with vector and text indexes
- Stores in platform-native directory
oidm-maintain anatomic publishanatomic-locations statsFresh databases automatically include base contributors:
Organizations (7):
- Microsoft (MSFT)
- MassGeneral Brigham (MGB)
- Radiology Gamuts Ontology (GMTS)
- Radiological Society of North America (RSNA)
- American College of Radiology (ACR)
- ACR/RSNA Common Data Elements Project (CDE)
- Open Imaging Data Model (OIDM)
People (4):
- talkasab (Tarik Alkasab, MD, PhD - MGB)
- HeatherChase (Heather Chase - MSFT)
- hoodcm (C. Michael Hood, MD - MGB)
- radngandhi (Namita Gandhi, MD - RSNA)
These are loaded from package data files during database setup.
Historical Note: Prior to v0.5.0, a MongoDB-based Index implementation was available. This was replaced with DuckDB in v0.5.0. Users needing MongoDB should use findingmodel v0.4.x.
If you see "Database not found" errors:
- Check if remote URLs are configured in
.env - Verify the database path exists
- Run
oidm-maintain findingmodel buildoroidm-maintain anatomic buildto create the database
If Pooch reports a hash mismatch:
- The remote file has changed
- Update
REMOTE_*_HASHin.envwith the new SHA256 hash - Pooch will automatically re-download with the new hash
To regenerate embeddings for anatomic locations:
oidm-maintain anatomic build --source /path/to/data.json --forceThe --force flag overwrites the existing database.
Override defaults via environment variables:
# Override database paths (still uses platform-native directory)
FINDINGMODEL_DB_PATH=my_custom_index.duckdb
ANATOMIC_DB_PATH=my_custom_anatomic.duckdb