pathling_fhirpath_to_column: Convert a FHIRPath expression to a Spark Column

View source: R/context.R

pathling_fhirpath_to_columnR Documentation

Convert a FHIRPath expression to a Spark Column

Description

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.

Usage

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()").

Details

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

Value

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

See Also

Other context functions: pathling_evaluate_fhirpath(), pathling_filter(), pathling_search_to_column(), pathling_with_column()

Examples

## Not run: 
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)

## End(Not run)

pathling documentation built on June 3, 2026, 9:08 a.m.