Documentation
¶
Overview ¶
Package walker provides a generic resource walker for traversing FHIR resources, Bundle entries, and contained resources with a unified interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResourceContext ¶
type ResourceContext struct {
// Data is the parsed resource data.
Data map[string]any
// ResourceType is the FHIR resource type (e.g., "Patient", "Observation").
ResourceType string
// FHIRPath is the path to this resource (e.g., "Bundle.entry[0].resource").
FHIRPath string
// SD is the StructureDefinition for validation (may be profile or base type).
SD *registry.StructureDefinition
// Profiles contains the URLs from meta.profile (if any).
Profiles []string
// IsContained indicates if this is a contained resource.
IsContained bool
// IsBundleEntry indicates if this is a Bundle entry resource.
IsBundleEntry bool
// ParentPath is the path to the parent resource (if any).
ParentPath string
}
ResourceContext contains information about a resource being visited.
type ResourceVisitor ¶
type ResourceVisitor func(ctx *ResourceContext) bool
ResourceVisitor is called for each resource found during walking. Return false to stop walking.
type Walker ¶
type Walker struct {
// contains filtered or unexported fields
}
Walker traverses FHIR resources, including Bundle entries and contained resources.
func (*Walker) Walk ¶
func (w *Walker) Walk(data map[string]any, rootType, rootPath string, visitor ResourceVisitor)
Walk traverses a resource and all its nested resources (contained, Bundle entries). The visitor is called for each resource, starting with the root.
func (*Walker) WalkWithProfiles ¶
func (w *Walker) WalkWithProfiles(data map[string]any, rootType, rootPath string, visitor ResourceVisitor)
WalkWithProfiles traverses a resource, visiting once per declared profile. For resources with meta.profile, the visitor is called once per profile. For resources without profiles, it's called once with the base SD.