R/context.R
pathling_evaluate_fhirpath.RdEvaluates 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
)The PathlingContext object.
A string containing the FHIR resource type code (e.g., "Patient", "Observation").
A string containing the FHIR resource as JSON.
A FHIRPath expression to evaluate (e.g., "name.family", "gender = 'male'").
An optional context expression string. If provided, the main expression is evaluated once for each result of the context expression. Defaults to NULL.
An optional named list of variables available via %variable syntax.
Defaults to NULL.
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()
if (FALSE) { # \dontrun{
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)
} # }