FHIRPath Engine
FHIRPath evaluation engine components
CheckModifiers
Path: fhircraft.fhir.path.engine.additional.CheckModifiers
Bases: FHIRPathFunction
A representation of the FHIRPath checkModifiers() function.
Attributes:
| Name | Type | Description |
|---|---|---|
modifier |
str
|
The modifier to check for. |
Methods:
| Name | Description |
|---|---|
evaluate |
For each element in the input collection, verifies that there are no modifying extensions defined other than the ones given by the modifier argument (comma-separated string). If the check passes, the input collection is returned. Otherwise, an error is thrown, including if modifier is empty. |
Source code in fhircraft/fhir/path/engine/additional.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
For each element in the input collection, verifies that there are no modifying extensions defined other than the ones given by the modifier argument (comma-separated string). If the check passes, the input collection is returned. Otherwise, an error is thrown, including if modifier is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
Comparable
Path: fhircraft.fhir.path.engine.additional.Comparable
Bases: FHIRPathFunction
A representation of the FHIRPath comparable() function.
Attributes:
| Name | Type | Description |
|---|---|---|
quantity |
Quantity | FHIRPath
|
The quantity to check for comparability or a FHIRPath that resolves to a Quantity. |
Methods:
| Name | Description |
|---|---|
evaluate |
This function returns |
Source code in fhircraft/fhir/path/engine/additional.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
This function returns true if the engine executing the FHIRPath statement can compare the singleton Quantity with the singleton other Quantity and determine their relationship to each other. Comparable means that both have values and that the code and system for the units are the same (irrespective of system) or both have code + system, system is recognized by the FHIRPath implementation and the codes are comparable within that code system. E.g. days and hours or inches and cm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
ConformsTo
Path: fhircraft.fhir.path.engine.additional.ConformsTo
Bases: FHIRPathFunction
A representation of the FHIRPath conformsTo() function.
Attributes:
| Name | Type | Description |
|---|---|---|
structure |
str
|
The structure canonical URL. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
Source code in fhircraft/fhir/path/engine/additional.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns true if the single input element conforms to the profile specified by the structure argument, and false otherwise. If the input is not a single item, the structure is empty, or the structure cannot be resolved to a valid profile, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
ElementDefinition
Path: fhircraft.fhir.path.engine.additional.ElementDefinition
Bases: FHIRPathFunction
A representation of the FHIRPath elementDefinition() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the FHIR element definition information for each element in the input collection. If the input collection is empty, the return value will be empty. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the FHIR element definition information for each element in the input collection. If the input collection is empty, the return value will be empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
Extension
Path: fhircraft.fhir.path.engine.additional.Extension
Bases: FHIRPathFunction
A representation of the FHIRPath extension() function.
Attributes:
| Name | Type | Description |
|---|---|---|
url |
str
|
URL to query the extensions. |
Note
This class is a syntactical shortcut equivalent to:
Invocation(Element('extension'), Where(Equals(Element('url'), url)))
Methods:
| Name | Description |
|---|---|
evaluate |
Filters the input collection for items named |
Source code in fhircraft/fhir/path/engine/additional.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Filters the input collection for items named extension with the given url.
Will return an empty collection if the input collection is empty or the url is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
GetValue
Path: fhircraft.fhir.path.engine.additional.GetValue
Bases: FHIRPathFunction
A representation of the FHIRPath getValue() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Return the underlying system value for the FHIR primitive if the input collection contains a single |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Return the underlying system value for the FHIR primitive if the input collection contains a single value which is a FHIR primitive, and it has a primitive value (see discussion for hasValue()). Otherwise the return value is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
HasValue
Path: fhircraft.fhir.path.engine.additional.HasValue
Bases: FHIRPathFunction
A representation of the FHIRPath hasValue() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns true if the input collection contains a single value which is a FHIR primitive, and it has a primitive |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns true if the input collection contains a single value which is a FHIR primitive, and it has a primitive value (e.g. as opposed to not having a value and just having extensions). Otherwise, the return value is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
HighBoundary
Path: fhircraft.fhir.path.engine.additional.HighBoundary
Bases: FHIRPathFunction
A representation of the FHIRPath highBoundary() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the high boundary of a quantity or range based on precision. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the high boundary of a quantity or range based on precision. For date/time values, returns the latest possible moment. For decimal values, returns the highest value within precision range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
HtmlChecks
Path: fhircraft.fhir.path.engine.additional.HtmlChecks
Bases: FHIRPathFunction
A representation of the FHIRPath htmlChecks() function.
Methods:
| Name | Description |
|---|---|
evaluate |
When invoked on a single xhtml element returns true if the rules around HTML usage are met, and false if they are not. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
When invoked on a single xhtml element returns true if the rules around HTML usage are met, and false if they are not. The return value is empty on any other kind of element, or a collection of xhtml elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
bool |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If the collection is not a single item. |
Source code in fhircraft/fhir/path/engine/additional.py
LowBoundary
Path: fhircraft.fhir.path.engine.additional.LowBoundary
Bases: FHIRPathFunction
A representation of the FHIRPath lowBoundary() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the low boundary of a quantity or range based on precision. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the low boundary of a quantity or range based on precision. For date/time values, returns the earliest possible moment. For decimal values, returns the lowest value within precision range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
MemberOf
Path: fhircraft.fhir.path.engine.additional.MemberOf
Bases: FHIRPathFunction
A representation of the FHIRPath memberOf() function.
Attributes:
| Name | Type | Description |
|---|---|---|
valueset |
str
|
The valueset canonical URL. |
Methods:
| Name | Description |
|---|---|
evaluate |
When invoked on a single code-valued element, returns true if the code is a member of the given valueset. |
Source code in fhircraft/fhir/path/engine/additional.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
When invoked on a single code-valued element, returns true if the code is a member of the given valueset. When invoked on a single concept-valued element, returns true if any code in the concept is a member of the given valueset. When invoked on a single string, returns true if the string is equal to a code in the valueset, so long as the valueset only contains one codesystem. If the valueset in this case contains more than one codesystem, the return value is empty.
If the valueset cannot be resolved as a uri to a value set, or the input is empty or has more than one value, the return value is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
Resolve
Path: fhircraft.fhir.path.engine.additional.Resolve
Bases: FHIRPathFunction
A representation of the FHIRPath resolve() function.
Methods:
| Name | Description |
|---|---|
evaluate |
For each item in the collection, if it is a string that is a |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
For each item in the collection, if it is a string that is a uri (or canonical or url), locate the target of the
reference, and add it to the resulting collection. If the item does not resolve to a resource, the item is ignored
and nothing is added to the output collection.
The items in the collection may also represent a Reference, in which case the Reference.reference is resolved.
If the input is empty, the output will be empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
Slice
Path: fhircraft.fhir.path.engine.additional.Slice
Bases: FHIRPathFunction
A representation of the FHIRPath slice() function.
Attributes:
| Name | Type | Description |
|---|---|---|
structure |
str
|
The structure definition URL or name. |
name |
str
|
The name of the slice. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the given slice as defined in the given structure definition. The structure |
Source code in fhircraft/fhir/path/engine/additional.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the given slice as defined in the given structure definition. The structure argument is a uri that resolves to the structure definition, and the name must be the name of a slice within that structure definition. If the structure cannot be resolved, or the name of the slice within the resolved structure is not present, or those parameters are empty, and empty value is returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
SubsumedBy
Path: fhircraft.fhir.path.engine.additional.SubsumedBy
Bases: FHIRPathFunction
A representation of the FHIRPath subsumedBy() function.
Attributes:
| Name | Type | Description |
|---|---|---|
code |
str
|
The code to check for subsumption. |
Methods:
| Name | Description |
|---|---|
evaluate |
When invoked on a Coding-valued element and the given code is Coding-valued, returns true if the source code is equivalent to the given code, or if the source code is subsumed by the given code (i.e. the given code is an ancestor of the source code in a subsumption hierarchy), and false otherwise. |
Source code in fhircraft/fhir/path/engine/additional.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
When invoked on a Coding-valued element and the given code is Coding-valued, returns true if the source code is equivalent to the given code, or if the source code is subsumed by the given code (i.e. the given code is an ancestor of the source code in a subsumption hierarchy), and false otherwise.
If the Codings are from different code systems, the relationships between the code systems must be well-defined or a run-time error is thrown.
When the source or given elements are CodeableConcepts, returns true if any Coding in the source or given elements is equivalent to or subsumed by the given code.
If either the input or the code parameter are not single value collections, the return value is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
Subsumes
Path: fhircraft.fhir.path.engine.additional.Subsumes
Bases: FHIRPathFunction
A representation of the FHIRPath subsumes() function.
Attributes:
| Name | Type | Description |
|---|---|---|
code |
str
|
The code to check for subsumption. |
Methods:
| Name | Description |
|---|---|
evaluate |
When invoked on a Coding-valued element and the given code is Coding-valued, returns true if the source code is equivalent to the given code, or if the source code subsumes the given code (i.e. the source code is an ancestor of the given code in a subsumption hierarchy), and false otherwise. |
Source code in fhircraft/fhir/path/engine/additional.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
When invoked on a Coding-valued element and the given code is Coding-valued, returns true if the source code is equivalent to the given code, or if the source code subsumes the given code (i.e. the source code is an ancestor of the given code in a subsumption hierarchy), and false otherwise.
If the Codings are from different code systems, the relationships between the code systems must be well-defined or the return value is an empty value.
When the source or given elements are CodeableConcepts, returns true if any Coding in the source or given elements is equivalent to or subsumes the given code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/additional.py
TypeChoice
Path: fhircraft.fhir.path.engine.additional.TypeChoice
Aggregate
Path: fhircraft.fhir.path.engine.aggregates.Aggregate
Bases: FHIRPathFunction
A representation of the FHIRPath aggregate() function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expression
|
FHIRPath
|
The aggregator expression to be evaluated for each element of the input collection. |
required |
init
|
Optional[Any]
|
Initial value for the $total variable, defaults to an empty collection if not provided. |
None
|
Methods:
| Name | Description |
|---|---|
evaluate |
Performs general-purpose aggregation by evaluating the aggregator expression for each element of the input collection. |
Source code in fhircraft/fhir/path/engine/aggregates.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/aggregates.py
And
Path: fhircraft.fhir.path.engine.boolean.And
Bases: FHIRPath
A representation of the FHIRPath and boolean logic operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
Source code in fhircraft/fhir/path/engine/boolean.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns True if both operands evaluate to True, False if either operand evaluates to False, and the empty collection ([]) otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/boolean.py
Implies
Path: fhircraft.fhir.path.engine.boolean.Implies
Bases: FHIRPath
A representation of the FHIRPath implies boolean logic operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
If the left operand evaluates to |
Source code in fhircraft/fhir/path/engine/boolean.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the left operand evaluates to True, this operator returns the boolean evaluation of the right operand. If the
left operand evaluates to False, this operator returns True. Otherwise, this operator returns True if the right
operand evaluates to True, and the empty collection ([]) otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/boolean.py
Not
Path: fhircraft.fhir.path.engine.boolean.Not
Bases: FHIRPathFunction
A representation of the FHIRPath not boolean logic function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns True if the input collection evaluates to False, and False if it evaluates to True. Otherwise, the result is empty ([]):
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/boolean.py
Or
Path: fhircraft.fhir.path.engine.boolean.Or
Bases: FHIRPath
A representation of the FHIRPath or boolean logic operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
Source code in fhircraft/fhir/path/engine/boolean.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns False if both operands evaluate to False, True if either operand evaluates to True, and empty ([]) otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/boolean.py
Xor
Path: fhircraft.fhir.path.engine.boolean.Xor
Bases: FHIRPath
A representation of the FHIRPath xor boolean logic operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
Source code in fhircraft/fhir/path/engine/boolean.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns True if exactly one of the operands evaluates to True, False if either both operands evaluate to True or both operands evaluate to False, and the empty collection ([]) otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/boolean.py
Contains
Path: fhircraft.fhir.path.engine.collection.Contains
Bases: FHIRCollectionOperator
A representation of the FHIRPath contains operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
If the right operand is a collection with a single item, this operator returns true if the item is in the |
Source code in fhircraft/fhir/path/engine/collection.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the right operand is a collection with a single item, this operator returns true if the item is in the
left operand using equality semantics. If the right-hand side of the operator is empty, the result is empty,
if the left-hand side is empty, the result is false. This is the converse operation of in.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If the left expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/collection.py
FHIRCollectionOperator
Path: fhircraft.fhir.path.engine.collection.FHIRCollectionOperator
In
Path: fhircraft.fhir.path.engine.collection.In
Bases: FHIRCollectionOperator
A representation of the FHIRPath in operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
If the left operand is a collection with a single item, this operator returns true if the item is in the |
Source code in fhircraft/fhir/path/engine/collection.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the left operand is a collection with a single item, this operator returns true if the item is in the right operand using equality semantics. If the left-hand side of the operator is empty, the result is empty, if the right-hand side is empty, the result is false. If the left operand has multiple items, an exception is thrown.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If the left expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/collection.py
Union
Path: fhircraft.fhir.path.engine.collection.Union
Bases: FHIRCollectionOperator
A representation of the FHIRPath | operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Merge the two collections into a single collection, eliminating any duplicate values to |
Source code in fhircraft/fhir/path/engine/collection.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Merge the two collections into a single collection, eliminating any duplicate values to determine equality). There is no expectation of order in the resulting collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/collection.py
Combine
Path: fhircraft.fhir.path.engine.combining.Combine
Combine(other_collection: FHIRPath | FHIRPathCollection)
Bases: FHIRPathFunction
A representation of the FHIRPath combine() function.
Attributes:
| Name | Type | Description |
|---|---|---|
other_collection |
FHIRPathCollection
|
The other collection to combine with. |
Methods:
| Name | Description |
|---|---|
evaluate |
Merge the input and other collections into a single collection without eliminating duplicate |
Source code in fhircraft/fhir/path/engine/combining.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/combining.py
Union
Path: fhircraft.fhir.path.engine.combining.Union
Union(other_collection: FHIRPath | FHIRPathCollection)
Bases: FHIRPathFunction
A representation of the FHIRPath union() function.
Attributes:
| Name | Type | Description |
|---|---|---|
other_collection |
FHIRPathCollection
|
The other collection to combine with. |
Methods:
| Name | Description |
|---|---|
evaluate |
Merge the two collections into a single collection, eliminating any duplicate values. |
Source code in fhircraft/fhir/path/engine/combining.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Merge the two collections into a single collection, eliminating any duplicate values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/combining.py
FHIRComparisonOperator
Path: fhircraft.fhir.path.engine.comparison.FHIRComparisonOperator
Abstract class definition for the category of comparison FHIRPath operators.
Source code in fhircraft/fhir/path/engine/comparison.py
GreaterEqualThan
Path: fhircraft.fhir.path.engine.comparison.GreaterEqualThan
Bases: FHIRComparisonOperator
A representation of the FHIRPath >= operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
The greater or equal operator (>=) returns true if the first operand is greater than or equal to the second. |
Source code in fhircraft/fhir/path/engine/comparison.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
The greater or equal operator (>=) returns true if the first operand is greater than or equal to the second. The operands must be of the same type, or convertible to the same type using implicit conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/comparison.py
GreaterThan
Path: fhircraft.fhir.path.engine.comparison.GreaterThan
Bases: FHIRComparisonOperator
A representation of the FHIRPath > operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
The greater than operator (>) returns true if the first operand is strictly greater than the second. |
Source code in fhircraft/fhir/path/engine/comparison.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
The greater than operator (>) returns true if the first operand is strictly greater than the second. The operands must be of the same type, or convertible to the same type using an implicit conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/comparison.py
LessEqualThan
Path: fhircraft.fhir.path.engine.comparison.LessEqualThan
Bases: FHIRComparisonOperator
A representation of the FHIRPath <= operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
The less or equal operator (<=) returns true if the first operand is less than or equal to the second. |
Source code in fhircraft/fhir/path/engine/comparison.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
The less or equal operator (<=) returns true if the first operand is less than or equal to the second. The operands must be of the same type, or convertible to the same type using implicit conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/comparison.py
LessThan
Path: fhircraft.fhir.path.engine.comparison.LessThan
Bases: FHIRComparisonOperator
A representation of the FHIRPath < operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
The less than operator (<) returns true if the first operand is strictly less than the second. |
Source code in fhircraft/fhir/path/engine/comparison.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
The less than operator (<) returns true if the first operand is strictly less than the second. The operands must be of the same type, or convertible to the same type using implicit conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/comparison.py
ConvertsToBoolean
Path: fhircraft.fhir.path.engine.conversion.ConvertsToBoolean
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath convertsToBoolean() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return True if the item can be converted to a Boolean, False otherwise.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ConvertsToDate
Path: fhircraft.fhir.path.engine.conversion.ConvertsToDate
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath convertsToDate() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return True if:
- the item is a Date
- the item is a DateTime
- the item is a String and is convertible to a Date
If the item is not one of the above types, or is not convertible to a Date (using the format YYYY-MM-DD), the result is False.
If the item contains a partial date (e.g. '2012-01'), the result is a partial date.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ConvertsToDateTime
Path: fhircraft.fhir.path.engine.conversion.ConvertsToDateTime
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath convertsToDateTime() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return True if:
- the item is a DateTime
- the item is a Date, in which case the result is a DateTime with the year, month, and day of the Date, and the time components empty (not set to zero)
- the item is a String and is convertible to a DateTime
If the item is a String, but the string is not convertible to a DateTime (using the format YYYY-MM-DDThh:mm:ss.fff(+|-)hh:mm), the result is False.
If the item contains a partial datetime (e.g. '2012-01-01T10:00'), the result is 'True'.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ConvertsToDecimal
Path: fhircraft.fhir.path.engine.conversion.ConvertsToDecimal
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath convertsToDecimal() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return True if:
- the item is an Integer or Decimal
- the item is a String and is convertible to a Decimal
- the item is a Boolean, where True results in a 1.0 and False results in a 0.0.
If the item is not one of the above types, or is not convertible to a Decimal, the result is False.
If the input collection is empty, the result is empty ('[]').
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ConvertsToInteger
Path: fhircraft.fhir.path.engine.conversion.ConvertsToInteger
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath convertsToInteger() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return True if the item can be converted to an Integer, False otherwise.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ConvertsToQuantity
Path: fhircraft.fhir.path.engine.conversion.ConvertsToQuantity
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath convertsToQuantity() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return True if:
- the item is an Integer, or Decimal, where the resulting quantity will have the default unit ('1')
- the item is a Quantity
- the item is a String and is convertible to a Quantity
- the item is a Boolean, where true results in the quantity 1.0 '1', and false results in the quantity 0.0 '1'
If the item is not one of the above types, the result is False.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ConvertsToString
Path: fhircraft.fhir.path.engine.conversion.ConvertsToString
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath convertsToString() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return True if:
- the item in the input collection is a String
- the item in the input collection is an Integer, Decimal, Date, Time, DateTime, or Quantity the output will contain its String representation
- the item is a Boolean, where true results in 'true' and false in 'false'.
If the item is not one of the above types, the result is False.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ConvertsToTime
Path: fhircraft.fhir.path.engine.conversion.ConvertsToTime
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath convertsToTime() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return True if:
- the item is a Time
- the item is a String and is convertible to a Time
If the item is a String, but the string is not convertible to a DateTime (using the format hh:mm:ss.fff(+|-)hh:mm), the result is False.
If the item contains a partial datetime (e.g. '10:00'), the result is 'True'.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
FHIRTypeConversionFunction
Path: fhircraft.fhir.path.engine.conversion.FHIRTypeConversionFunction
Bases: FHIRPathFunction
Abstract class definition for the category of type conversion FHIRPath functions.
Methods:
| Name | Description |
|---|---|
validate_collection |
Validates the input collection of a FHIRPath type conversion function. |
validate_collection
Validates the input collection of a FHIRPath type conversion function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
Collection to be validated. |
required |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
Iif
Path: fhircraft.fhir.path.engine.conversion.Iif
Iif(criterion: FHIRPath, true_result: FHIRPath | FHIRPathCollection, otherwise_result: FHIRPath | FHIRPathCollection = list())
Bases: FHIRPathFunction
A representation of the FHIRPath iif() function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
criterion
|
FHIRPath
|
The criterion expression, is expected to evaluate to a |
required |
true_result
|
Union[FHIRPath, Any]
|
Value to be returned if |
required |
otherwise_result
|
Optional[Union[FHIRPath, Any]]
|
Value to be returned if |
list()
|
Methods:
| Name | Description |
|---|---|
evaluate |
This function acts as an immediate if, also known as a conditional operator. |
Source code in fhircraft/fhir/path/engine/conversion.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
This function acts as an immediate if, also known as a conditional operator.
If criterion evaluates to True, the function returns the value of the true_result argument.
If true_result is a FHIRPath expression it is evaluated.
If criterion is False or an empty collection, the function returns the otherwise_result argument,
unless the optional otherwise_result is not given, in which case the function returns an empty collection.
If otherwise_result is a FHIRPath expression it is evaluated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ToBoolean
Path: fhircraft.fhir.path.engine.conversion.ToBoolean
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath toBoolean() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return a single |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
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 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
If the item is not one of 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 false.
If the input collection is empty, the result is empty ('[]').
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ToDate
Path: fhircraft.fhir.path.engine.conversion.ToDate
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath toDate() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return a single date if: |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return a single date if:
- the item is a Date
- the item is a DateTime
- the item is a String and is convertible to a Date
If the item is not one of the above types, or is not convertible to a Date (using the format YYYY-MM-DD), the result is empty.
If the item contains a partial date (e.g. '2012-01'), the result is a partial date.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ToDateTime
Path: fhircraft.fhir.path.engine.conversion.ToDateTime
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath toDateTime() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return a single datetime if: |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return a single datetime if:
- the item is a DateTime
- the item is a Date, in which case the result is a DateTime with the year, month, and day of the Date, and the time components empty (not set to zero)
- the item is a String and is convertible to a DateTime
If the item is a String, but the string is not convertible to a DateTime (using the format YYYY-MM-DDThh:mm:ss.fff(+|-)hh:mm), the result is empty.
If the item contains a partial datetime (e.g. '2012-01-01T10:00'), the result is a partial datetime.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ToDecimal
Path: fhircraft.fhir.path.engine.conversion.ToDecimal
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath toDecimal() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return a single decimal if: |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return a single decimal if:
- the item is an Integer or Decimal
- the item is a String and is convertible to a Decimal
- the item is a Boolean, where True results in a 1.0 and False results in a 0.0.
If the item is not one of the above types, the result is empty ([]).
If the item is a String, but the string is not convertible to a Decimal, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ToInteger
Path: fhircraft.fhir.path.engine.conversion.ToInteger
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath toInteger() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return a single |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return a single Integer if:
- the item is an Integer
- the item is a String and is convertible to an integer
- the item is a Boolean, where True results in a 1 and False results in a 0.
If the item is not one the above types, the result is empty ([]).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ToQuantity
Path: fhircraft.fhir.path.engine.conversion.ToQuantity
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath toQuantity() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return a single quantity if: |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return a single quantity if:
- the item is an Integer, or Decimal, where the resulting quantity will have the default unit ('1')
- the item is a Quantity
- the item is a String and is convertible to a Quantity
- the item is a Boolean, where true results in the quantity 1.0 '1', and false results in the quantity 0.0 '1'
If the item is not one of the above types, the result is empty.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ToString
Path: fhircraft.fhir.path.engine.conversion.ToString
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath toString() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return a single string if: |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return a single string if:
- the item in the input collection is a String
- the item in the input collection is an Integer, Decimal, Date, Time, DateTime, or Quantity the output will contain its String representation
- the item is a Boolean, where true results in 'true' and false in 'false'.
If the item is not one of the above types, the result is empty.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
ToTime
Path: fhircraft.fhir.path.engine.conversion.ToTime
Bases: FHIRTypeConversionFunction
A representation of the FHIRPath toTime() function.
Methods:
| Name | Description |
|---|---|
evaluate |
If the input collection contains a single item, this function will return a single time if: |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the input collection contains a single item, this function will return a single time if:
- the item is a Time
- the item is a String and is convertible to a Time
If the item is a String, but the string is not convertible to a Time (using the format hh:mm:ss.fff(+|-)hh:mm), the result is empty.
If the item contains a partial datetime (e.g. '10:00'), the result is a partial datetime.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If input collection has more than one item. |
Source code in fhircraft/fhir/path/engine/conversion.py
Element
Path: fhircraft.fhir.path.engine.core.Element
Bases: FHIRPath
A class representing an element in a FHIRPath, used for navigating and manipulating FHIR resources.
Attributes:
| Name | Type | Description |
|---|---|---|
label |
str
|
The name of the element. |
Methods:
| Name | Description |
|---|---|
create_element |
Ensure that the input parent object has the necessary field information to create a new element based on the label provided. |
setter |
Sets the value of the specified element in the parent object. |
Source code in fhircraft/fhir/path/engine/core.py
create_element
Ensure that the input parent object has the necessary field information to create a new element based on the label provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Any
|
The parent object from which the element will be created. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
element |
Any
|
The newly created element based on the field information of the parent object, or None if the parent is invalid or lacks the required field information. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If there is an issue with retrieving the field information from the parent object. |
AttributeError
|
If there is an attribute error while trying to create the new element. |
Source code in fhircraft/fhir/path/engine/core.py
setter
staticmethod
setter(value: Any, item: FHIRPathCollectionItem, index: int, label: str, is_list_type: bool) -> None
Sets the value of the specified element in the parent object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
The value to set for the element. |
required |
item
|
FHIRPathCollectionItem
|
The parent collection item. |
required |
index
|
int
|
The index of the element in the parent object. |
required |
label
|
str
|
The label of the element to set. |
required |
Source code in fhircraft/fhir/path/engine/core.py
FHIRPath
Path: fhircraft.fhir.path.engine.core.FHIRPath
Bases: ABC
Abstract base class for FHIRPath expressions.
Methods:
| Name | Description |
|---|---|
values |
Evaluates the FHIRPath expression and returns all resulting values as a list. |
single |
Evaluates the FHIRPath expression and returns a single value. |
first |
Evaluates the FHIRPath expression and returns the first value. |
last |
Evaluates the FHIRPath expression and returns the last value. |
exists |
Checks if the FHIRPath expression matches any values in the data. |
count |
Returns the number of values that match the FHIRPath expression. |
is_empty |
Checks if the FHIRPath expression matches no values in the data. |
update_values |
Evaluates the FHIRPath expression and sets all matching locations to the given value. |
update_single |
Evaluates the FHIRPath expression and sets a single matching location to the given value. |
trace |
Returns a trace of evaluation steps for debugging purposes. |
debug_info |
Returns debugging information about the evaluation. |
evaluate |
Evaluates the current object against the provided FHIRPathCollection. |
values
Evaluates the FHIRPath expression and returns all resulting values as a list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
environment
|
dict | None
|
Optional map of additional variables to include in the evaluation context. |
None
|
Returns:
| Type | Description |
|---|---|
List[Any]
|
List[Any]: A list of all values that match the FHIRPath expression. Returns an empty list if no matches are found. |
Source code in fhircraft/fhir/path/engine/core.py
single
Evaluates the FHIRPath expression and returns a single value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
default
|
Any
|
The default value to return if no matches are found. |
None
|
environment
|
dict | None
|
Optional map of additional variables to include in the evaluation context. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The single matching value. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If more than one value is found. |
Source code in fhircraft/fhir/path/engine/core.py
first
Evaluates the FHIRPath expression and returns the first value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
default
|
Any
|
The default value to return if no matches are found. |
None
|
environment
|
dict | None
|
Optional map of additional variables to include in the evaluation context. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The first matching value, or the default if no matches. |
Source code in fhircraft/fhir/path/engine/core.py
last
Evaluates the FHIRPath expression and returns the last value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
default
|
Any
|
The default value to return if no matches are found. |
None
|
environment
|
dict | None
|
Optional map of additional variables to include in the evaluation context. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The last matching value, or the default if no matches. |
Source code in fhircraft/fhir/path/engine/core.py
exists
Checks if the FHIRPath expression matches any values in the data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
environment
|
dict | None
|
Optional map of additional variables to include in the evaluation context. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if at least one value matches, False otherwise. |
Source code in fhircraft/fhir/path/engine/core.py
count
Returns the number of values that match the FHIRPath expression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
environment
|
dict | None
|
Optional map of additional variables to include in the evaluation context. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The number of matching values. |
Source code in fhircraft/fhir/path/engine/core.py
is_empty
Checks if the FHIRPath expression matches no values in the data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
environment
|
dict | None
|
Optional map of additional variables to include in the evaluation context. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if no values match, False otherwise. |
Source code in fhircraft/fhir/path/engine/core.py
update_values
Evaluates the FHIRPath expression and sets all matching locations to the given value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
value
|
Any
|
The value to set at all matching locations. |
required |
environment
|
dict | None
|
Optional map of additional variables to include in the evaluation context. |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no matching locations are found or if locations cannot be set. |
Source code in fhircraft/fhir/path/engine/core.py
update_single
Evaluates the FHIRPath expression and sets a single matching location to the given value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
value
|
Any
|
The value to set at the matching location. |
required |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If zero or more than one matching locations are found. |
RuntimeError
|
If the location cannot be set. |
Source code in fhircraft/fhir/path/engine/core.py
trace
Returns a trace of evaluation steps for debugging purposes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
verbose
|
bool
|
If True, includes detailed information about each step. |
False
|
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: A list of trace messages showing the evaluation steps. |
Source code in fhircraft/fhir/path/engine/core.py
debug_info
Returns debugging information about the evaluation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to evaluate the FHIRPath expression against. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing debugging information including: - expression: String representation of the FHIRPath expression - expression_type: Type of the FHIRPath expression - input_data_type: Type of the input data - input_data_size: Size/length of input data if applicable - result_count: Number of results from evaluation - result_types: Types of result values - evaluation_success: Whether evaluation completed successfully - error: Error information if evaluation failed - collection_items: Information about FHIRPathCollectionItem objects |
Source code in fhircraft/fhir/path/engine/core.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
evaluate
abstractmethod
Evaluates the current object against the provided FHIRPathCollection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The collection of FHIRPath elements to evaluate. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The result of the evaluation as a FHIRPathCollection. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
This method must be implemented by subclasses. |
Source code in fhircraft/fhir/path/engine/core.py
FHIRPathCollectionItem
Path: fhircraft.fhir.path.engine.core.FHIRPathCollectionItem
dataclass
FHIRPathCollectionItem(value: Any, path: Any = None, element: Optional[str] = None, index: Optional[int] = None, parent: Optional[FHIRPathCollectionItem] = None, setter: Optional[Callable] = None)
Bases: object
A context-aware representation of an item in a FHIRPath collection.
Attributes
value (Any): The value of the collection item. path (Optional[FHIRPath]): The path associated with the collection item, by default This(). element (Optional[str]): The element name of the collection item, by default None. index (Optional[int]): The index of the collection item, by default None. parent (Optional[FHIRPathCollectionItem]): The item of the parent collection from which this item was derived, by default None. setter (Optional[callable]): The setter function for the collection item, by default None.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
|
required |
path
|
Any
|
|
None
|
element
|
str | None
|
|
None
|
index
|
int | None
|
|
None
|
parent
|
ForwardRef | None
|
|
None
|
setter
|
Callable | None
|
|
None
|
Methods:
| Name | Description |
|---|---|
wrap |
Wraps data in a FHIRPathCollectionItem instance. |
set_value |
Sets the value of the item using the setter function. |
construct_resource |
Constructs a FHIR resource based on the field information. |
Attributes:
| Name | Type | Description |
|---|---|---|
field_info |
Retrieves the field information from the parent's value. |
|
is_list_type |
Checks if the field information indicates a list type. |
|
full_path |
Retrieves the full path of the item. |
field_info
property
Retrieves the field information from the parent's value.
Returns:
| Type | Description |
|---|---|
Any
|
The field information, or None if not available. |
is_list_type
property
Checks if the field information indicates a list type.
Returns:
| Type | Description |
|---|---|
bool
|
True if the field information indicates a list type, False otherwise. |
full_path
property
wrap
classmethod
wrap(data: Any) -> FHIRPathCollectionItem
Wraps data in a FHIRPathCollectionItem instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data to be wrapped. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
item |
FHIRPathCollectionItem
|
The wrapped FHIRPathCollectionItem instance. |
Source code in fhircraft/fhir/path/engine/core.py
set_value
Sets the value of the item using the setter function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
The value to set. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the value is a list. |
RuntimeError
|
If there is no setter function associated with this item. |
Source code in fhircraft/fhir/path/engine/core.py
construct_resource
Constructs a FHIR resource based on the field information.
Returns:
| Type | Description |
|---|---|
Any
|
The constructed FHIR resource, or None if construction fails. |
Source code in fhircraft/fhir/path/engine/core.py
FHIRPathFunction
Path: fhircraft.fhir.path.engine.core.FHIRPathFunction
Invocation
Path: fhircraft.fhir.path.engine.core.Invocation
Bases: FHIRPath
A class representing an invocation in the context of FHIRPath evaluation
indicated by two dot-separated identifiers <left>.<right>.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath
|
The left-hand side FHIRPath segment of the invocation. |
right |
FHIRPath
|
The right-hand side FHIRPath segment of the invocation. |
Methods:
| Name | Description |
|---|---|
evaluate |
Performs the evaluation of the Invocation by applying the left-hand side FHIRPath segment on the given collection to obtain a parent collection. |
Source code in fhircraft/fhir/path/engine/core.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Performs the evaluation of the Invocation by applying the left-hand side FHIRPath segment on the given collection to obtain a parent collection. Then, the right-hand side FHIRPath segment is applied on the parent collection to derive the child collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The collection on which the evaluation is performed. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The resulting child collection after the evaluation process. |
Source code in fhircraft/fhir/path/engine/core.py
Literal
Path: fhircraft.fhir.path.engine.core.Literal
Literal(value: Any)
Bases: FHIRPath
A class representation of a constant literal value in the FHIRPath.
Attributes:
| Name | Type | Description |
|---|---|---|
value |
Any
|
The literal value to be represented. |
Methods:
| Name | Description |
|---|---|
evaluate |
Simply returns the input collection. |
Source code in fhircraft/fhir/path/engine/core.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Simply returns the input collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The collection of items to be evaluated. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
A list of FHIRPathCollectionItem instances after evaluation. |
Source code in fhircraft/fhir/path/engine/core.py
RootElement
Path: fhircraft.fhir.path.engine.core.RootElement
RootElement(type: str = 'Resource')
Bases: FHIRPath
A class representing the root of a FHIRPath, i.e. the top-most segment of the FHIRPath whose collection has no parent associated.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
The expected FHIR resource type of the root element, by default. |
Methods:
| Name | Description |
|---|---|
evaluate |
Evaluate the input collection to assert that the entries are valid FHIR resources of the given type. |
Source code in fhircraft/fhir/path/engine/core.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Evaluate the input collection to assert that the entries are valid FHIR resources of the given type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
Collection
|
The collection of items to be evaluated. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
Collection
|
The same collection after validation. |
Source code in fhircraft/fhir/path/engine/core.py
This
Path: fhircraft.fhir.path.engine.core.This
Bases: FHIRPath
A representation of a current element. Used for internal purposes and has no FHIRPath shorthand notation.
Methods:
| Name | Description |
|---|---|
evaluate |
Simply returns the input collection. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Simply returns the input collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The collection of items to be evaluated. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/core.py
TypeSpecifier
Path: fhircraft.fhir.path.engine.core.TypeSpecifier
TypeSpecifier(specifier: str)
Bases: FHIRPath
A type specifier is an identifier that must resolve to the name of a type in a model. Type specifiers can have qualifiers, e.g. FHIR.Patient, where the qualifier is the name of the model.
Attributes:
| Name | Type | Description |
|---|---|---|
specifier |
str
|
The type specifier string. |
namespace |
Optional[str]
|
The namespace of the type specifier, by default "FHIR". |
Methods:
| Name | Description |
|---|---|
evaluate |
Evaluate the input collection to assert that the entries are valid FHIR resources of the given type. |
Source code in fhircraft/fhir/path/engine/core.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Evaluate the input collection to assert that the entries are valid FHIR resources of the given type.
The type is resolved based on the namespace and specifier using the FHIR release specified in the environment
variable %fhirRelease. If the variable is not present, it defaults to "R4" and will warn on usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
Collection
|
The collection of items to be evaluated. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
Collection
|
The same collection after validation. |
Source code in fhircraft/fhir/path/engine/core.py
ContextualIndex
Path: fhircraft.fhir.path.engine.environment.ContextualIndex
Bases: ContextualVariable
A class representation of the FHIRPath $index operator used to represent
the index of an item in the input collection currently under evaluation.
ContextualThis
Path: fhircraft.fhir.path.engine.environment.ContextualThis
Bases: ContextualVariable
A class representation of the FHIRPath $this operator used to represent
the item from the input collection currently under evaluation.
Methods:
| Name | Description |
|---|---|
evaluate |
Evaluates the contextual variable within the given environment. For |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Evaluates the contextual variable within the given environment. For $this, if the variable is not defined in the current context
it returns the current collection being evaluated (for compatibility with the FHIR restricted subset where $this can refer to
any element that has focus).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The collection of items to be evaluated. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
A list of FHIRPathCollectionItem instances after evaluation. |
Source code in fhircraft/fhir/path/engine/environment.py
ContextualTotal
Path: fhircraft.fhir.path.engine.environment.ContextualTotal
Bases: ContextualVariable
A class representation of the FHIRPath $total operator used to represent
an aggregated value over a collection within a context.
ContextualVariable
Path: fhircraft.fhir.path.engine.environment.ContextualVariable
Bases: FHIRPath
A base class for FHIRPath contextual variables such as $this, $index, and $total.
Methods:
| Name | Description |
|---|---|
evaluate |
Evaluates the contextual variable within the given environment. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Evaluates the contextual variable within the given environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The collection of items to be evaluated. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
A list of FHIRPathCollectionItem instances after evaluation. |
Source code in fhircraft/fhir/path/engine/environment.py
EnvironmentVariable
Path: fhircraft.fhir.path.engine.environment.EnvironmentVariable
EnvironmentVariable(variable: str)
Bases: FHIRPathVariable
A class representation of a FHIRPath environmental variables such as %context and %resource.
Methods:
| Name | Description |
|---|---|
evaluate |
Evaluates the contextual variable within the given environment. |
Source code in fhircraft/fhir/path/engine/environment.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Evaluates the contextual variable within the given environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The collection of items to be evaluated. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
A list of FHIRPathCollectionItem instances after evaluation. |
Source code in fhircraft/fhir/path/engine/environment.py
FHIRPathVariable
Path: fhircraft.fhir.path.engine.environment.FHIRPathVariable
Equals
Path: fhircraft.fhir.path.engine.equality.Equals
Bases: FHIRPath
A representation of the FHIRPath = operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns true if the left collection is equal to the right collection: |
Source code in fhircraft/fhir/path/engine/equality.py
evaluate
evaluate(collection: FHIRPathCollection, environment, create: bool = False) -> FHIRPathCollection
Returns true if the left collection is equal to the right collection: As noted above, if either operand is an empty collection, the result is an empty collection. Otherwise: If both operands are collections with a single item, they must be of the same type (or be implicitly convertible to the same type), and: - For primitives: - String: comparison is based on Unicode values - Integer: values must be exactly equal - Decimal: values must be equal, trailing zeroes after the decimal are ignored - Boolean: values must be the same - Date: must be exactly the same - DateTime: must be exactly the same, respecting the timezone offset (though +00:00 = -00:00 = Z) - Time: must be exactly the same - For complex types, equality requires all child properties to be equal, recursively.= If both operands are collections with multiple items: - Each item must be equal - Comparison is order dependent Otherwise, equals returns false. Note that this implies that if the collections have a different number of items to compare, the result will be false.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/equality.py
Equivalent
Path: fhircraft.fhir.path.engine.equality.Equivalent
Bases: FHIRPath
A representation of the FHIRPath ~ operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns true if the collections are the same. In particular, comparing empty collections for equivalence { } ~ { } will result in true. |
Source code in fhircraft/fhir/path/engine/equality.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns true if the collections are the same. In particular, comparing empty collections for equivalence { } ~ { } will result in true. If both operands are collections with a single item, they must be of the same type (or implicitly convertible to the same type), and: - For primitives - String: the strings must be the same, ignoring case and locale, and normalizing whitespace. - Integer: exactly equal - Decimal: values must be equal, comparison is done on values rounded to the precision of the least precise operand. Trailing zeroes after the decimal are ignored in determining precision. - Date, DateTime and Time: values must be equal, except that if the input values have different levels of precision, the comparison returns false, not empty ({ }). - Boolean: the values must be the same - For complex types, equivalence requires all child properties to be equivalent, recursively, except for "id" elements. If both operands are collections with multiple items: - Each item must be equivalent - Comparison is not order dependent Note that this implies that if the collections have a different number of items to compare, or if one input is a value and the other is empty ({ }), the result will be false.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/equality.py
NotEquals
Path: fhircraft.fhir.path.engine.equality.NotEquals
Bases: FHIRPath
A representation of the FHIRPath != operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
The converse of the equals operator, returning true if equal returns false; false if equal |
Source code in fhircraft/fhir/path/engine/equality.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
The converse of the equals operator, returning true if equal returns false; false if equal returns true; and empty ({ }) if equal returns empty. In other words, A != B is short-hand for (A = B).not().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/equality.py
NotEquivalent
Path: fhircraft.fhir.path.engine.equality.NotEquivalent
Bases: FHIRPath
A representation of the FHIRPath !~ operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
The converse of the equivalent operator, returning true if equivalent returns |
Source code in fhircraft/fhir/path/engine/equality.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
The converse of the equivalent operator, returning true if equivalent returns false and false is equivalent returns true. In other words, A !~ B is short-hand for (A ~ B).not().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/equality.py
All
Path: fhircraft.fhir.path.engine.existence.All
All(criteria: FHIRPath | FHIRPathCollection)
Bases: FHIRPathFunction
Representation of the FHIRPath all() function.
Attributes:
| Name | Type | Description |
|---|---|---|
criteria |
FHIRPath
|
Criteria to be applied to the collection prior to the evalution. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
Source code in fhircraft/fhir/path/engine/existence.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns True if for every element in the input collection, criteria evaluates to True.
Otherwise, the result is False. If the input collection is empty ({}), the result is True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/existence.py
AllFalse
Path: fhircraft.fhir.path.engine.existence.AllFalse
Bases: FHIRPathFunction
Representation of the FHIRPath allFalse() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Takes a collection of Boolean values and returns |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/existence.py
AllTrue
Path: fhircraft.fhir.path.engine.existence.AllTrue
Bases: FHIRPathFunction
Representation of the FHIRPath allTrue() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Takes a collection of Boolean values and returns |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/existence.py
AnyFalse
Path: fhircraft.fhir.path.engine.existence.AnyFalse
Bases: FHIRPathFunction
Representation of the FHIRPath anyFalse() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Takes a collection of Boolean values and returns |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/existence.py
AnyTrue
Path: fhircraft.fhir.path.engine.existence.AnyTrue
Bases: FHIRPathFunction
Representation of the FHIRPath anyTrue() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Takes a collection of Boolean values and returns |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/existence.py
Count
Path: fhircraft.fhir.path.engine.existence.Count
Bases: FHIRPathFunction
Representation of the FHIRPath count() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the integer count of the number of items in the input collection. Returns 0 when the input collection is empty. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the integer count of the number of items in the input collection. Returns 0 when the input collection is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/existence.py
Distinct
Path: fhircraft.fhir.path.engine.existence.Distinct
Bases: FHIRPathFunction
Representation of the FHIRPath distinct() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns a collection containing only the unique items in the input collection. If the input collection is empty ( |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns a collection containing only the unique items in the input collection. If the input collection is empty ([]), the result is empty.
Note that the order of elements in the input collection is not guaranteed to be preserved in the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/existence.py
Empty
Path: fhircraft.fhir.path.engine.existence.Empty
Bases: FHIRPathFunction
Representation of the FHIRPath empty() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns True if the input collection is empty ({}) and False otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/existence.py
Exists
Path: fhircraft.fhir.path.engine.existence.Exists
Exists(criteria: FHIRPath | None = None)
Bases: FHIRPathFunction
Representation of the FHIRPath exists() function.
Attributes:
| Name | Type | Description |
|---|---|---|
criteria |
FHIRPath
|
Optional criteria to be applied to the collection prior to the determination of the exists |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
Source code in fhircraft/fhir/path/engine/existence.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
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().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/existence.py
IsDistinct
Path: fhircraft.fhir.path.engine.existence.IsDistinct
Bases: FHIRPathFunction
Representation of the FHIRPath isDistinct() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns True if all the items in the input collection are distinct.
If the input collection is empty ([]), the result is True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Source code in fhircraft/fhir/path/engine/existence.py
SubsetOf
Path: fhircraft.fhir.path.engine.existence.SubsetOf
SubsetOf(other: FHIRPathCollection | FHIRPath)
Bases: FHIRPathFunction
Representation of the FHIRPath subsetOf() function.
Attributes:
| Name | Type | Description |
|---|---|---|
other |
Union[FHIRPathCollection, FHIRPath]
|
other collection to which to determine whether input is a subset of. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
Source code in fhircraft/fhir/path/engine/existence.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns True if all items in the input collection are members of the collection passed as the
other argument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Note
Conceptually, this function is evaluated by testing each element in the input collection for
membership in the other collection, with a default of True. This means that if the input collection
is empty ([]), the result is True, otherwise if the other collection is empty, the result is False.
Source code in fhircraft/fhir/path/engine/existence.py
SupersetOf
Path: fhircraft.fhir.path.engine.existence.SupersetOf
SupersetOf(other: FHIRPathCollection | FHIRPath)
Bases: FHIRPathFunction
Representation of the FHIRPath supersetOf() function.
Attributes:
| Name | Type | Description |
|---|---|---|
other |
Union[FHIRPathCollection, FHIRPath]
|
Other collection to which to determine whether input is a superset of. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns true if all items in the collection passed as the other argument are |
Source code in fhircraft/fhir/path/engine/existence.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns true if all items in the collection passed as the other argument are members of the input collection. Membership is determined using the = (Equals) (=) operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection |
Note
Conceptually, this function is evaluated by testing each element in the other collection for
membership in the input collection, with a default of True. This means that if the other collection
is empty ([]), the result is True, otherwise if the other collection is empty, the result is False.
Source code in fhircraft/fhir/path/engine/existence.py
OfType
Path: fhircraft.fhir.path.engine.filtering.OfType
OfType(_type: TypeSpecifier)
Bases: FHIRPathFunction
Representation of the FHIRPath ofType() function.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
class
|
Type class |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns a collection that contains all items in the input collection that are of the given type |
Source code in fhircraft/fhir/path/engine/filtering.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns a collection that contains all items in the input collection that are of the given type
or a subclass thereof. If the input collection is empty ([]), the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Source code in fhircraft/fhir/path/engine/filtering.py
Repeat
Path: fhircraft.fhir.path.engine.filtering.Repeat
Repeat(projection: FHIRPath)
Bases: FHIRPathFunction
Representation of the FHIRPath repeat() function.
Attributes:
| Name | Type | Description |
|---|---|---|
projection |
FHIRPath
|
Expression to evaluate for each collection item. |
Methods:
| Name | Description |
|---|---|
evaluate |
A version of select that will repeat the projection and add it to the output collection, as |
Source code in fhircraft/fhir/path/engine/filtering.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
A version of select that will repeat the projection and add it to the output collection, as long as the projection yields new items (as determined by the = (Equals) (=) operator).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Source code in fhircraft/fhir/path/engine/filtering.py
Select
Path: fhircraft.fhir.path.engine.filtering.Select
Select(projection: FHIRPath)
Bases: FHIRPathFunction
Representation of the FHIRPath select() function.
Attributes:
| Name | Type | Description |
|---|---|---|
projection |
FHIRPath
|
Expression to evaluate for each collection item. |
Methods:
| Name | Description |
|---|---|
evaluate |
Evaluates the projection expression for each item in the input collection. The result of each |
Source code in fhircraft/fhir/path/engine/filtering.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Evaluates the projection expression for each item in the input collection. The result of each
evaluation is added to the output collection. If the evaluation results in a collection with
multiple items, all items are added to the output collection (collections resulting from
evaluation of projection are flattened). This means that if the evaluation for an element
results in the empty collection ([]), no element is added to the result, and that if the
input collection is empty ([]), the result is empty as well.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Source code in fhircraft/fhir/path/engine/filtering.py
Where
Path: fhircraft.fhir.path.engine.filtering.Where
Where(expression: FHIRPath)
Bases: FHIRPathFunction
Representation of the FHIRPath where() function.
Attributes:
| Name | Type | Description |
|---|---|---|
expression |
FHIRPath
|
Expression to evaluate for each collection item. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns a collection containing only those elements in the input collection for which |
Source code in fhircraft/fhir/path/engine/filtering.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns a collection containing only those elements in the input collection for which
the stated criteria expression evaluates to True. Elements for which the expression
evaluates to false or empty ([]) are not included in the result.
If the input collection is empty ([]), the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Source code in fhircraft/fhir/path/engine/filtering.py
Date
Path: fhircraft.fhir.path.engine.literals.Date
dataclass
Bases: FHIRPathLiteralType
Date(valuestring=None, value_date=None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
|
required |
month
|
int | None
|
|
required |
day
|
int | None
|
|
required |
Source code in fhircraft/fhir/path/engine/literals.py
DateTime
Path: fhircraft.fhir.path.engine.literals.DateTime
dataclass
Bases: FHIRPathLiteralType
DateTime(valuestring: str | None = None, value_datetime: datetime.datetime | None = None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
|
required |
month
|
int | None
|
|
required |
day
|
int | None
|
|
required |
hour
|
int | None
|
|
required |
minute
|
int | None
|
|
required |
second
|
int | None
|
|
required |
millisecond
|
int | None
|
|
required |
hour_shift
|
int | None
|
|
required |
minute_shift
|
int | None
|
|
required |
Source code in fhircraft/fhir/path/engine/literals.py
Quantity
Path: fhircraft.fhir.path.engine.literals.Quantity
dataclass
Bases: FHIRPathLiteralType
Quantity(value: int | float, unit: str | None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int | float
|
|
required |
unit
|
str | None
|
|
required |
Time
Path: fhircraft.fhir.path.engine.literals.Time
dataclass
Bases: FHIRPathLiteralType
Time(valuestring: str | None = None, value_time: datetime.datetime | None = None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hour
|
int
|
|
required |
minute
|
int | None
|
|
required |
second
|
int | None
|
|
required |
millisecond
|
int | None
|
|
required |
hour_shift
|
int | None
|
|
required |
minute_shift
|
int | None
|
|
required |
Source code in fhircraft/fhir/path/engine/literals.py
Abs
Path: fhircraft.fhir.path.engine.math.Abs
Addition
Path: fhircraft.fhir.path.engine.math.Addition
Bases: FHIRMathOperator
A representation of the FHIRPath + operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
For Integer, Decimal, and quantity, adds the operands. For strings, concatenates the right |
Source code in fhircraft/fhir/path/engine/math.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
For Integer, Decimal, and quantity, adds the operands. For strings, concatenates the right operand to the left operand. When adding quantities, the units of each quantity must be the same.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/math.py
Ceiling
Path: fhircraft.fhir.path.engine.math.Ceiling
Div
Path: fhircraft.fhir.path.engine.math.Div
Bases: FHIRMathOperator
A representation of the FHIRPath div operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Performs truncated division of the left operand by the right operand (supported for Integer and Decimal). |
Source code in fhircraft/fhir/path/engine/math.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Performs truncated division of the left operand by the right operand (supported for Integer and Decimal).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/math.py
Division
Path: fhircraft.fhir.path.engine.math.Division
Bases: FHIRMathOperator
A representation of the FHIRPath / operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Divides the left operand by the right operand (supported for Integer, Decimal, and Quantity). |
Source code in fhircraft/fhir/path/engine/math.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
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.
For division involving quantities, the resulting quantity will have the appropriate unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/math.py
Exp
Path: fhircraft.fhir.path.engine.math.Exp
FHIRMathOperator
Path: fhircraft.fhir.path.engine.math.FHIRMathOperator
FHIRPathMathFunction
Path: fhircraft.fhir.path.engine.math.FHIRPathMathFunction
Bases: FHIRPathFunction
Abstract class definition for the category of math FHIRPath functions.
Methods:
| Name | Description |
|---|---|
evaluate |
Computes the computed value based on its argument (supported for Integer, Decimal and Quantity values). |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Computes the computed value based on its argument (supported for Integer, Decimal and Quantity values).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
For non-singleton collections. |
Source code in fhircraft/fhir/path/engine/math.py
Floor
Path: fhircraft.fhir.path.engine.math.Floor
Ln
Path: fhircraft.fhir.path.engine.math.Ln
Log
Path: fhircraft.fhir.path.engine.math.Log
Bases: FHIRPathMathFunction
A representation of the FHIRPath log function.
Attributes:
| Name | Type | Description |
|---|---|---|
base |
int | Literal
|
The base of the logarithm. Must be an integer greater than 1. |
Methods:
| Name | Description |
|---|---|
evaluate |
Computes the logarithm of the input value to the specified base. |
Source code in fhircraft/fhir/path/engine/math.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Computes the logarithm of the input value to the specified base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
For non-singleton collections or invalid base. |
Source code in fhircraft/fhir/path/engine/math.py
Mod
Path: fhircraft.fhir.path.engine.math.Mod
Bases: FHIRMathOperator
A representation of the FHIRPath mod operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Computes the remainder of the truncated division of its arguments (supported for Integer and Decimal). |
Source code in fhircraft/fhir/path/engine/math.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Computes the remainder of the truncated division of its arguments (supported for Integer and Decimal).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/math.py
Multiplication
Path: fhircraft.fhir.path.engine.math.Multiplication
Bases: FHIRMathOperator
A representation of the FHIRPath * operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Multiplies both arguments (supported for Integer, Decimal, and Quantity). For multiplication |
Source code in fhircraft/fhir/path/engine/math.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Multiplies both arguments (supported for Integer, Decimal, and Quantity). For multiplication involving quantities, the resulting quantity will have the appropriate unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/math.py
Power
Path: fhircraft.fhir.path.engine.math.Power
Bases: FHIRPathMathFunction
A representation of the FHIRPath power function.
Attributes:
| Name | Type | Description |
|---|---|---|
exponent |
int | float | Literal
|
The exponent to which the input value is raised. |
Methods:
| Name | Description |
|---|---|
evaluate |
Computes the input value raised to the specified exponent. |
Source code in fhircraft/fhir/path/engine/math.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Computes the input value raised to the specified exponent. Args: collection (FHIRPathCollection): The input collection. environment (dict): The environment context for the evaluation. create (bool): Whether to create new elements during evaluation if necessary. Returns: FHIRPathCollection: The output collection.
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
For non-singleton collections or invalid exponent. |
Source code in fhircraft/fhir/path/engine/math.py
Round
Path: fhircraft.fhir.path.engine.math.Round
Bases: FHIRPathMathFunction
A representation of the FHIRPath round function.
Attributes:
| Name | Type | Description |
|---|---|---|
precision |
int
|
The number of decimal places to round to. |
Methods:
| Name | Description |
|---|---|
evaluate |
Rounds the input value to the specified precision. |
Source code in fhircraft/fhir/path/engine/math.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Rounds the input value to the specified precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
For non-singleton collections or invalid precision. |
Source code in fhircraft/fhir/path/engine/math.py
Sqrt
Path: fhircraft.fhir.path.engine.math.Sqrt
Subtraction
Path: fhircraft.fhir.path.engine.math.Subtraction
Bases: FHIRMathOperator
A representation of the FHIRPath - operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
Subtracts the right operand from the left operand (supported for Integer, Decimal, and Quantity). |
Source code in fhircraft/fhir/path/engine/math.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Subtracts the right operand from the left operand (supported for Integer, Decimal, and Quantity). When subtracting quantities, the units of each quantity must be the same.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/math.py
Truncate
Path: fhircraft.fhir.path.engine.math.Truncate
Children
Path: fhircraft.fhir.path.engine.navigation.Children
Bases: FHIRPathFunction
Representation of the FHIRPath children() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns a collection with all immediate child nodes of all items in the input collection. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns a collection with all immediate child nodes of all items in the input collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Source code in fhircraft/fhir/path/engine/navigation.py
Descendants
Path: fhircraft.fhir.path.engine.navigation.Descendants
Bases: FHIRPathFunction
Representation of the FHIRPath descendants() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns a collection with all descendant nodes of all items in the input collection. The result does not include |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns a collection with all descendant nodes of all items in the input collection. The result does not include the nodes in the input collection themselves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Note
This function is a shorthand for repeat(children()).
Source code in fhircraft/fhir/path/engine/navigation.py
Concatenation
Path: fhircraft.fhir.path.engine.strings.Concatenation
Bases: FHIRPath
A representation of the FHIRPath & operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
right |
FHIRPath | FHIRPathCollection
|
Right operand. |
Methods:
| Name | Description |
|---|---|
evaluate |
For strings, will concatenate the strings, where an empty operand is taken to be the empty string. |
Source code in fhircraft/fhir/path/engine/strings.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
For strings, will concatenate the strings, where an empty operand is taken to be the empty string. This differs from + on two strings, which will result in an empty collection when one of the operands is empty. This operator is specifically included to simplify treating an empty collection as an empty string, a common use case in string manipulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/strings.py
Contains
Path: fhircraft.fhir.path.engine.strings.Contains
Bases: StringManipulationFunction
A representation of the FHIRPath contains() function.
Attributes:
| Name | Type | Description |
|---|---|---|
substring |
str | FHIRPath
|
Substring to query or FHIRPath that resolves to a string. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns true when the given substring is a substring of the input string. |
Source code in fhircraft/fhir/path/engine/strings.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns true when the given substring is a substring of the input string.
If substring is the empty string (''), the result is True.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Note
Note: The FHIRPath .contains() function described here is a string function that looks
for a substring in a string. This is different than the contains FHIRPath operator, which
is a list operator that looks for an element in a list.
Source code in fhircraft/fhir/path/engine/strings.py
EndsWith
Path: fhircraft.fhir.path.engine.strings.EndsWith
Bases: StringManipulationFunction
A representation of the FHIRPath endsWith() function.
Attributes:
| Name | Type | Description |
|---|---|---|
suffix |
str | FHIRPath
|
String suffix to query or FHIRPath that resolves to a string. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns true when the input string ends with the given suffix. |
Source code in fhircraft/fhir/path/engine/strings.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns true when the input string ends with the given suffix.
If suffix is the empty string (''), the result is True.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
IndexOf
Path: fhircraft.fhir.path.engine.strings.IndexOf
Bases: StringManipulationFunction
A representation of the FHIRPath indexOf() function.
Attributes:
| Name | Type | Description |
|---|---|---|
substring |
str | FHIRPath
|
Subtring query or FHIRPath that resolves to a string.. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the 0-based index of the first position substring is found in the input string, |
Source code in fhircraft/fhir/path/engine/strings.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the 0-based index of the first position substring is found in the input string,
or -1 if it is not found.
If substring is an empty string (''), the function returns 0.
If the input or substring is empty ([]), the result is empty ([]).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
Length
Path: fhircraft.fhir.path.engine.strings.Length
Bases: StringManipulationFunction
A representation of the FHIRPath length() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the length of the input string. If the input collection is empty ( |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the length of the input string. If the input collection is empty ([]), the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
Lower
Path: fhircraft.fhir.path.engine.strings.Lower
Bases: StringManipulationFunction
A representation of the FHIRPath lower() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the input string with all characters converted to lower case. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the input string with all characters converted to lower case. If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
Matches
Path: fhircraft.fhir.path.engine.strings.Matches
Bases: StringManipulationFunction
A representation of the FHIRPath matches() function.
Attributes:
| Name | Type | Description |
|---|---|---|
regex |
str | FHIRPath
|
Regular expression to match or FHIRPath that resolves to a string. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns |
Source code in fhircraft/fhir/path/engine/strings.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns True when the value matches the given regular expression. Regular expressions
should function consistently, regardless of any culture- and locale-specific settings
in the environment, should be case-sensitive, use 'single line' mode and allow Unicode characters.
If the input collection or regex are empty, the result is empty ([]).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
Replace
Path: fhircraft.fhir.path.engine.strings.Replace
Replace(pattern: str | FHIRPath | FHIRPathCollection, substitution: str | FHIRPath | FHIRPathCollection)
Bases: StringManipulationFunction
A representation of the FHIRPath replace() function.
Attributes:
| Name | Type | Description |
|---|---|---|
pattern |
str | FHIRPath
|
Substring to substitute or FHIRPath that resolves to a string. |
substitution |
str | FHIRPath
|
String to substitute |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the input string with all instances of |
Source code in fhircraft/fhir/path/engine/strings.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the input string with all instances of pattern replaced with substitution.
If the substitution is the empty string (''), instances of pattern are removed from the result.
If pattern is the empty string (''), every character in the input string is surrounded by
the substitution, e.g. 'abc'.replace('','x') becomes 'xaxbxcx'.
If the input collection, pattern, or substitution are empty, the result is empty ({ }).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
ReplaceMatches
Path: fhircraft.fhir.path.engine.strings.ReplaceMatches
Bases: StringManipulationFunction
A representation of the FHIRPath replaceMatches() function.
Attributes:
| Name | Type | Description |
|---|---|---|
regex |
str | FHIRPath
|
Regular expression to substitute or FHIRPath that resolves to a string. |
substitution |
str | FHIRPath
|
String to substitute |
Methods:
| Name | Description |
|---|---|
evaluate |
Matches the input using the regular expression in regex and replaces each match with the |
Source code in fhircraft/fhir/path/engine/strings.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Matches the input using the regular expression in regex and replaces each match with the
substitution string. The substitution may refer to identified match groups in the regular expression.
If the input collection, regex, or substitution are empty, the result is empty ([]).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
StartsWith
Path: fhircraft.fhir.path.engine.strings.StartsWith
Bases: StringManipulationFunction
A representation of the FHIRPath startsWith() function.
Attributes:
| Name | Type | Description |
|---|---|---|
prefix |
str | FHIRPath
|
String prefix to query or FHIRPath that resolves to a string.. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns true when the input string starts with the given prefix. |
Source code in fhircraft/fhir/path/engine/strings.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns true when the input string starts with the given prefix.
If prefix is the empty string (''), the result is True.
If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
StringManipulationFunction
Path: fhircraft.fhir.path.engine.strings.StringManipulationFunction
Bases: FHIRPathFunction
Abstract class definition for category of string manipulation FHIRPath functions.
Methods:
| Name | Description |
|---|---|
validate_collection |
Validates the input collection of a FHIRPath string manipulation function. |
validate_collection
Validates the input collection of a FHIRPath string manipulation function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
Collection to be validated. |
required |
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
Substring
Path: fhircraft.fhir.path.engine.strings.Substring
Bases: StringManipulationFunction
A representation of the FHIRPath substring() function.
Attributes:
| Name | Type | Description |
|---|---|---|
start |
int | FHIRPath
|
Start index of the substring or FHIRPath that resolves to an integer. |
end |
Optional[int | FHIRPath]
|
Optinoasl, end index of the substring or FHIRPath that resolves to an integer. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the part of the string starting at position start (zero-based). If length is given, will |
Source code in fhircraft/fhir/path/engine/strings.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the part of the string starting at position start (zero-based). If length is given, will
return at most length number of characters from the input string.
If start lies outside the length of the string, the function returns empty ([]). If there are
less remaining characters in the string than indicated by length, the function returns just the
remaining characters.
If the input or start is empty, the result is empty.
If an empty length is provided, the behavior is the same as if length had not been provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
ToChars
Path: fhircraft.fhir.path.engine.strings.ToChars
Bases: StringManipulationFunction
A representation of the FHIRPath toChars() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the list of characters in the input string. If the input collection is empty ( |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the list of characters in the input string. If the input collection is empty ([]), the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
Upper
Path: fhircraft.fhir.path.engine.strings.Upper
Bases: StringManipulationFunction
A representation of the FHIRPath upper() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the input string with all characters converted to upper case. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the input string with all characters converted to upper case. If the input collection is empty, the result is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathError
|
If input collection has more than one item. |
FHIRPathError
|
If the item in the input collection is not a string. |
Source code in fhircraft/fhir/path/engine/strings.py
Exclude
Path: fhircraft.fhir.path.engine.subsetting.Exclude
Exclude(other_collection: FHIRPath | FHIRPathCollection)
Bases: FHIRPathFunction
A representation of the FHIRPath exclude() function.
Attributes:
| Name | Type | Description |
|---|---|---|
other_collection |
FHIRPathCollection
|
The other collection to compute the exclusion with. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the set of elements that are not in the other collection. Duplicate items will not be |
Source code in fhircraft/fhir/path/engine/subsetting.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the set of elements that are not in the other collection. Duplicate items will not be eliminated by this function, and order will be preserved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Source code in fhircraft/fhir/path/engine/subsetting.py
First
Path: fhircraft.fhir.path.engine.subsetting.First
Bases: FHIRPathFunction
A representation of the FHIRPath first() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns a collection containing only the first item in the input collection. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns a collection containing only the first item in the input collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Info
Equivalent to Index(0).
Source code in fhircraft/fhir/path/engine/subsetting.py
Index
Path: fhircraft.fhir.path.engine.subsetting.Index
Bases: FHIRPath
A representation of the FHIRPath index [idx] operator.
Attributes:
| Name | Type | Description |
|---|---|---|
index |
int
|
The index value for the FHIRPath index. |
Methods:
| Name | Description |
|---|---|
evaluate |
The indexer operation returns a collection with only the index-th item (0-based index). If the input |
Source code in fhircraft/fhir/path/engine/subsetting.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
The indexer operation returns a collection with only the index-th item (0-based index). If the input
collection is empty ([]), or the index lies outside the boundaries of the input collection,
an empty collection is returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
create
|
bool
|
Pad the collection array if the index lies out of bounds of the collection. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The indexed collection item. |
Raises:
| Type | Description |
|---|---|
FhirPathError
|
If |
Notes
The collection padding with create=True allows the function to create and later access new elements.
The padded object is initialized based on the collection items' common parent (if exists).
Therefore, this option is only available for a homogeneous collection of items.
Source code in fhircraft/fhir/path/engine/subsetting.py
Intersect
Path: fhircraft.fhir.path.engine.subsetting.Intersect
Intersect(other_collection: FHIRPath | FHIRPathCollection)
Bases: FHIRPathFunction
A representation of the FHIRPath intersect() function.
Attributes:
| Name | Type | Description |
|---|---|---|
other_collection |
FHIRPathCollection
|
The other collection to compute the intersection with. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the set of elements that are in both collections. Duplicate items will be eliminated |
Source code in fhircraft/fhir/path/engine/subsetting.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the set of elements that are in both collections. Duplicate items will be eliminated by this function. Order of items is preserved in the result of this function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Source code in fhircraft/fhir/path/engine/subsetting.py
Last
Path: fhircraft.fhir.path.engine.subsetting.Last
Bases: FHIRPathFunction
A representation of the FHIRPath last() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns a collection containing only the last item in the input collection. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns a collection containing only the last item in the input collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Info
Equivalent to Index(-1).
Source code in fhircraft/fhir/path/engine/subsetting.py
Single
Path: fhircraft.fhir.path.engine.subsetting.Single
Bases: FHIRPathFunction
A representation of the FHIRPath single() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Will return the single item in the input if there is just one item. If the input collection is empty ( |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Will return the single item in the input if there is just one item. If the input collection is empty ([]), the result is empty.
If there are multiple items, an error is signaled to the evaluation environment. This function is useful for ensuring that an
error is returned if an assumption about cardinality is violated at run-time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Info
Equivalent to Index(0) with additional error raising in case of non-singleton input collection.
Source code in fhircraft/fhir/path/engine/subsetting.py
Skip
Path: fhircraft.fhir.path.engine.subsetting.Skip
Bases: FHIRPathFunction
A representation of the FHIRPath skip() function.
Attributes:
| Name | Type | Description |
|---|---|---|
num |
int | FHIRPath
|
The number of items to skip or FHIRPath evaluating to an integer. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns a collection containing all but the first |
Source code in fhircraft/fhir/path/engine/subsetting.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns a collection containing all but the first num items in the input collection. Will return
an empty collection if there are no items remaining after the indicated number of items have
been skipped, or if the input collection is empty. If num is less than or equal to zero, the
input collection is simply returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Source code in fhircraft/fhir/path/engine/subsetting.py
Tail
Path: fhircraft.fhir.path.engine.subsetting.Tail
Bases: FHIRPathFunction
A representation of the FHIRPath tail() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns a collection containing all but the first item in the input collection. Will return |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns a collection containing all but the first item in the input collection. Will return an empty collection if the input collection has no items, or only one item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Source code in fhircraft/fhir/path/engine/subsetting.py
Take
Path: fhircraft.fhir.path.engine.subsetting.Take
Bases: FHIRPathFunction
A representation of the FHIRPath take() function.
Attributes:
| Name | Type | Description |
|---|---|---|
num |
int
|
The number of items to take. |
Methods:
| Name | Description |
|---|---|
evaluate |
Returns a collection containing the first |
Source code in fhircraft/fhir/path/engine/subsetting.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns a collection containing the first num items in the input collection, or less if there
are less than num items. If num is less than or equal to 0, or if the input collection
is empty ([]), take returns an empty collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Type | Description |
|---|---|
FHIRPathCollection
|
FHIRPathCollection): The output collection. |
Source code in fhircraft/fhir/path/engine/subsetting.py
As
Path: fhircraft.fhir.path.engine.types.As
As(left: FHIRPath | FHIRPathCollection, type_specifier: TypeSpecifier)
Bases: FHIRTypesOperator
A representation of the FHIRPath as operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
type_specifier |
str
|
Type specifier. |
Methods:
| Name | Description |
|---|---|
evaluate |
If the left operand is a collection with a single item and the second operand is an identifier, |
Source code in fhircraft/fhir/path/engine/types.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the left operand is a collection with a single item and the second operand is an identifier, this operator returns the value of the left operand if it is of the type specified in the second operand, or a subclass thereof. If the identifier cannot be resolved to a valid type identifier, the evaluator will throw an error. If there is more than one item in the input collection, the evaluator will throw an error. Otherwise, this operator returns the empty collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/types.py
FHIRTypesOperator
Path: fhircraft.fhir.path.engine.types.FHIRTypesOperator
FHIRTypesOperator(left: FHIRPath | FHIRPathCollection, type_specifier: TypeSpecifier)
Bases: FHIRPath
Abstract class definition for the category of types FHIRPath operators.
Source code in fhircraft/fhir/path/engine/types.py
Is
Path: fhircraft.fhir.path.engine.types.Is
Is(left: FHIRPath | FHIRPathCollection, type_specifier: TypeSpecifier)
Bases: FHIRTypesOperator
A representation of the FHIRPath is operator.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
type_specifier |
str
|
Type specifier. |
Methods:
| Name | Description |
|---|---|
evaluate |
If the left operand is a collection with a single item and the second operand is a type identifier, |
Source code in fhircraft/fhir/path/engine/types.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
If the left operand is a collection with a single item and the second operand is a type identifier, this operator returns true if the type of the left operand is the type specified in the second operand, or a subclass thereof. If the input value is not of the type, this operator returns false. If the identifier cannot be resolved to a valid type identifier, the evaluator will throw an error. If the input collections contains more than one item, the evaluator will throw an error. In all other cases this operator returns the empty collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
FHIRPathCollection |
FHIRPathCollection
|
The output collection. |
Raises:
| Type | Description |
|---|---|
FHIRPathRuntimeError
|
If either expression evaluates to a non-singleton collection. |
Source code in fhircraft/fhir/path/engine/types.py
LegacyAs
Path: fhircraft.fhir.path.engine.types.LegacyAs
LegacyAs(type_specifier: TypeSpecifier)
Bases: FHIRPathFunction
The as() function is supported for backwards compatibility with previous implementations of FHIRPath. Just as with the as keyword, the type argument is an identifier that must resolve to the name of a type in a model.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
type_specifier |
str
|
Type specifier. |
Source code in fhircraft/fhir/path/engine/types.py
LegacyIs
Path: fhircraft.fhir.path.engine.types.LegacyIs
LegacyIs(type_specifier: TypeSpecifier)
Bases: FHIRPathFunction
The is() function is supported for backwards compatibility with previous implementations of FHIRPath. Just as with the is keyword, the type argument is an identifier that must resolve to the name of a type in a model.
Attributes:
| Name | Type | Description |
|---|---|---|
left |
FHIRPath | FHIRPathCollection
|
Left operand. |
type_specifier |
str
|
Type specifier. |
Source code in fhircraft/fhir/path/engine/types.py
Now
Path: fhircraft.fhir.path.engine.utility.Now
Bases: FHIRPathFunction
A representation of the FHIRPath now() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the current date and time, including timezone offset. |
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Returns the current date and time, including timezone offset.
Returns:
| Name | Type | Description |
|---|---|---|
DateTime |
FHIRPathCollection
|
The current date and time, including timezone offset. |
Source code in fhircraft/fhir/path/engine/utility.py
TimeOfDay
Path: fhircraft.fhir.path.engine.utility.TimeOfDay
Bases: FHIRPathFunction
A representation of the FHIRPath timeOfDay() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the current time. |
Today
Path: fhircraft.fhir.path.engine.utility.Today
Bases: FHIRPathFunction
A representation of the FHIRPath Today() function.
Methods:
| Name | Description |
|---|---|
evaluate |
Returns the current date. |
Trace
Path: fhircraft.fhir.path.engine.utility.Trace
Bases: FHIRPathFunction
A representation of the FHIRPath trace() function.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
(str | FHIRPath
|
Subtring query or FHIRPath to evaluate for the trace name. |
Methods:
| Name | Description |
|---|---|
evaluate |
Adds a |
Source code in fhircraft/fhir/path/engine/utility.py
evaluate
evaluate(collection: FHIRPathCollection, environment: dict, create: bool = False) -> FHIRPathCollection
Adds a String representation of the input collection to the diagnostic log, using the name argument
as the name in the log. This log should be made available to the user in some appropriate fashion. Does not
change the input, so returns the input collection as output.
If the projection argument is used, the trace would log the result of evaluating the project expression on the input,
but still return the input to the trace function unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
FHIRPathCollection
|
The input collection. |
required |
environment
|
dict
|
The environment context for the evaluation. |
required |
create
|
bool
|
Whether to create new elements during evaluation if necessary. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
collection |
FHIRPathCollection
|
The input collection. |