Evaluates a FHIRPath expression and adds the result as a named column to a tbl_spark,
returning the augmented tbl_spark. The DataFrame must be the first argument to enable
piping with %>%. Multiple calls can be chained to add several columns.
pathling_with_column(df, pc, resource_type, expression, column)A tbl_spark with the new column added.
Other context functions:
pathling_evaluate_fhirpath(),
pathling_fhirpath_to_column(),
pathling_filter(),
pathling_search_to_column()
if (FALSE) { # \dontrun{
pc <- pathling_connect()
data_source <- pc %>% pathling_read_ndjson(pathling_examples("ndjson"))
patients <- data_source %>% ds_read("Patient")
# Add a single column.
result <- patients %>%
pathling_with_column(pc, "Patient", "name.given.first()", column = "given_name")
# Chain multiple columns.
result <- patients %>%
pathling_with_column(pc, "Patient", "name.given.first()", column = "given_name") %>%
pathling_with_column(pc, "Patient", "gender", column = "gender_value") %>%
dplyr::select(id, given_name, gender_value)
pathling_disconnect(pc)
} # }