Skip to content

Develop#9

Closed
alex-omophub wants to merge 2 commits intomainfrom
develop
Closed

Develop#9
alex-omophub wants to merge 2 commits intomainfrom
develop

Conversation

@alex-omophub
Copy link
Copy Markdown
Member

@alex-omophub alex-omophub commented Apr 10, 2026

Summary by cubic

Adds a FHIR-to-OMOP resolver and advanced search (semantic, similar, bulk) to improve concept resolution and discovery. Also hardens HTTP reliability with retries and adds CI and PyPI publish workflows.

  • New Features

    • FHIR resolver: client.fhir.resolve(), resolve_batch(), resolve_codeable_concept() map FHIR codings to OMOP concepts and target CDM tables, with optional recommendations.
    • Search: semantic(), similar(), bulk_basic(), and bulk_semantic() for embedding-based and batch searches; async iterators supported.
    • HTTP: retry on 429/502/503/504 with exponential backoff and jitter; improved error parsing; auto version from installed package.
    • CI/Release: GitHub Actions CI (lint, mypy, tests across 3.10–3.13) and trusted PyPI publish; Codecov integration.
    • Docs/Examples: README, CHANGELOG, CONTRIBUTING, and examples updated.
  • Migration

    • Concepts.suggest: use vocabulary_ids and domain_ids (lists) and page/page_size instead of vocabulary, domain, and limit.
    • Relationships.get: relationship_typerelationship_ids (list); target_vocabularyvocabulary_ids; page_size defaults to 100; include_reverse added.
    • Mappings.get: target_vocabulary is singular; removed quality/context options; add include_invalid and optional vocab_release.
    • Hierarchy: new hierarchy.get(); other methods accept vocabulary_ids (list) and include_invalid.
    • Vocabularies.get: no include options; use vocabularies.stats(vocabulary_id) and vocabularies.domains(vocabulary_id) for details.
    • Domains.list: simplified to include_stats.
    • Pagination: paginate_async now requires an async callable (sync fallback removed).

Written for commit 0d9844c. Summary will update on new commits.

alex-omophub and others added 2 commits April 10, 2026 20:10
* CI pipeline

* Publish action

* Refactor type hinting for vocabulary_ids to use builtins.list for consistency

* Import builtins conditionally in type checking for improved clarity

* Codecov settings in CI

* Update README.md to include Codecov badge and change License badge color

* Update CHANGELOG for v0.2.0: add parameters to `concepts.get_by_code()` for synonyms and relationships, and update User-Agent header format.

* Update CHANGELOG.md

* Add website link to README.md

* Readme updates

* Documentation

* Corrections

* v1.3.0 preparation

* Release preparation

* Integration tests

* Improved tests

* Examples update

* Downloads badge

* Sponsorship

* Add integration tests for standard concept filtering and multiple filters with pagination

* Prepare release v1.3.1

* Refactor tests for API key validation and enhance request handling tests. Updated synchronous and asynchronous client tests to use monkeypatching for API key checks. Added new tests for handling raw requests, including error parsing, rate limits, and JSON decoding issues.

* Update vocab_version in tests for consistency across mock responses and client configurations.

* Extending mapping method with source_codes option

* Add semantic and similar search functionality with corresponding types and integration tests

- Introduced `semantic` and `similar` search methods in the search resource, allowing for advanced concept searches using neural embeddings and similarity algorithms.
- Added new TypedDicts for `SemanticSearchResult`, `SemanticSearchMeta`, `SimilarConcept`, and `SimilarSearchResult` to structure the response data.
- Implemented integration tests for semantic search, including filtering and pagination, as well as tests for finding similar concepts by ID and name.
- Updated type imports and ensured compatibility with existing search functionality.

* Add semantic search examples to README

* Refactor README and integration tests to streamline result extraction

- Updated README example to reflect changes in the results structure for semantic search.
- Refactored integration tests to utilize a new `extract_data` function for consistent handling of results and similar concepts, improving code clarity and maintainability.

* Update CI workflow to support multiple branches and manual triggering

* Update minimum similarity threshold in search.py from 0.3 to 0.5 for improved filtering accuracy.

* v1.4.0 release

* Increase rate limit delay in integration tests from 1 second to 2 seconds for improved test reliability.

* Update version handling

* Prepare v1.4.1 release

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add retry logic for server errors in SyncHTTPClient and AsyncHTTPClientImpl

- Implemented retry mechanism for handling server errors (502, 503, 504) in both synchronous and asynchronous HTTP clients.
- Added exponential backoff delay for retries to improve resilience against temporary server issues.

