Converts a FHIRPath expression into a Spark Column that can be used in DataFrame operations such as filtering and selection. Boolean expressions can be used for filtering, while other expressions can be used for value extraction.

pathling_fhirpath_to_column(pc, resource_type, fhirpath_expression)

Arguments

pc

The PathlingContext object.

resource_type

A string containing the FHIR resource type code (e.g., "Patient", "Observation").

fhirpath_expression

A FHIRPath expression to evaluate (e.g., "gender = 'male'", "name.given.first()").

Value

A Spark Column object (spark_jobj) representing the evaluated expression.

Details

The expression should evaluate to a single value per resource row.

Examples

if (FALSE) { # \dontrun{
pc <- pathling_connect()
data_source <- pc %>% pathling_read_ndjson(pathling_examples("ndjson"))
patients <- data_source %>% ds_read("Patient")

# Filter patients using a boolean FHIRPath expression.
filtered <- patients %>%
  pathling_filter(pc, "Patient", "gender = 'male'")

# Value expression for selection.
name_col <- pathling_fhirpath_to_column(pc, "Patient", "name.given.first()")

pathling_disconnect(pc)
} # }