Comparator Recommender
This package is an installable Groundworkers plugin for finding target cohorts and recommending pairwise comparators from a precomputed comparator catalogue.
It contributes two entry points:
omop.configexposesComparatorRecommenderConfigto oa-configurator.groundworkers.pluginsexposes the plugin singleton to Groundworkers.
The configuration schema selects a generic comparator database, optionally selects an embedding model for target lookup, and sets the default minimum database support threshold. Groundworkers builds the setup-console workflow directly from this schema without plugin-specific TUI code.
The setup console also exposes the plugin's registered preparation steps:
Load comparator sourceasks for the cohort and pairwise-similarity CSVs and loads them into the catalogue.Create comparator embeddingsgenerates the stored vectors after the source is loaded.
The CSV paths are run arguments, not persistent plugin configuration. Both steps use Groundworkers' durable maintenance-run surface, so progress and logs appear with the core graph and embedding preparation runs.
Run the MWE against the published Groundworkers 0.7 stack:
uv sync --group dev
uv run pytest
The acceptance test selects an existing CDM database, leaves the optional
embedding resources unconfigured, reviews the generated change, applies it, and
verifies the resulting [tools.comparator_recommender] section.
Upgrading to the Groundworkers 0.7 stack
This plugin requires groundworkers[tui]>=0.7,<1, oa-configurator>=2,<3
and omop-emb>=3,<4. For CDM database entries, replace the former
schema_name setting with cdm_schema; generic databases such as
comparator_db still use schema_name. Remove schema settings from SQLite
database entries. See the Groundworkers upgrade guide
for the shared configuration changes.
The embedding-store migration script is not available yet. It is tracked
in oa-configurator issue #40.
Existing shared stores created before omop-emb 3.0 report LEGACY_REGISTRY.
The omop-emb legacy-registry guard and migration-command placeholder
remain the source of the planned migration command; follow the issue for its
availability before attempting migration. This plugin does not migrate shared
embedding stores.
Comparator vectors live in cs_cohort.embedding_vector in the comparator
database. The plugin uses omop-emb to generate vectors directly from the selected
model, without opening the shared embedding-store registry. Upgrading the Python
packages does not migrate or regenerate existing comparator vectors. Keep the
same embedding model for creation and lookup; if changing models, explicitly
rerun Create comparator embeddings after loading the source catalogue.
Architecture
The package separates four responsibilities:
config.pydeclares operator-controlled settings and references to shared OA resources.adapters.pyowns the resolved database connection and backend.models.pyreflects the two non-OMOP catalogue tables into SQLAlchemy mappings.backends/postgresql.pyuses SQLAlchemyselect, pgvector expressions, mapped row updates, andIndexobjects, with one isolated column migration for older catalogue tables. Its backend initialization follows theomop-emblifecycle and ensures the pgvector extension before setup runs.services.pyowns input policy and recommendation defaults. It receives ordinary Python values from adapters and contains no MCP code.tools.pyexposes service operations to agents. Tools should be thin wrappers, not a second implementation of the analysis.
plugin.py is the composition root: Groundworkers calls it once during startup
to connect configuration to adapters and services, then asks it to register the
tools. Business logic should not be implemented inside build().
The comparator catalogue is not an OMOP CDM table, so it should not be added to
omop-alchemy's model registry. The local reflected mapping follows the same
SQLAlchemy model/query conventions while leaving the shared OMOP package focused
on CDM semantics.
Metadata
Release files for comparator-recommender 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| comparator_recommender-0.1.1.tar.gz | 213.8 kB | With provenance | Details for comparator_recommender-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| comparator_recommender-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for comparator_recommender-0.1.1-py3-none-any.whl |
Total release size: 232.1 kB
Release files / comparator_recommender-0.1.1.tar.gz
| Download URL | comparator_recommender-0.1.1.tar.gz |
|---|---|
| Size | 213.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d4844d11a70266e5bc84550d9c44f4b1ea741e369ca8b7cb451106ab587ab82f
|
|
BLAKE2b-256 checksum How to use checksums |
96f26c1cafec937f6865d05d8228967170c603a6d96013533da58bebfe972af4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logRelease files / comparator_recommender-0.1.1-py3-none-any.whl
| Download URL | comparator_recommender-0.1.1-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d2dc0952ed5035e7dc2cd0e05c76c8fe4b940e549cf018e15482162e9b20354
|
|
BLAKE2b-256 checksum How to use checksums |
249117af9b30161e0346b39cd19330472371265d1d93e4d8f7e5e2034dd974e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logSecurity for comparator-recommender 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for comparator_recommender-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.