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

Reference Workflow Helper

Build a small helper module that creates canonical references to FHIR resources, normalizes different reference inputs, resolves references into full resources, and executes named operations on the referenced resources.

Capabilities

Build canonical references

  • Given a resource type and ID, produce a reference object whose reference field uses the "{Type}/{id}" format and preserves any optional display text. @test

Normalize mixed reference inputs

  • Accept either a reference string/object or a full resource (with resourceType and id) and return a canonical reference object that retains display text when present. @test

Resolve references to resources

  • Given a client and any supported reference input, return the fully populated resource without refetching when a concrete resource is already provided. @test

Execute operations on references

  • Invoke a named operation (e.g., $validate) on the target resource indicated by a reference input, forwarding optional parameters/body and returning the parsed result. @test

Implementation

@generates

API

from typing import Any, Dict, Optional, Union

ReferenceInput = Union[str, Dict[str, Any], Any]

def make_reference(resource_type: str, resource_id: str, display: Optional[str] = None) -> Dict[str, Any]:
    """Return a canonical reference object with optional display text."""

def normalize_reference(value: ReferenceInput) -> Dict[str, Any]:
    """Convert a reference string/object or concrete resource into a canonical reference object."""

def resolve_reference(client: Any, value: ReferenceInput) -> Dict[str, Any]:
    """Return the full resource for the given input, using the client to resolve when only a reference is supplied."""

def invoke_reference_operation(
    value: ReferenceInput,
    operation: str,
    params: Optional[Dict[str, Any]] = None,
    method: Optional[str] = None,
) -> Dict[str, Any]:
    """Execute a named operation against the referenced resource and return the result."""

Dependencies { .dependencies }

fhirpy { .dependency }

FHIR client and utilities for constructing, resolving, and executing against references.

tile.json