Skip to content

FHIR support#12

Merged
alex-omophub merged 4 commits intomainfrom
develop
Apr 14, 2026
Merged

FHIR support#12
alex-omophub merged 4 commits intomainfrom
develop

Conversation

@alex-omophub
Copy link
Copy Markdown
Member

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

Summary by cubic

Adds FHIR type interoperability and client helpers so you can pass Coding-like objects directly and connect external FHIR clients to OMOPHub. Examples now read OMOPHUB_API_KEY from the environment and search examples reflect the flat list output.

  • New Features

    • Resolver: client.fhir.resolve supports coding= (dicts, omophub.types.fhir.Coding, or any object with .system/.code/.display); explicit system/code override coding. resolve_batch accepts mixed inputs. resolve_codeable_concept accepts a CodeableConcept-like object or a list.
    • Types: added Coding, CodeableConcept, and runtime protocols CodingLike, CodeableConceptLike for duck typing.
    • FHIR client interop: omophub.fhir_interop adds get_fhir_server_url (supports r4, r4b, r5, r6), get_fhirpy_client, get_async_fhirpy_client; re-exported at top-level. New OMOPHub.fhir_server_url/AsyncOMOPHub.fhir_server_url return the R4 base URL.
    • Docs/examples: added examples/fhir_interop.py; updated examples and README to use env API key and show flat list results from search.basic.
  • Dependencies

    • Optional extras: omophub[fhirpy] installs fhirpy>=1.4.0; omophub[fhir-resources] installs fhir.resources>=7.0.0. fhirpy is lazily imported by helpers; no new required dependencies.

Written for commit 7f2014f. Summary will update on new commits.

alex-omophub added 2 commits April 10, 2026 21:39
- Introduced a new script `fhir_resolver.py` that demonstrates FHIR-to-OMOP concept resolution using the OMOPHub SDK.
- The script includes examples for resolving SNOMED, ICD-10-CM, LOINC, RxNorm codes, and text-only semantic searches.
- Added functionality for direct standard lookups, non-standard code mapping, and Phoebe recommendations.
- Supports batch resolution and asynchronous usage for improved performance.
- Added support for FHIR type interoperability in the resolver, allowing acceptance of various Coding-like inputs (dicts, TypedDicts, and objects with .system/.code attributes).
- Introduced new FHIR type definitions (`Coding`, `CodeableConcept`) and runtime-checkable protocols (`CodingLike`, `CodeableConceptLike`) for structural matching.
- Implemented FHIR client interop helpers to configure external libraries (`fhirpy`, `fhir.resources`) with OMOPHub's FHIR Terminology Service.
- Enhanced `Fhir.resolve`, `Fhir.resolve_batch`, and `Fhir.resolve_codeable_concept` methods to accept mixed input types.
- Updated documentation and examples to reflect new functionalities and usage patterns.
- Added comprehensive unit and integration tests to validate new features and ensure compatibility.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 issues found across 14 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/fhir_interop.py">

<violation number="1" location="src/omophub/fhir_interop.py:77">
P2: Missing `# type: ignore[import-not-found]` on the `fhirpy` import will cause MyPy checks to fail if the optional dependency is not installed in the type-checking environment.</violation>
</file>

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

<violation number="1" location="src/omophub/resources/fhir.py:60">
P2: Filter dict inputs down to the resolver's supported coding keys before building the request body.</violation>
</file>

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

Comment thread src/omophub/fhir_interop.py Outdated
Comment thread src/omophub/resources/fhir.py
alex-omophub and others added 2 commits April 14, 2026 21:17
- Updated example scripts.
- Adjusted search and resolution methods in examples to reflect the new API response structures, ensuring consistency across examples.
- Improved documentation and comments in example scripts for clarity and better user guidance.
@alex-omophub alex-omophub merged commit 78f3867 into main Apr 14, 2026
14 checks passed
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