* Refactor retry condition formatting in SyncHTTPClient and AsyncHTTPClientImpl

* Add bulk search functionality to the API

- Introduced `bulk_basic` and `bulk_semantic` methods for executing multiple lexical and semantic searches in a single API call, respectively.
- Updated the README to include examples for bulk search usage.
- Added corresponding types for bulk search inputs and responses in the type definitions.
- Implemented integration and unit tests to validate the new bulk search features.

* Update type definitions to include bulk search and semantic search types

- Added new types for bulk search and semantic search functionalities to the `__all__` exports in `__init__.py`.
- Removed previously commented sections for clarity and organization.

* Enhance integration tests for bulk search functionality

- Updated assertions in `test_bulk_basic_search` to verify that all expected search IDs are present in the results.
- Added a check in `test_bulk_semantic_search` to confirm that the SNOMED vocabulary filter is applied to the results.

* Prep for v1.5.0 release

* Examples update

* Update GitHub Actions workflows to use latest action versions

- Upgraded `actions/checkout` from v4 to v6 in both `ci.yml` and `publish.yml`.
- Updated `codecov/codecov-action` from v4 to v5 in `ci.yml`.
- Changed `actions/upload-artifact` and `actions/download-artifact` from v4 to v5 in `publish.yml`.

* Add retry logic with exponential backoff and jitter for rate limits and server errors (#6)

- Introduced a new `_calculate_retry_delay` function to handle retry delays based on the Retry-After header and exponential backoff with jitter.
- Updated `SyncHTTPClient` and `AsyncHTTPClientImpl` to utilize the new retry delay calculation for handling rate limits (429) and server errors (502, 503, 504).
- Enhanced retry mechanism to improve resilience against temporary issues.

Co-authored-by: alex-omophub <sdk@omophub.com>

* Update CHANGELOG for v1.5.1 release

---------

Co-authored-by: alex-omophub <sdk@omophub.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 issues found across 49 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/omophub/resources/concepts.py">

<violation number="1" location="src/omophub/resources/concepts.py:71">
P2: `GetConceptParams` is out of sync with the updated `get`/`get_by_code` signatures, so typing metadata no longer reflects accepted parameters.</violation>

<violation number="2" location="src/omophub/resources/concepts.py:241">
P2: `RelationshipsParams` still models the old API and now conflicts with the new `relationships` method arguments.</violation>
</file>

<file name="src/omophub/resources/vocabularies.py">

<violation number="1" location="src/omophub/resources/vocabularies.py:54">
P2: Removing `include_stats`/`include_domains` from `get()` is a breaking API change that causes runtime `TypeError` for existing keyword-argument callers.</violation>

<violation number="2" location="src/omophub/resources/vocabularies.py:91">
P2: `domains()` removed previously supported keyword args (`vocabulary_ids`, `page`, `page_size`), which breaks existing callers and drops filtering/pagination behavior.</violation>

<violation number="3" location="src/omophub/resources/vocabularies.py:112">
P1: `concepts()` removed previously supported kwargs (`domain_id`, `concept_class_id`, `standard_only`), creating a breaking runtime API change for existing integrations.</violation>
</file>

<file name="examples/map_between_vocabularies.py">

<violation number="1" location="examples/map_between_vocabularies.py:89">
P2: This lookup example no longer enforces standard mappings, so it can return non-standard targets despite the function being documented as finding a standard mapping.</violation>
</file>

<file name=".github/workflows/ci.yml">

<violation number="1" location=".github/workflows/ci.yml:57">
P2: The integration job condition does not restrict push branches, so it also runs on `master` pushes despite the comment saying main/develop only.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

domain_id: str | None = None,
concept_class_id: str | None = None,
standard_only: bool = False,
search: str | None = None,
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: concepts() removed previously supported kwargs (domain_id, concept_class_id, standard_only), creating a breaking runtime API change for existing integrations.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/omophub/resources/vocabularies.py, line 112:

<comment>`concepts()` removed previously supported kwargs (`domain_id`, `concept_class_id`, `standard_only`), creating a breaking runtime API change for existing integrations.</comment>

<file context>
@@ -89,58 +74,83 @@ def stats(self, vocabulary_id: str) -> VocabularyStats:
-        domain_id: str | None = None,
-        concept_class_id: str | None = None,
-        standard_only: bool = False,
+        search: str | None = None,
+        standard_concept: str = "all",
+        include_invalid: bool = False,
</file context>
Fix with Cubic

*,
include_relationships: bool = False,
include_synonyms: bool = False,
include_hierarchy: bool = False,
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: GetConceptParams is out of sync with the updated get/get_by_code signatures, so typing metadata no longer reflects accepted parameters.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/omophub/resources/concepts.py, line 71:

<comment>`GetConceptParams` is out of sync with the updated `get`/`get_by_code` signatures, so typing metadata no longer reflects accepted parameters.</comment>

<file context>
@@ -71,13 +68,17 @@ def get(
         *,
         include_relationships: bool = False,
         include_synonyms: bool = False,
+        include_hierarchy: bool = False,
+        vocab_release: str | None = None,
     ) -> Concept:
</file context>
Fix with Cubic

*,
relationship_type: str | None = None,
target_vocabulary: str | None = None,
relationship_ids: str | list[str] | None = None,
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: RelationshipsParams still models the old API and now conflicts with the new relationships method arguments.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/omophub/resources/concepts.py, line 241:

<comment>`RelationshipsParams` still models the old API and now conflicts with the new `relationships` method arguments.</comment>

<file context>
@@ -147,106 +174,162 @@ def suggest(
         *,
-        relationship_type: str | None = None,
-        target_vocabulary: str | None = None,
+        relationship_ids: str | list[str] | None = None,
+        vocabulary_ids: str | list[str] | None = None,
+        domain_ids: str | list[str] | None = None,
</file context>
Fix with Cubic

f"/vocabularies/{vocabulary_id}/stats/domains/{domain_id}"
)

def domains(self) -> dict[str, Any]:
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: domains() removed previously supported keyword args (vocabulary_ids, page, page_size), which breaks existing callers and drops filtering/pagination behavior.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/omophub/resources/vocabularies.py, line 91:

<comment>`domains()` removed previously supported keyword args (`vocabulary_ids`, `page`, `page_size`), which breaks existing callers and drops filtering/pagination behavior.</comment>

<file context>
@@ -89,58 +74,83 @@ def stats(self, vocabulary_id: str) -> VocabularyStats:
+            f"/vocabularies/{vocabulary_id}/stats/domains/{domain_id}"
+        )
+
+    def domains(self) -> dict[str, Any]:
+        """Get all standard OHDSI domains.
+
</file context>
Fix with Cubic

include_stats: bool = False,
include_domains: bool = False,
) -> Vocabulary:
def get(self, vocabulary_id: str) -> Vocabulary:
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Removing include_stats/include_domains from get() is a breaking API change that causes runtime TypeError for existing keyword-argument callers.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/omophub/resources/vocabularies.py, line 54:

<comment>Removing `include_stats`/`include_domains` from `get()` is a breaking API change that causes runtime `TypeError` for existing keyword-argument callers.</comment>

<file context>
@@ -51,32 +51,17 @@ def list(
-        include_stats: bool = False,
-        include_domains: bool = False,
-    ) -> Vocabulary:
+    def get(self, vocabulary_id: str) -> Vocabulary:
         """Get vocabulary details.
 
