Filters a tbl_spark using either a FHIRPath boolean expression or a FHIR search query
string, returning a tbl_spark containing only the matching rows. The DataFrame must be the
first argument to enable piping with %>%.
pathling_filter(df, pc, resource_type, expression, type = "fhirpath")A tbl_spark containing FHIR resource data.
The PathlingContext object.
A string containing the FHIR resource type code (e.g., "Patient", "Observation").
The filter expression. For type = "fhirpath", a FHIRPath boolean
expression (e.g., "gender = 'male'"). For type = "search", a FHIR search query string
(e.g., "gender=male&birthdate=ge1990-01-01").
The type of expression: "fhirpath" (default) or "search".
A tbl_spark containing only the rows matching the expression.
Other context functions:
pathling_evaluate_fhirpath(),
pathling_fhirpath_to_column(),
pathling_search_to_column(),
pathling_with_column()
if (FALSE) { # \dontrun{
pc <- pathling_connect()
data_source <- pc %>% pathling_read_ndjson(pathling_examples("ndjson"))
patients <- data_source %>% ds_read("Patient")
# Filter using a FHIRPath expression.
male_patients <- patients %>%
pathling_filter(pc, "Patient", "gender = 'male'")
# Filter using a FHIR search expression.
male_patients <- patients %>%
pathling_filter(pc, "Patient", "gender=male", type = "search")
pathling_disconnect(pc)
} # }