Takes a dataframe with string representations of FHIR bundles in the given column and outputs a dataframe of encoded resources.

pathling_encode_bundle(pc, df, resource_name, input_type = NULL, column = NULL)

Arguments

pc

A Pathling context object.

df

A Spark DataFrame containing the bundles with the resources to encode.

resource_name

The name of the FHIR resource to extract (Condition, Observation, etc.).

input_type

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

column

The column in which the resources to encode are stored. If 'NULL', then 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()

Examples

pc <- pathling_connect()
json_resources_df <- pathling_spark(pc) %>% 
     sparklyr::spark_read_text(path=system.file('extdata','bundle-xml', package='pathling'), 
         whole = TRUE)
pc %>% pathling_encode_bundle(json_resources_df, 'Condition',
     input_type = MimeType$FHIR_XML, column = 'contents')
#> # Source:   table<`sparklyr_tmp_0e92cbd4_cc5d_46bc_a67a_60d7f209a923`> [?? x 31]
#> # Database: spark_connection
#>    id                 id_versioned meta  implicitRules language text  identifier
#>    <chr>              <chr>        <lis> <chr>         <chr>    <lis> <list>    
#>  1 2383c155-6345-e84… Condition/2… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  2 ccda8fb3-9f37-268… Condition/c… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  3 9d95d044-b2e6-0ee… Condition/9… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  4 5779b272-9e1b-317… Condition/5… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  5 a7988e15-0bb4-ffe… Condition/a… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  6 aebcc0e1-2ab0-2b9… Condition/a… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  7 857dc2db-94b9-73e… Condition/8… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  8 f2dac999-8ef5-8c3… Condition/f… <lgl> NA            NA       <lgl> <lgl [1]> 
#>  9 4987db3c-2ef4-b32… Condition/4… <lgl> NA            NA       <lgl> <lgl [1]> 
#> 10 217b8864-fed8-617… Condition/2… <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)