Executes an extract query over FHIR data. This type of query extracts specified columns from FHIR resources in a tabular format.

ds_extract(ds, subject_resource, columns, filters = NULL)

Arguments

ds

The DataSource object containing the data to be queried.

subject_resource

A string representing the type of FHIR resource to extract data from.

columns

A named list of FHIRPath expressions that define the columns to include in the extract.

filters

An optional sequence of FHIRPath expressions that can be evaluated against each resource in the data set to determine whether it is included within the result. The expression must evaluate to a Boolean value. Multiple filters are combined using AND logic.

Value

A Spark DataFrame containing the extracted data.

See also

Examples

pc <- pathling_connect()
data_source <- pc %>% pathling_read_ndjson(pathling_examples('ndjson'))
data_source %>% ds_extract('Patient',
     columns = c('gender', givenName='name.given'),
     filters = c('birthDate > @1950-01-01')
)
#> # Source:   table<`sparklyr_tmp_76ee1a1d_3aed_478d_a734_ce28de5f3337`> [10 x 2]
#> # Database: spark_connection
#>    gender givenName  
#>    <chr>  <chr>      
#>  1 female Karina848  
#>  2 female Karina848  
#>  3 male   Pedro316   
#>  4 male   Guy979     
#>  5 male   Shirley182 
#>  6 male   Gilberto712
#>  7 male   Seymour882 
#>  8 female Su690      
#>  9 female Cherryl901 
#> 10 female Ophelia894 
pathling_disconnect(pc)