| pathling_evaluate_fhirpath | R Documentation |
Evaluates a FHIRPath expression against a single FHIR resource provided as a JSON string and returns materialised typed results. The resource is encoded into a one-row Spark Dataset internally, and the existing FHIRPath engine is used to evaluate the expression.
pathling_evaluate_fhirpath(
pc,
resource_type,
resource_json,
fhirpath_expression,
context_expression = NULL,
variables = NULL
)
pc |
The PathlingContext object. |
resource_type |
A string containing the FHIR resource type code (e.g., "Patient", "Observation"). |
resource_json |
A string containing the FHIR resource as JSON. |
fhirpath_expression |
A FHIRPath expression to evaluate (e.g., "name.family", "gender = 'male'"). |
context_expression |
An optional context expression string. If provided, the main expression is evaluated once for each result of the context expression. Defaults to NULL. |
variables |
An optional named list of variables available via |
A list with two elements:
resultsA list of lists, each containing type (character) and
value (the materialised R value or NULL).
expectedReturnTypeA character string indicating the inferred return type.
Other context functions:
pathling_fhirpath_to_column(),
pathling_filter(),
pathling_search_to_column(),
pathling_with_column()
## Not run:
pc <- pathling_connect()
patient_json <- '{"resourceType": "Patient", "id": "example", "gender": "male"}'
result <- pathling_evaluate_fhirpath(pc, "Patient", patient_json, "gender")
for (entry in result$results) {
cat(entry$type, ": ", entry$value, "\n")
}
pathling_disconnect(pc)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.