Skip to main content

Embedding extension to omop-graph

Project description

omop-emb

Embedding layer for OMOP CDM.

omop-emb now separates model metadata from embedding storage:

  • model metadata is stored locally in SQLite (metadata.db)
  • embedding vectors are stored by the selected backend (pgvector or faiss)
  • OMOP concept metadata remains in the OMOP CDM database

Installation

omop-emb now exposes backend-specific optional dependencies so installation can match the embedding backend you actually intend to use.

pip install "omop-emb[pgvector]"
pip install "omop-emb[faiss]"
pip install "omop-emb[all]"

Notes:

  • pgvector installs the PostgreSQL/pgvector dependencies.
  • faiss installs the FAISS-based backend dependencies. This currently only includes CPU support
  • all installs both backend stacks for development or mixed environments.
  • A plain pip install omop-emb installs the shared core package only.
  • PostgreSQL-specific embedding dependencies are optional, but omop-emb still requires OMOP CDM database access.
  • Non-PostgreSQL database backends have not yet been tested.

Runtime Configuration

Common environment variables:

  • OMOP_EMB_BACKEND: backend name (pgvector or faiss) used by the backend factory.
  • OMOP_EMB_BASE_STORAGE_DIR: local base directory for omop-emb artifacts, including local metadata (metadata.db) and FAISS files. If unset, omop-emb defaults to ./.omop_emb in the current working directory.
  • OMOP_DATABASE_URL: SQLAlchemy URL for the OMOP CDM database.
  • OMOP_EMB_DOCUMENT_EMBEDDING_PREFIX: task prefix prepended to concept texts at index time. Required for asymmetric models (e.g. search_document: for nomic-embed-text, passage: for E5).
  • OMOP_EMB_QUERY_EMBEDDING_PREFIX: task prefix prepended to search queries at query time. Required for asymmetric models (e.g. search_query: for nomic-embed-text, query: for E5).

The prefix variables default to "" and are safe to omit for symmetric models. See Asymmetric Embeddings for details.

Extended documentation can be found here.

Project Roadmap

  • Interface for PostgreSQL storage of vectors
  • Interface for FAISS storage of embeddings
  • Extensive unit testing
    • Backend testing
    • Corruption and restoration of DB testing
  • Support importing and exporting of calculated embeddings
  • Support non-Flat indices for each backend
  • faiss GPU support
  • pgvectorscale support
  • Vector-quantisation for more efficient storage

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

omop_emb-0.4.1.tar.gz (146.8 kB view details)

Uploaded Source

Built Distribution

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

omop_emb-0.4.1-py3-none-any.whl (51.4 kB view details)

Uploaded Python 3

File details

Details for the file omop_emb-0.4.1.tar.gz.

File metadata

  • Download URL: omop_emb-0.4.1.tar.gz
  • Upload date:
  • Size: 146.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for omop_emb-0.4.1.tar.gz
Algorithm Hash digest
SHA256 12d0099f923e73ac621f2f70266723f08ff5af9a1ab7918597bb1856ba0fc532
MD5 1045eee40b31859ca272d2b4551834a1
BLAKE2b-256 916d0625d2d161beedb9b52d518af0ee526a535d812c78f4c67944ad181da019

See more details on using hashes here.

File details

Details for the file omop_emb-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: omop_emb-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 51.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for omop_emb-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2c92fbd830625325176e9a28c8814a87f6c6f9c556b8f04b0afc4a04a0e411c3
MD5 be889adb27bd09cbe96939a6614174cd
BLAKE2b-256 ab7c1e9a8b8cd393792ab4ad050d399e6013dfe793c3af75df69ee83a8cd72d0

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