Filtering
The filtering module contains the object representations of the filtering-category FHIRPath functions.
OfType
Bases: FHIRPathFunction
Representation of the FHIRPath ofType()
function.
Attributes:
Name | Type | Description |
---|---|---|
type |
class
|
Type class |
Source code in fhircraft/fhir/path/engine/filtering.py
evaluate(collection)
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 |
List[FHIRPathCollectionItem]
|
The input collection. |
required |
Returns:
Type | Description |
---|---|
List[FHIRPathCollectionItem]
|
List[FHIRPathCollectionItem]): The output collection. |
Source code in fhircraft/fhir/path/engine/filtering.py
Repeat
Bases: FHIRPathFunction
Representation of the FHIRPath repeat()
function.
Attributes:
Name | Type | Description |
---|---|---|
projection |
FHIRPath
|
Expression to evaluate for each collection item. |
Source code in fhircraft/fhir/path/engine/filtering.py
evaluate(collection, create=False)
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 |
List[FHIRPathCollectionItem]
|
The input collection. |
required |
create |
bool
|
Whether to auto-generate missing path segments. |
False
|
Returns:
Type | Description |
---|---|
List[FHIRPathCollectionItem]
|
List[FHIRPathCollectionItem]): The output collection. |
Source code in fhircraft/fhir/path/engine/filtering.py
Select
Bases: FHIRPathFunction
Representation of the FHIRPath select()
function.
Attributes:
Name | Type | Description |
---|---|---|
projection |
FHIRPath
|
Expression to evaluate for each collection item. |
Source code in fhircraft/fhir/path/engine/filtering.py
evaluate(collection, create=False)
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 |
List[FHIRPathCollectionItem]
|
The input collection. |
required |
create |
bool
|
Whether to auto-generate missing path segments. |
False
|
Returns:
Type | Description |
---|---|
List[FHIRPathCollectionItem]
|
List[FHIRPathCollectionItem]): The output collection. |
Source code in fhircraft/fhir/path/engine/filtering.py
Where
Bases: FHIRPathFunction
Representation of the FHIRPath where()
function.
Attributes:
Name | Type | Description |
---|---|---|
expression |
FHIRPath
|
Expression to evaluate for each collection item. |
Source code in fhircraft/fhir/path/engine/filtering.py
evaluate(collection, create=False)
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 |
List[FHIRPathCollectionItem]
|
The input collection. |
required |
create |
bool
|
Whether to auto-generate missing path segments. |
False
|
Returns:
Type | Description |
---|---|
List[FHIRPathCollectionItem]
|
List[FHIRPathCollectionItem]): The output collection. |