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-7/

Observation Search Builder

Create an async helper that assembles and runs a search for Observation resources tied to a specific patient. The helper should lean on the dependency to format search parameters, rather than manual string building.

Capabilities

Filters by chained patient identifier

  • When given a patient identifier value, the search constrains results to observations whose subject matches that identifier using a chained patient identifier search. @test

Applies datetime lower bound

  • When recorded_after is provided as a timezone-aware datetime, the search only returns observations recorded on or after that moment by applying the correct comparison prefix and datetime formatting expected by the server. @test

Formats reference and boolean filters

  • When a performer id is provided, the search formats it as a reference to that performer and filters to final observations when only_final is true, omitting the status filter when it is false; both values are encoded by the dependency. @test

Accepts raw search expression

  • When an extra search expression string is given, it is attached to the search request exactly as provided so the server receives the literal expression without additional escaping or transformation. @test

Implementation

@generates

API

from datetime import datetime
from typing import Any, Iterable, Optional

async def build_observation_search(
    client: Any,
    patient_identifier: str,
    recorded_after: datetime,
    performer_id: Optional[str] = None,
    only_final: bool = True,
    extra_expression: Optional[str] = None,
) -> Iterable[dict]:
    """
    Build and execute a search for observations tied to a patient.

    Returns an awaitable iterable of matching observation resources in server order.
    """

Dependencies { .dependencies }

fhir-py { .dependency }

Provides FHIR client search-building helpers and query parameter utilities.

tile.json