Async/sync FHIR client for Python providing comprehensive API for CRUD operations over FHIR resources
68
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.
reference field uses the "{Type}/{id}" format and preserves any optional display text. @testresourceType and id) and return a canonical reference object that retains display text when present. @test$validate) on the target resource indicated by a reference input, forwarding optional parameters/body and returning the parsed result. @test@generates
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."""FHIR client and utilities for constructing, resolving, and executing against references.
Install with Tessl CLI
npx tessl i tessl/pypi-fhirpyevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10