Takes a Spark DataFrame with string representations of FHIR resources in the given column and encodes the resources of the given types as Spark DataFrame.
pathling_encode(pc, df, resource_name, input_type = NULL, column = NULL)
The Pathling context object.
A Spark DataFrame containing the resources to encode.
The name of the FHIR resource to extract (e.g., "Condition", "Observation").
The MIME type of input string encoding. Defaults to "application/fhir+json".
The column in which the resources to encode are stored. If set to NULL, the input DataFrame is assumed to have one column of type string.
A Spark DataFrame containing the given type of resources encoded into Spark columns.
Other encoding functions:
pathling_encode_bundle()
pc <- pathling_connect()
json_resources_df <- pathling_spark(pc) %>%
sparklyr::spark_read_text(path=system.file('extdata','ndjson', 'Condition.ndjson',
package='pathling'))
pc %>% pathling_encode(json_resources_df, 'Condition')
#> # Source: table<`sparklyr_tmp_c643e16a_f02e_46b3_a353_38039965f35c`> [?? x 31]
#> # Database: spark_connection
#> id id_versioned meta implicitRules language text
#> <chr> <chr> <list> <chr> <chr> <list>
#> 1 c879c300-7fdf-… Condition/c… <named list> NA NA <named list>
#> 2 bb9c4fc1-795a-… Condition/b… <named list> NA NA <named list>
#> 3 e620d7ee-6cfe-… Condition/e… <named list> NA NA <named list>
#> 4 0447de38-1f2a-… Condition/0… <named list> NA NA <named list>
#> 5 4025ceb3-04a6-… Condition/4… <named list> NA NA <named list>
#> 6 7ed34fb1-0bbf-… Condition/7… <named list> NA NA <named list>
#> 7 5ef84858-0480-… Condition/5… <named list> NA NA <named list>
#> 8 5378726d-7f2b-… Condition/5… <named list> NA NA <named list>
#> 9 31393667-dd7f-… Condition/3… <named list> NA NA <named list>
#> 10 6464e20b-55ec-… Condition/6… <named list> NA NA <named list>
#> # ℹ more rows
#> # ℹ 25 more variables: identifier <list>, clinicalStatus <list>,
#> # verificationStatus <list>, category <list>, severity <list>, code <list>,
#> # bodySite <list>, subject <list>, encounter <list>, onsetAge <list>,
#> # onsetDateTime <chr>, onsetPeriod <list>, onsetRange <list>,
#> # onsetString <chr>, abatementAge <list>, abatementDateTime <chr>,
#> # abatementPeriod <list>, abatementRange <list>, abatementString <chr>, …
pathling_disconnect(pc)