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

Patient Registry CRUD

Manage FHIR Patient resources through a small registry module that wraps create, read, partial update, and delete flows against a configured FHIR server using a single dependency. The registry should attach an Authorization: Bearer <token> header when an auth token is provided.

Capabilities

Create patient records

  • Creating a patient with given and family names (plus optional telecom/address) returns the server-assigned patient id, and retrieving that patient echoes the provided demographics. Telecom entries use system/value, and address uses line, city, and postalCode, all preserved round-trip. @test

Fetch patient records

  • Requesting an existing patient id returns a dict including the patient id, names, telecom, and address fields that were stored. Requesting a missing id raises an error. @test

Patch contact details

  • Partially updating a patient's telecom and/or address fields preserves untouched fields (such as names) and returns the updated patient representation. @test

Delete patient records

  • Deleting an existing patient returns True, and a subsequent fetch for that id fails. Deleting a missing patient returns False. @test

Implementation

@generates

API

class PatientRegistry:
    def __init__(self, base_url: str, auth_token: str | None = None) -> None:
        ...

    def create_patient(
        self,
        *,
        given_name: str,
        family_name: str,
        telecom: list[dict] | None = None,
        address: dict | None = None,
    ) -> str:
        """
        Create a patient and return the assigned patient id.
        """
        ...

    def get_patient(self, patient_id: str) -> dict:
        """
        Fetch a patient by id and return a dict representation including names, telecom, and address.
        """
        ...

    def patch_contact(
        self,
        patient_id: str,
        telecom: list[dict] | None = None,
        address: dict | None = None,
    ) -> dict:
        """
        Apply a partial update to telecom/address fields and return the updated patient dict.
        """
        ...

    def delete_patient(self, patient_id: str) -> bool:
        """
        Delete a patient. Returns True when deletion succeeds, False when the patient does not exist.
        """
        ...

Dependencies { .dependencies }

fhir-py { .dependency }

FHIR client library for synchronous CRUD operations against FHIR resources.

tile.json