fhirpath

package
v0.0.0-...-5b88717 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package fhirpath implements the FHIRPath specification.

More documentation about the FHIRPath specification can be found on HL7 websites: * https://www.hl7.org/fhir/fhirpath.html * http://hl7.org/fhirpath/N1/

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidField     = expr.ErrInvalidField
	ErrUnsupportedType  = evalopts.ErrUnsupportedType
	ErrExistingConstant = evalopts.ErrExistingConstant
)

Functions

This section is empty.

Types

type CompileOption

type CompileOption = opts.CompileOption

CompileOption is a function type that modifies a passed in compileOption. Can define mutator functions of this type (see WithLimitation below)

func WithFunction deprecated

func WithFunction(name string, fn any) CompileOption

WithFunction is a compile option that allows the addition of user-defined functions to a FHIRPath expression. Function argument must match the signature func(Collection, ...any) (Collection, error), or an error will be raised.

Deprecated: Use compopts.Function instead.

type EvaluateOption

type EvaluateOption = opts.EvaluateOption

EvaluateOption is a function type that mutates the evalOptions type.

func WithConstant deprecated

func WithConstant(name string, value any) EvaluateOption

WithConstant is an EvaluateOption that allows the addition of external constant variables. An error will be raised if the value passed in is neither a fhir proto or system type.

Deprecated: Use evalopts.EnvVariable instead

type Expression

type Expression struct {
	// contains filtered or unexported fields
}

Expression is the FHIRPath expression that will be compiled from a FHIRPath string

func Compile

func Compile(expr string, options ...CompileOption) (*Expression, error)

Compile parses and compiles the FHIRPath expression down to a single Expression object.

If there are any syntax or semantic errors, this will return an error indicating the compilation failure reason.

func MustCompile

func MustCompile(expr string, opts ...CompileOption) *Expression

MustCompile compiles the FHIRpath expression input, and returns the compiled expression. If any compilation error occurs, this function will panic.

func (*Expression) Evaluate

func (e *Expression) Evaluate(input []fhir.Resource, options ...EvaluateOption) (system.Collection, error)

Evaluate the expression, returning either a collection of elements, or error

func (*Expression) EvaluateAsBool

func (e *Expression) EvaluateAsBool(input []fhir.Resource, options ...EvaluateOption) (bool, error)

EvaluateAsBool evaluates the expression, returning either a boolean or error

func (*Expression) EvaluateAsInt32

func (e *Expression) EvaluateAsInt32(input []fhir.Resource, options ...EvaluateOption) (int32, error)

EvaluateAsInt32 evaluates the expression, returning either an int32 or error

func (*Expression) EvaluateAsString

func (e *Expression) EvaluateAsString(input []fhir.Resource, options ...EvaluateOption) (string, error)

EvaluateAsString evaluates the expression, returning a string or error

func (*Expression) String

func (e *Expression) String() string

String returns the string representation of this FHIRPath expression. This is just the input that initially produced the FHIRPath value.

Directories

Path Synopsis
Package compopts provides CompileOption values for FHIRPath.
Package compopts provides CompileOption values for FHIRPath.
Package evalopts provides EvaluateOption values for FHIRPath.
Package evalopts provides EvaluateOption values for FHIRPath.
Package fhirpathtest provides an easy way to generate test-doubles within FHIRPath.
Package fhirpathtest provides an easy way to generate test-doubles within FHIRPath.
internal
compile
Package compile provides helpers for compiling FHIRPath strings into FHIRPath expressions.
Package compile provides helpers for compiling FHIRPath strings into FHIRPath expressions.
expr
Package expr contains all the expression types and related logic for FHIRPath expressions.
Package expr contains all the expression types and related logic for FHIRPath expressions.
expr/exprtest
Package exprtest provides some useful test dummies to make it easier to mock expressions to return a desired result.
Package exprtest provides some useful test dummies to make it easier to mock expressions to return a desired result.
funcs
Package funcs provides the implementations for all base FHIRPath functions.
Package funcs provides the implementations for all base FHIRPath functions.
opts
Package opts is an internal package that exists for setting configuration settings for FHIRPath.
Package opts is an internal package that exists for setting configuration settings for FHIRPath.
parser
Package parser provides the logic for traversing the ANTLR generated parse tree.
Package parser provides the logic for traversing the ANTLR generated parse tree.
reflection
Package reflection provides types and utility functions to enable FHIRPath type reflection.
Package reflection provides types and utility functions to enable FHIRPath type reflection.
Package patch implements the FHIRPath Patch specification.
Package patch implements the FHIRPath Patch specification.
Package system provides types and related utility functions for all the valid FHIRPath System types to be used for literals.
Package system provides types and related utility functions for all the valid FHIRPath System types to be used for literals.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL