CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-fhirpy

Async/sync FHIR client for Python providing comprehensive API for CRUD operations over FHIR resources

Agent Success

Agent success rate when using this tile

68%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.08x

Baseline

Agent success rate without this tile

63%

Overview
Eval results
Files

task.mdevals/scenario-9/

Dual-Mode FHIR Adapter

Create an adapter that configures both synchronous and asynchronous FHIR clients from the same connection details. It should expose paired helper methods for fetching patient details and recording observations while keeping the sync and async paths aligned. Use the dependency’s client primitives rather than crafting raw HTTP calls.

Capabilities

Paired configuration

  • Initializing the adapter with a base URL and optional token builds both sync and async clients that share the same base URL, authorization header (if provided), extra headers, and any client-level configuration passed in. @test

Patient snapshot retrieval

  • Calling the sync patient snapshot method returns a minimal dict containing patient id, a name string derived from the first available name entry (prefer text, otherwise join given/family), and birthDate for the provided patient id; the async variant returns equivalent data using async I/O. @test

Observation recording

  • The sync observation helper creates a new Observation for a patient id with a code and numeric valueQuantity (value and unit), includes a subject reference of the form Patient/{id}, and returns the server-assigned Observation id; the async variant performs the same operation using async I/O. @test

Implementation

@generates

API

from typing import Any, Mapping, Optional

class DualFHIRAdapter:
    def __init__(
        self,
        base_url: str,
        token: Optional[str] = None,
        *,
        extra_headers: Optional[Mapping[str, str]] = None,
        client_config: Optional[dict] = None,
    ): ...

    @property
    def sync_client(self) -> Any: ...

    @property
    def async_client(self) -> Any: ...

    def patient_snapshot(self, patient_id: str) -> dict: ...

    async def patient_snapshot_async(self, patient_id: str) -> dict: ...

    def record_observation(self, patient_id: str, code: str, value: float, unit: str = "1") -> str: ...

    async def record_observation_async(self, patient_id: str, code: str, value: float, unit: str = "1") -> str: ...

Dependencies { .dependencies }

fhir-py { .dependency }

FHIR client library with parallel synchronous and asynchronous clients. @satisfied-by

tile.json