fhir_path library

Classes

AbsParser
AggregateParser
Performs general-purpose aggregation by evaluating the aggregator expression for each element of the input collection. Within this expression, the standard iteration variables of $this and $index can be accessed, but also a $total aggregation variable. The value of the $total variable is set to init, or empty ({ }) if no init value is supplied, and is set to the result of the aggregator expression after every iteration. Using this function, sum can be expressed as: value.aggregate($this + $total, 0) Min can be expressed as: value.aggregate(iif($total.empty(), $this, iif($this < $total, $this, $total))) and average would be expressed as: value.aggregate($total + $this, 0) / value.count()
AllFalseParser
Takes a collection of Boolean values and returns true if all the items are false. If any items are true, the result is false. If the input is empty ({ }), the result is true.
AllParser
AllTrueParser
Takes a collection of Boolean values and returns true if all the items are true. If any items are false, the result is false. If the input is empty ({ }), the result is true.
AndStringParser
AnswersParser
AnyFalseParser
Takes a collection of Boolean values and returns true if any of the items are false. If all the items are true, or if the input is empty ({ }), the result is false.
AnyTrueParser
Takes a collection of Boolean values and returns true if any of the items are true. If all the items are false, or if the input is empty ({ }), the result is false.
AsFunctionParser
DEPRECATED The as() function is defined for backwards compatibility with previous implementations of FHIRPath. However, we have chosen not to support it. DEPRECATED
AsParser
AvgParser
BaseDateTimeParser<T>
BaseDateTimeParser: either a DateParser or DateTimeParser
BooleanParser
Boolean Parser, it returns a FHIR Boolean value
BracketsIndexParser
CeilingParser
ChildrenParser
CombineParser
Merge the input and other collections into a single collection without eliminating duplicate values. Combining an empty collection with a non-empty collection will return the non-empty collection. There is no expectation of order in the resulting collection.
CommaParser
ContainsFunctionParser
ContainsOperatorParser
ConvertsToBooleanParser
http://hl7.org/fhirpath/#convertstoboolean-boolean If the input collection contains a single item, this function will return true if: the item is a Boolean the item is an Integer that is equal to one of the possible integer representations of Boolean values the item is a Decimal that is equal to one of the possible decimal representations of Boolean values the item is a String that is equal to one of the possible string representations of Boolean values
ConvertsToDateParser
Checks if input can be converted to a Date
ConvertsToDateTimeParser
Checks if input can be converted to a FhirDateTime
ConvertsToDecimalParser
Checks if input can be converted into a Decimal
ConvertsToIntegerParser
Checks if input can be converted to an Integer
ConvertsToQuantityParser
Checks if input can be converted to a ValidatedQuantity
ConvertsToStringParser
Checks if input can be converted to a String
ConvertsToTimeParser
Checks if input can be converted to a Time
CountParser
DateParser
The Date type represents date and partial date values in the range @0001-01-01 to @9999-12-31 with a 1 day step size.
DateTimeParser
The DateTime type represents date/time and partial date/time values in the range @0001-01-01T00:00:00.000 to @9999-12-31T23:59:59.999 with a 1 millisecond step size. This range is defined based on a survey of datetime implementations and is based on the most useful lowest common denominator. Implementations can provide support for larger ranges and higher precision, but must provide at least the range and precision defined here.
DecimalParser
The Decimal type represents real values in the range (-10^28+1)/10^8 to (10^28-1)/10^8 with a step size of 10^-8. Again, this is FHIRPath's official definition, we use Dart's double, which I believe is the same range as int but with 15 decimal points. FHIRPath's range is defined based on a survey of decimal-value implementations and is based on the most useful lowest common denominator. Implementations can provide support for larger decimals and higher precision, but must provide at least the range and precision defined here. In addition, implementations should use fixed-precision decimal formats to ensure that decimal values are accurately represented
DelimitedIdentifierParser
Identifiers are used as labels to allow expressions to reference elements such as model types and properties. FHIRPath supports two types of identifiers, simple and delimited. A delimited identifier is any sequence of characters enclosed in backticks ( ` ): The use of backticks allows identifiers to contains spaces, commas, and other characters that would not be allowed within simple identifiers. This allows identifiers to be more descriptive, and also enables expressions to reference models that have property or type names that are not valid simple identifiers.
DescendantsParser
DistinctParser
DivSignParser
Divides the left operand by the right operand (supported for Integer, Decimal, and Quantity). The result of a division is always Decimal, even if the inputs are both Integer. For integer division, use the div operator. If an attempt is made to divide by zero, the result is empty.
DivStringParser
DotParser
EmptyParser
Returns true if the input collection is empty ({ }) and false otherwise.
EmptySetParser
There is no literal representation for null in FHIRPath. This means that when, in an underlying data object (i.e. they physical data on which the implementation is operating) a member is null or missing, there will simply be no corresponding node for that member in the tree, e.g. Patient.name will return an empty collection (not null) if there are no name elements in the instance. In expressions, the empty collection is represented as { }.
EndsWithParser
EnvVariableParser
This allows the passing of a variable from the environment into the evaluation.
EqualsParser
EquivalentParser
ExcludeParser
ExistsParser
Returns true if the collection has any elements, and false otherwise. This is the opposite of empty(), and as such is a shorthand for empty().not(). If the input collection is empty ({ }), the result is false. The function can also take an optional criteria to be applied to the collection prior to the determination of the exists. In this case, the function is shorthand for where(criteria).exists(). Note that a common term for this function is any.
ExpParser
ExtensionParser
FhirPathParser
FhirPathParser: base parser
FirstParser
FloorParser
FpMatchesParser
FpNotParser
FpSkipParser
FpWhereParser
FunctionParser
FunctionParser: functions
GreaterEqualParser
GreaterParser
HasValueParser
IdentifierParser
Identifiers are used as labels to allow expressions to reference elements such as model types and properties. FHIRPath supports two types of identifiers, simple and delimited. A simple identifier is any alphabetical character or an underscore, followed by any number of alpha-numeric characters or underscores
IifParser
http://hl7.org/fhirpath/#iifcriterion-expression-true-result-collection-otherwise-result-collection-collection The iif function in FHIRPath is an immediate if, also known as a conditional operator (such as C’s ? : operator). The criterion expression is expected to evaluate to a Boolean. See: http://hl7.org/fhirpath/#singleton-evaluation-of-collections for rules of Boolean evaluation. Any collection with a single non-boolean item is true.
ImpliesParser
IndexOfParser
IndexParser
If the function takes an expression as a parameter, the function will evaluate the expression passed for the parameter with respect to each of the items in the input collection. These expressions may refer to the special $this and $index elements, which represent the item from the input collection currently under evaluation, and its index in the collection, respectively. For example, in name.given.where($this > 'ba' and $this < 'bc') the where() function will iterate over each item in the input collection (elements named given) and $this will be set to each item when the expression passed to where() is evaluated.
InParser
http://hl7.org/fhirpath/N1/#in-membership
IntegerParser
The Integer type represents whole numbers in the range -2^31 to 2^31-1 in the FHIRPath spec, although we follow Dart's int which is +/- 2^53
IntersectParser
IsDistinctParser
IsFunctionParser
DEPRECATED The as() function is defined for backwards compatibility with previous implementations of FHIRPath. However, we have chosen not to support it. DEPRECATED
IsParser
IterationContext
LastParser
LengthParser
LessEqualParser
LessParser
LnParser
LogParser
LowerParser
MaxParser
MinParser
MinusParser
ModParser
NotEqualsParser
https://hl7.org/fhirpath/#not-equals
NotEquivalentParser
NowParser
OfTypeParser
OperatorParser
OperatorParser: operators
OrdinalParser
OrStringParser
ParenthesesParser
ParenthesesParser: ()
ParserList
ParserList: anything that is a List of FhirPathParsers
PlusParser
PowerParser
QuantityParser
The Quantity type represents quantities with a specified unit, where the value component is defined as a Decimal, and the unit element is represented as a String that is required to be either a valid Unified Code for Units of Measure (UCUM) unit or one of the calendar duration keywords, singular or plural.
RepeatParser
ReplaceMatchesParser
ReplaceParser
RoundParser
SelectParser
SingleParser
SingletonEvaluation
Implements rule http://hl7.org/fhirpath/#singleton-evaluation-of-collections
SqrtParser
StarParser
StartsWithParser
StringConcatenationParser
StringParser
The String type represents string values up to 2^31-1 characters in length. String literals are surrounded by single-quotes and may use -escapes to escape quotes and represent Unicode characters.
SubsetOfParser
SubstringParser
SumParser
SupersetOfParser
TailParser
TakeParser
ThisParser
If the function takes an expression as a parameter, the function will evaluate the expression passed for the parameter with respect to each of the items in the input collection. These expressions may refer to the special $this and $index elements, which represent the item from the input collection currently under evaluation, and its index in the collection, respectively. For example, in name.given.where($this > 'ba' and $this < 'bc') the where() function will iterate over each item in the input collection (elements named given) and $this will be set to each item when the expression passed to where() is evaluated.
TimeOfDayParser
TimeParser
The Time type represents time-of-day and partial time-of-day values in the range @T00:00:00.000 to @T23:59:59.999 with a step size of 1 millisecond. This range is defined based on a survey of time implementations and is based on the most useful lowest common denominator. Implementations can provide support for higher precision, but must provide at least the range and precision defined here. Time values in FHIRPath do not have a timezone or timezone offset.
ToBooleanParser
http://hl7.org/fhirpath/#toboolean-boolean If the input collection contains a single item, this function will return a single boolean if: the item is a Boolean the item is an Integer and is equal to one of the possible integer representations of Boolean values the item is a Decimal that is equal to one of the possible decimal representations of Boolean values the item is a String that is equal to one of the possible string representations of Boolean values If the item is not one the above types, or the item is a String, Integer, or Decimal, but is not equal to one of the possible values convertible to a Boolean, the result is empty.
ToCharsParser
ToDateParser
Converts input to an Date if possible
ToDateTimeParser
Converts input to FhirDateTime if possible
TodayParser
ToDecimalParser
Converts input to a Decimal if possible
ToIntegerParser
Converts input to an Integer if possible
ToQuantityParser
Converts input to a ValidatedQuantity if possible
ToStringParser
Converts input to a String if possible
TotalParser
ToTimeParser
Converts input to a Time if possible
TraceParser
TruncateParser
UnaryNegateParser
UnaryPlusParser
UnionFunctionParser
Merge the two collections into a single collection, eliminating any duplicate values (using = (Equals) (=) to determine equality). There is no expectation of order in the resulting collection.
UnionOperatorParser
UpperParser
ValueParser<T>
ValueParser: basic parser that holds a value
WhiteSpaceParser
This includes all input that should be ignored, this includes pure white space, along with comments, it simply returns whatever has been passed to it
XorParser

Constants

FhirDatatypes → const Set<String>
operatorOrderMap → const Map<Type, int>
Trying to enforce Operator Order Precedence
polymorphicPrefixes → const Set<String>

Properties

absLexer → Parser<AbsParser>
identifies abss
final
aggregateLexer → Parser<AggregateParser>
identifies aggregates
final
allFalseLexer → Parser<AllFalseParser>
identifies allFalses
final
allLexer → Parser<AllParser>
identifies alls
final
allTrueLexer → Parser<AllTrueParser>
identifies allTrues
final
andStringLexer → Parser<AndStringParser>
identifies andStrings
final
answersLexer → Parser<AnswersParser>
identifies answerss
final
anyFalseLexer → Parser<AnyFalseParser>
identifies anyFalses
final
anyTrueLexer → Parser<AnyTrueParser>
identifies anyTrues
final
asFunctionLexer → Parser<AsFunctionParser>
These lexers help identify parts of an expression that are no longer supported. When the expression is applied to an object, it will throw an error, but this allows us to give more helpful and specific error messages (also, on the off chance an old system needs to actually allow these, it makes it )
final
asLexer → Parser<AsParser>
identifies as
final
avgLexer → Parser<AvgParser>
identifies avgs
final
booleanLiteral → Parser<BooleanParser>
Finds strings 'true' or 'false' (without quotes)
final
bracketsIndexLexer → Parser<BracketsIndexParser>
identifies bracketsIndexs
final
ceilingLexer → Parser<CeilingParser>
identifies ceilings
final
childrenLexer → Parser<ChildrenParser>
identifies childrens
final
combineLexer → Parser<CombineParser>
identifies combines
final
commaLexer → Parser<CommaParser>
identifies commas
final
COMMENT → Parser<WhiteSpaceParser>
final
containsFunctionLexer → Parser<ContainsFunctionParser>
identifies containsFunctions
final
containsOperatorLexer → Parser<ContainsOperatorParser>
identifies contains operators
final
convertsToBooleanLexer → Parser<ConvertsToBooleanParser>
identifies convertsToBooleans
final
convertsToDateLexer → Parser<ConvertsToDateParser>
identifies convertsToDates
final
convertsToDateTimeLexer → Parser<ConvertsToDateTimeParser>
identifies convertsToDateTimes
final
convertsToDecimalLexer → Parser<ConvertsToDecimalParser>
identifies convertsToDecimals
final
convertsToIntegerLexer → Parser<ConvertsToIntegerParser>
identifies convertsToIntegers
final
convertsToQuantityLexer → Parser<ConvertsToQuantityParser>
identifies convertsToQuantitys
final
convertsToStringLexer → Parser<ConvertsToStringParser>
identifies convertsToStrings
final
convertsToTimeLexer → Parser<ConvertsToTimeParser>
identifies convertsToTimes
final
countLexer → Parser<CountParser>
identifies counts
final
DATE → Parser<DateParser>
Follows DateTime format specified in FHIRPath (I have also updated the FHIR) package to follow many of these guidelines
final
DATEFORMAT → Parser<String>
final
DATETIME → Parser<DateTimeParser>
final
dateTimePrecision → Parser<String>
final
DECIMAL → Parser<DecimalParser>
final
DELIMITEDIDENTIFIER → Parser<IdentifierParser>
DELIMITEDIDENTIFIER is signified by a backquote (`) on either end
final
deprecatedLexer → ChoiceParser
Deprecated - these Lexers will throw errors, but this allows us to provide more useful error messages
final
descendantsLexer → Parser<DescendantsParser>
identifies descendantss
final
distinctLexer → Parser<DistinctParser>
identifies distincts
final
divSignLexer → Parser<DivSignParser>
identifies divSigns
final
divStringLexer → Parser<DivStringParser>
identifies divStrings
final
dotLexer → Parser<DotParser>
identifies dots
final
DOUBLEQUOTEDIDENTIFIER → Parser<IdentifierParser>
final
emptyLexer → Parser<EmptyParser>
identifies emptys
final
emptySetLexer → Parser<EmptySetParser>
identifies emptySets
final
endsWithLexer → Parser<EndsWithParser>
identifies endsWiths
final
envVariableLexer → Parser<EnvVariableParser>
Allows environmental variables to be passed to FHIRPath
final
equalsLexer → Parser<EqualsParser>
identifies equalss
final
equivalentLexer → Parser<EquivalentParser>
identifies equivalents
final
ESC → Parser<String>
final
excludeLexer → Parser<ExcludeParser>
identifies excludes
final
existsLexer → Parser<ExistsParser>
identifies existss
final
expLexer → Parser<ExpParser>
identifies exps
final
extensionLexer → Parser<ExtensionParser>
final
firstLexer → Parser<FirstParser>
identifies firsts
final
floorLexer → Parser<FloorParser>
identifies floors
final
functionLexer → ChoiceParser
All lexers for functions that accept arguments
final
greaterEqualLexer → Parser<GreaterEqualParser>
identifies greaterEquals
final
greaterLexer → Parser<GreaterParser>
identifies greaters
final
hasValueLexer → Parser<HasValueParser>
identifies hasValues
final
HEX → Parser<String>
final
IDENTIFIER → Parser<IdentifierParser>
An Identifier has no quotes
final
iifLexer → Parser<IifParser>
identifies iifs
final
impliesLexer → Parser<ImpliesParser>
identifies implies
final
indexLexer → Parser<IndexParser>
identifies indexs
final
indexOfLexer → Parser<IndexOfParser>
identifies indexOfs
final
inLexer → Parser<InParser>
identifies ins
final
INTEGER → Parser<IntegerParser>
final
intersectLexer → Parser<IntersectParser>
identifies intersects
final
isDistinctLexer → Parser<IsDistinctParser>
identifies isDistincts
final
isFunctionLexer → Parser<IsFunctionParser>
final
isLexer → Parser<IsParser>
identifies is
final
lastLexer → Parser<LastParser>
identifies lasts
final
lengthLexer → Parser<LengthParser>
identifies lengths
final
lessEqualLexer → Parser<LessEqualParser>
identifies lessEquals
final
lessLexer → Parser<LessParser>
identifies lesss
final
LINE_COMMENT → Parser<WhiteSpaceParser>
final
literalLexer → ChoiceParser
Lexers identifying special formatting of certain types of data
final
lnLexer → Parser<LnParser>
identifies lns
final
logLexer → Parser<LogParser>
identifies logs
final
lowerLexer → Parser<LowerParser>
identifies lowers
final
matchesLexer → Parser<FpMatchesParser>
identifies matchess
final
maxLexer → Parser<MaxParser>
identifies maxs
final
minLexer → Parser<MinParser>
identifies mins
final
minusLexer → Parser<MinusParser>
final
modLexer → Parser<ModParser>
identifies divMods
final
notEqualsLexer → Parser<NotEqualsParser>
identifies notEqualss
final
notEquivalentLexer → Parser<NotEquivalentParser>
identifies notEquivalents
final
notLexer → Parser<FpNotParser>
identifies nots
final
nowLexer → Parser<NowParser>
identifies nows
final
NUMBER → Parser
Also allows leading zeroes now (just like CQL and XSD)
final
ofTypeLexer → Parser<OfTypeParser>
identifies ofTypes
final
ordinalLexer → Parser<OrdinalParser>
identifies ordinals
final
orStringLexer → Parser<OrStringParser>
identifies orStrings
final
pluralDateTimePrecision → Parser<String>
final
plusLexer → Parser<PlusParser>
final
powerLexer → Parser<PowerParser>
identifies powers
final
quantityLiteral → Parser<QuantityParser>
final
repeatLexer → Parser<RepeatParser>
identifies repeats
final
replaceLexer → Parser<ReplaceParser>
identifies replaces
final
replaceMatchesLexer → Parser<ReplaceMatchesParser>
identifies replaceMatchess
final
roundLexer → Parser<RoundParser>
identifies rounds
final
selectLexer → Parser<SelectParser>
identifies selects
final
simpleLexer → ChoiceParser
All lexers for functions that don't accept arguments
final
singleLexer → Parser<SingleParser>
identifies singles
final
skipLexer → Parser<FpSkipParser>
identifies skips
final
specialLexer → ChoiceParser
Lexers for identifying special items
final
sqrtLexer → Parser<SqrtParser>
identifies sqrts
final
starLexer → Parser<StarParser>
identifies stars
final
startsWithLexer → Parser<StartsWithParser>
identifies startsWiths
final
STRING → Parser<StringParser>
A String is signified by single quotes (') on either end
final
stringConcatenationLexer → Parser<StringConcatenationParser>
identifies string concatenation ampersand (&)
final
subsetOfLexer → Parser<SubsetOfParser>
identifies subsetOfs
final
substringLexer → Parser<SubstringParser>
identifies substrings
final
sumLexer → Parser<SumParser>
identifies sums
final
supersetOfLexer → Parser<SupersetOfParser>
identifies supersetOfs
final
symbolOperationLexer → ChoiceParser
Lexers for identifying key symbols
final
tailLexer → Parser<TailParser>
identifies tails
final
takeLexer → Parser<TakeParser>
identifies takes
final
thisLexer → Parser<ThisParser>
identifies thiss
final
TIME → Parser<TimeParser>
final
TIMEFORMAT → Parser<String>
final
timeOfDayLexer → Parser<TimeOfDayParser>
identifies timeOfDays
final
TIMEZONEOFFSETFORMAT → Parser<String>
final
toBooleanLexer → Parser<ToBooleanParser>
final
toCharsLexer → Parser<ToCharsParser>
identifies toCharss
final
toDateLexer → Parser<ToDateParser>
identifies toDates
final
toDateTimeLexer → Parser<ToDateTimeParser>
identifies toDateTimes
final
todayLexer → Parser<TodayParser>
identifies todays
final
toDecimalLexer → Parser<ToDecimalParser>
identifies toDecimals
final
toIntegerLexer → Parser<ToIntegerParser>
identifies toIntegers
final
toQuantityLexer → Parser<ToQuantityParser>
identifies toQuantitys
final
toStringLexer → Parser<ToStringParser>
identifies toStrings
final
totalLexer → Parser<TotalParser>
identifies totals
final
toTimeLexer → Parser<ToTimeParser>
identifies toTimes
final
traceLexer → Parser<TraceParser>
identifies traces
final
truncateLexer → Parser<TruncateParser>
identifies truncates
final
UNICODE → Parser<String>
final
unionFunctionLexer → Parser<UnionFunctionParser>
identifies unionFunctions
final
unionOperatorLexer → Parser<UnionOperatorParser>
identifies unionOperators
final
unit → Parser<String>
final
upperLexer → Parser<UpperParser>
identifies uppers
final
whereLexer → Parser<FpWhereParser>
identifies wheres
final
wordOperationLexer → ChoiceParser
Lexers for identifying key words
final
WS → Parser<WhiteSpaceParser>
No equivalent for piping whitespace to the HIDDEN channel in Dart
final
wsLexer → ChoiceParser
Lexer for all types of white space
final
xorLexer → Parser<XorParser>
identifies xors
final

Functions

addToFhirTime(FhirTime fhirTime, ValidatedQuantity validatedQuantity) → FhirTime
deepEquals(List list1, List list2) bool
dstu2WalkFhirPath(Resource? resource, String pathExpression, [Map<String, dynamic>? environment]) List
executeComparisons(List results, ParserList before, ParserList after, Map<String, dynamic> passed, Comparator comparator, {bool where = false}) List
executeFhirPath({required Map<String, dynamic>? context, required ParserList parsedFhirPath, required String pathExpression, Map<String, dynamic>? resource, Map<String, dynamic>? rootResource, Map<String, dynamic>? environment, FhirVersion version = FhirVersion.r4}) List
Execute the FHIRPath as pre-parsed by parseFhirPath.
extendedDurationFromValidatedQuantity(ValidatedQuantity validatedQuantity) → ExtendedDuration
foundInList(List list, dynamic e) bool
lexer() → Parser<FhirPathParser>
Primary lexing function for this library
notFoundInList(List list, dynamic e) bool
operatorValues(List fullList) ParserList
This ensures that any response is a ParserList (this allows easy recursion when evaluating the expression)
parseFhirPath(String pathExpression) ParserList
Parse a FHIRPath for repeated use with different inputs later.
r4WalkFhirPath(Resource? resource, String pathExpression, [Map<String, dynamic>? environment]) List
r5WalkFhirPath(Resource? resource, String pathExpression, [Map<String, dynamic>? environment]) List
startsWithAPolymorphicPrefix(String value) bool
stu3WalkFhirPath(Resource? resource, String pathExpression, [Map<String, dynamic>? environment]) List
subtractFromFhirTime(FhirTime fhirTime, ValidatedQuantity validatedQuantity) → FhirTime
walkFhirPath({required Map<String, dynamic>? context, required String pathExpression, Map<String, dynamic>? resource, Map<String, dynamic>? rootResource, Map<String, dynamic>? environment, FhirVersion version = FhirVersion.r4}) List
Start here! This is where the fun begins. This is a bit confusing, so we'll explain the arguments that can be passed.

Exceptions / Errors

FhirPathDeprecatedExpressionException
The FHIRPath expression is using elements that have been deprecated.
FhirPathEvaluationException
The evaluation of the expression failed with the given parameters.
FhirPathException
Something went wrong while parsing or executing a FHIRPath expression.
FhirPathInvalidExpressionException
The overall syntax of the expression is incorrect.