A user-friendly interface for performing vector search on OMOP (Observational Medical Outcomes Partnership) databases with embedded Common Data Model (CDM) data.
This tool provides a streamlined way to search through medical data using semantic vector similarity. It leverages embeddings stored alongside your OMOP CDM data to enable natural language queries and find semantically similar medical concepts, procedures, and observations.
- Interactive GUI: Built with Marimo for a responsive interface
- Vector Search: Semantic search capabilities using sentence transformers
- OMOP Integration: Direct integration with OMOP CDM databases
- Natural Language Queries: Search using plain English descriptions
- Python 3.12 or higher
- PostgreSQL database with pgvector extension
- OMOP CDM database with precomputed embeddings
- uv package manager
-
Clone the repository:
git clone https://github.com/health-Informatics-UoN/quick-vector-search cd quick-vector-search -
Install dependencies:
uv sync
-
Install the package in development mode:
uv pip install -e .
There are defaults for database connection details.
DB_HOST="localhost"
DB_PORT=5432
DB_USER="postgres"
DB_PASSWORD="password"
DB_NAME="omop"
DB_SCHEMA="cdm"
DB_VECTABLE="embeddings"
EMBEDDINGS_MODEL="baai/bge-small-en-v1.5"If you need to change any of these to match your database, then create a .env file in the project root with your database connection details.
Launch the vector search interface:
uv run vsuiThis will start the Marimo interface where you can enter natural language search queries.
quick-vector-search/
│ ├── db/ # Database connection and queries
│ ├── settings/ # Configuration management
│ ├── vector_search.py # Main UI application
│ └── run_vs_ui.py # Entry point script
├── pyproject.toml # Project configuration
└── README.md # This file
- Database operations: Add new queries in
quick_vector_search/db/ - UI components: Modify
quick_vector_search/vector_search.py - Configuration: Update settings in
quick_vector_search/settings/
The project includes Ruff for linting and formatting:
uv run ruff check
uv run ruff format- Your OMOP database should have embeddings precomputed and stored
- PostgreSQL must have the pgvector extension installed
- Sufficient memory for loading sentence transformer models
- Database Connection: Ensure PostgreSQL is running and pgvector extension is installed
- Memory Issues: Sentence transformer models can be memory-intensive
- Missing Embeddings: Verify that your OMOP database includes embedded vectors
- Check the Marimo documentation for UI-related issues
- Verify your database schema matches OMOP CDM standards
- Ensure pgvector extension is properly configured
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
- Built on the OMOP Common Data Model
- Uses the Marimo reactive notebook framework
- Powered by Hugging Face sentence transformers