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

FHIR Nested Path Toolkit

Utilities that read and modify FHIR resource dictionaries using dot-separated paths with numeric indexes. Functions may mutate the provided resource as long as the returned value reflects the requested changes.

Capabilities

Read nested values with defaults

  • Given a Patient resource containing name[0].family = "Doe" and address[0].city = "Springfield", reading {"family": "name.0.family", "city": "address.0.city", "missing": "address.1.city"} returns {"family": "Doe", "city": "Springfield", "missing": "Unknown"} when the default "Unknown" is supplied. @test

Update nested values by path

  • Setting "telecom.0.value" to "555-0000" replaces the phone number when the telecom list already has a first entry; the function returns the updated resource. @test
  • Setting "address.0.postalCode" to "12345" on a resource lacking an address array creates the intermediate containers and inserts the postal code. @test

Copy value between paths when present

  • When a resource has "address.0.city", copying that value to "contact.0.address.0.city" duplicates the city string; when the source is missing, the target path is left untouched. @test

Implementation

@generates

API

from typing import Any, Mapping

def read_paths(resource: dict[str, Any], paths: Mapping[str, str], default: Any | None = None) -> dict[str, Any]:
    """Return a mapping of labels to values from dotted paths; use default for missing segments."""

def set_path(resource: dict[str, Any], path: str, value: Any) -> dict[str, Any]:
    """Return the resource with value written at the dotted path, creating intermediate dict/list nodes as needed."""

def copy_path(resource: dict[str, Any], source_path: str, target_path: str) -> dict[str, Any]:
    """If the source path resolves to a non-None value, write it to the target path; otherwise leave the resource unchanged."""

Dependencies { .dependencies }

fhir-py { .dependency }

Enables nested path navigation helpers for FHIR resource dictionaries.

tile.json