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)

Arguments

pc

The Pathling context object.

df

A Spark DataFrame containing the resources to encode.

resource_name

The name of the FHIR resource to extract (e.g., "Condition", "Observation").

input_type

The MIME type of input string encoding. Defaults to "application/fhir+json".

column

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.

Value

A Spark DataFrame containing the given type of resources encoded into Spark columns.

See also

Other encoding functions: pathling_encode_bundle()

Examples

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_c2bee0c3_15ae_4517_aee5_423b5f934e7f`> [?? x 31]
#> # Database: spark_connection
#>    id                 id_versioned meta  implicitRules language text  identifier
#>    <chr>              <chr>        <lis> <chr>         <chr>    <lis> <list>    
#>  1 c879c300-7fdf-4b5… Condition/c… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  2 bb9c4fc1-795a-449… Condition/b… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  3 e620d7ee-6cfe-4f0… Condition/e… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  4 0447de38-1f2a-411… Condition/0… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  5 4025ceb3-04a6-41f… Condition/4… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  6 7ed34fb1-0bbf-4c4… Condition/7… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  7 5ef84858-0480-4a3… Condition/5… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  8 5378726d-7f2b-4c8… Condition/5… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  9 31393667-dd7f-4c9… Condition/3… <lgl> NA            NA       <lgl> <lgl [1]> 
#> 10 6464e20b-55ec-468… Condition/6… <lgl> NA            NA       <lgl> <lgl [1]> 
#> # ℹ more rows
#> # ℹ 24 more variables: 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>, recordedDate <chr>, …
pathling_disconnect(pc)