</file context>
Fix with Cubic

concept.get("concept_id", 0),
standard_only=True,
)
mappings = client.mappings.get(concept.get("concept_id", 0))
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This lookup example no longer enforces standard mappings, so it can return non-standard targets despite the function being documented as finding a standard mapping.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At examples/map_between_vocabularies.py, line 89:

<comment>This lookup example no longer enforces standard mappings, so it can return non-standard targets despite the function being documented as finding a standard mapping.</comment>

<file context>
@@ -89,14 +84,11 @@ def lookup_by_code() -> None:
-                concept.get("concept_id", 0),
-                standard_only=True,
-            )
+            mappings = client.mappings.get(concept.get("concept_id", 0))
 
-            print("\n  Standard mappings:")
</file context>
Suggested change
mappings = client.mappings.get(concept.get("concept_id", 0))
mappings = client.mappings.get(concept.get("concept_id", 0), standard_only=True)
Fix with Cubic

Comment thread .github/workflows/ci.yml

integration:
# Only run on push to main/develop, not on PRs (saves ~7-8 min per PR)
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The integration job condition does not restrict push branches, so it also runs on master pushes despite the comment saying main/develop only.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ci.yml, line 57:

<comment>The integration job condition does not restrict push branches, so it also runs on `master` pushes despite the comment saying main/develop only.</comment>

<file context>
@@ -0,0 +1,72 @@
+      
+  integration:
+    # Only run on push to main/develop, not on PRs (saves ~7-8 min per PR)
+    if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
+    runs-on: ubuntu-latest
+    steps:
</file context>
Suggested change
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'))
Fix with Cubic

@alex-omophub alex-omophub deleted the develop branch April 10, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant