Skip to content

Fhir resolver#8

Merged
alex-omophub merged 52 commits intodevelopfrom
fhir-resolver
Apr 10, 2026
Merged

Fhir resolver#8
alex-omophub merged 52 commits intodevelopfrom
fhir-resolver

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 with single, batch, and CodeableConcept resolution to return standard concepts and target CDM tables, with optional recommendations and quality. Also simplifies error handling and fixes async pagination typing/usage.

  • New Features

    • New client.fhir: resolve(), resolve_batch(), resolve_codeable_concept(), with resource-type targeting, vocabulary preference, and text fallback via semantic search.
    • Batch resolves up to 100 codings with per-item errors; available on both sync and async clients.
    • Added typed results in omophub.types.fhir (e.g., FhirResolveResult, FhirBatchResult, FhirCodeableConceptResult).
  • Refactors

    • Unified response parsing into _parse_and_raise() for consistent JSON/error handling.
    • Fixed paginate_async to accept an awaitable; updated search.semantic_iter to use paginate_async, and adjusted tests to require an async fetch_page.
    • Docs: added FHIR examples to README; CONTRIBUTING now requires Python 3.10+.

Written for commit 4be3a32. Summary will update on new commits.

alex-omophub and others added 30 commits December 3, 2025 13:15
…)` for synonyms and relationships, and update User-Agent header format.
…sts. 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.
…s 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.
- 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.
alex-omophub and others added 18 commits February 23, 2026 08:40
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ntImpl

- 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.
Add retry logic for server errors
- 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.
- 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.
- 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.
Add bulk search functionality to the API
- 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`.
…nd 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>
… handling

- Added FHIR resource access to both synchronous and asynchronous OMOPHub clients.
- Updated CHANGELOG to reflect changes in rate-limit handling, including honoring the `Retry-After` header and implementing exponential backoff with jitter for retries.
- Included new FHIR-related types in the type definitions for better integration.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 99.41860% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/omophub/_request.py 96.15% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

alex-omophub added 4 commits April 10, 2026 20:26
…ment in CONTRIBUTING.md. Refactor error handling in API request processing by introducing a shared `_parse_and_raise` function to streamline JSON response parsing and error management. Enhance async search functionality with pagination support and update type exports in `__init__.py`.
…se_and_raise` to remove type ignore comment. Add tests for minimal CodeableConcept resolution and async FHIR property caching.
…or single and batch resolution of FHIR codings, and CodeableConcept handling. Refactor shared response parsing in API requests to improve maintainability. Update README with usage examples and correct Python version requirement in CONTRIBUTING.md.
…pdate test name and docstring for clarity, and change fetch_page to be an async function.
@alex-omophub alex-omophub merged commit 0d9844c into develop Apr 10, 2026
8 checks passed
@alex-omophub alex-omophub deleted the fhir-resolver branch April 10, 2026 19:56
@alex-omophub alex-omophub restored the fhir-resolver branch April 10, 2026 20:11
@alex-omophub alex-omophub deleted the fhir-resolver branch April 10, 2026 20:26
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