Skip to content

Add shared ConceptFilter for CDM concept-table queries#37

Open
nicoloesch wants to merge 5 commits into
mainfrom
11-concept-filter
Open

Add shared ConceptFilter for CDM concept-table queries#37
nicoloesch wants to merge 5 commits into
mainfrom
11-concept-filter

Conversation

@nicoloesch

@nicoloesch nicoloesch commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds ConceptFilter (omop_alchemy.cdm.query.ConceptFilter), a shared, reusable way to filter CDM concept-table queries by domain, vocabulary, concept ID, and standard/active status, with an optional row-count limit.

Both omop-emb and omop-graph currently reimplement this same filtering logic independently against their own copies of the Concept model's column names. This gives both a single, shared implementation to depend on instead. Building it here rather than in either downstream package because omop_alchemy is the one place that owns the Concept model directly, so the filter can reference real columns (Concept.domain_id, Concept.standard_concept, etc.) rather than duck-typing against an opaquely-imported table.

Checklist

  • Applied exactly one label (breaking, feature, fix, dependencies, or chore) — feature
  • Tests pass locally (uv run pytest -q)
  • Lint passes (uv run ruff check .)

@nicoloesch
nicoloesch requested a review from gkennos July 21, 2026 04:36
@nicoloesch nicoloesch added the feature New backwards-compatible functionality. MINOR: x.y+1.z label Jul 21, 2026
Comment thread omop_alchemy/cdm/model/vocabulary/concept.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New backwards-compatible functionality. MINOR: x.y+1.z

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: centralised concept query filtering API

2 participants