Skip to main content

Anatomic location ontology navigation

Project description

anatomic-locations

Python library for anatomic location ontology navigation: hierarchy traversal, laterality variants, and semantic search.

Installation

pip install anatomic-locations

Features

  • Hybrid Search: Combined full-text and semantic vector search
  • Batch Search: One embedding API call for multiple queries via search_batch()
  • Hierarchy Navigation: Traverse parent/child relationships with tree visualization
  • Laterality Variants: Generate left, right, bilateral variants
  • Auto-Download: Database downloads automatically on first use
  • Flexible Lookup: Use location IDs (RID*), descriptions, or synonyms

Quick Start

The database auto-downloads on first use. No setup required.

from anatomic_locations import AnatomicLocationIndex

# Auto-open: no explicit open() or context manager needed for simple queries
index = AnatomicLocationIndex()
location = index.get("RID2772")   # by RID
location = index.get("kidney")    # by description (case-insensitive)
location = index.get("renal")     # by synonym (case-insensitive)
print(location.description)       # "kidney"
print(location.region.value)      # "Abdomen"

Configuration

Override the default database path via environment variable or constructor:

# Environment variable
export ANATOMIC_DB_PATH=/path/to/custom.duckdb
# Or specify directly
index = AnatomicLocationIndex(db_path="/path/to/custom.duckdb")

Semantic Search

Set OPENAI_API_KEY (or ANATOMIC_OPENAI_API_KEY) to enable embedding-based semantic search. Without it, search uses keyword matching only (FTS), which may miss conceptual matches for multi-word queries.

CLI

The anatomic-locations CLI provides search, hierarchy navigation, and lookup commands. Use location IDs (e.g., RID2772) or names (e.g., "stomach"):

# Semantic search
anatomic-locations search "posterior cruciate ligament"

# Show full hierarchy tree
anatomic-locations hierarchy stomach

See the full CLI reference for all commands.

Related Packages

Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anatomic_locations-0.2.5.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anatomic_locations-0.2.5-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file anatomic_locations-0.2.5.tar.gz.

File metadata

  • Download URL: anatomic_locations-0.2.5.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for anatomic_locations-0.2.5.tar.gz
Algorithm Hash digest
SHA256 75587b21ce1defc1592c83d31f7cc4d2a5595adf009a0248cbca75d8010243da
MD5 813c345cd85b324f0d80c324296d2ca9
BLAKE2b-256 130dc413fc75359e53b3e46a52872cb8e9a044b5f6eac6ed198d1d9943ba418c

See more details on using hashes here.

File details

Details for the file anatomic_locations-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: anatomic_locations-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for anatomic_locations-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6b6cba343676b935e55d1171c10fe887a31f5d8b84f146adc122e45428205b2d
MD5 5683fbc6fe898c48ec5ed7d0e9c6b669
BLAKE2b-256 921149df021ce54ea6bad9d93fad8b80b09b8fd938d141305851a2e8541f3c3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page