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

Paginated Encounter Bundle Builder

Create a helper that gathers encounter data for one or more patients while preserving related resources returned by the server.

Capabilities

Paginated encounter aggregation

Retrieve encounters with forward includes that follow referenced resources iteratively so related participants stay attached to each bundle page.

  • Searching with a per-page limit of 1 still aggregates all encounter pages for the patient ids and returns a raw Bundle that keeps the forward-related patient and service provider entries supplied by the server. @test

Reverse-linked observation capture

  • Observations that reference an encounter appear in the summaries list with their ids after the search completes across all pages. @test

Reference normalization

  • Encounter summaries expose patient, service provider, and observation relationships as reference objects produced by the client instead of plain strings or dictionaries. @test

Implementation

@generates

API

async def build_encounter_bundle(
    client,
    patient_ids: list[str],
    page_size: int = 50
) -> dict:
    """
    Build a combined encounter bundle for the given patients using the provided FHIR-capable client.

    Args:
        client: Initialized client instance connected to a FHIR server.
        patient_ids: Patient identifiers to filter encounters.
        page_size: Page size to request per search page.

    Returns:
        Dict with keys:
        - "bundle": raw Bundle dict containing encounters plus any related resources returned by the server.
        - "summaries": list of per-encounter dicts with encounter id, patient reference, service provider reference, observation references, and any warnings.
    """

Dependencies { .dependencies }

fhirpy { .dependency }

Python FHIR client for performing searches with related resources and reference helpers.

tile.json