Advanced Topics
This section covers advanced features of the FHIRPath Go library that help you build production-ready applications. Each topic builds on the core API introduced in the Getting Started guide.
What You Will Find Here
Expression Caching – Avoid redundant parsing with the built-in LRU expression cache. Learn how to use the global
DefaultCache, create custom caches, monitor hit rates, and pre-warm caches at startup.Evaluation Options – Control evaluation behavior with timeouts, recursion limits, collection size caps, and custom variables via the functional options API.
FHIR Version-Specific Models – Use the
Modelinterface to provide FHIR version-specific type metadata for precise polymorphic resolution, type hierarchy checking, and path-based inference. Compatible withgofhir/modelsfor R4, R4B, and R5.Custom Reference Resolvers – Implement the
ReferenceResolverinterface to let theresolve()function fetch referenced FHIR® resources from HTTP endpoints, in-memory bundles, or any other data source.Terminology Services – Connect the
memberOf()andconformsTo()functions to external terminology servers and profile validators by implementing theTerminologyServiceandProfileValidatorinterfaces.Performance Guide – Practical patterns for high-throughput evaluation: compile-once, expression caching, resource pre-serialization, early filtering, and avoiding unnecessary type conversions.
Thread Safety – Understand the concurrency model: which objects are safe to share across goroutines and which must remain per-evaluation. Includes HTTP handler and worker pool examples.