fhir_capability_statement: Get capability statement

View source: R/download_resources.R

fhir_capability_statementR Documentation

Get capability statement

Description

Get the capability statement of a FHIR server.

This function downloads a capability statement and creates three data.frames from it:

  • Meta contains general information on the server

  • Rest contains information on the Rest operations the server supports

  • Resources contains information on the supported resource types

When there is more than one piece of information regarding a variable in these data.frames, they are divided by the string specified in sep. If brackets is not NULL, those entries will also be assigned indices so you can melt them using fhir_melt().

Usage

fhir_capability_statement(
  url = "https://hapi.fhir.org/baseR4",
  username = NULL,
  password = NULL,
  token = NULL,
  add_headers = NULL,
  brackets = NULL,
  sep = " ::: ",
  log_errors = NULL,
  verbose = deprecated()
)

Arguments

url

The base URL of the FHIR server.

username

A character vector of length one containing the username for basic authentication. Defaults to NULL, meaning no authentication.

password

A character vector of length one containing the password for basic authentication. Defaults to NULL, meaning no authentication.

token

A character vector of length one or object of class httr::Token, for bearer token authentication (e.g. OAuth2). See fhir_authenticate() for how to create this.

add_headers

A named character vector of custom headers to add to the HTTP request, e.g. c(myHeader = "somevalue") or c(firstHeader = "value1", secondHeader = "value2").

brackets

A character vector of length two defining the brackets surrounding indices for multiple entries, e.g. c( "[", "]"). Defaults to NULL. If NULL, no indices will be added to multiple entries.

sep

A character vector of length one to separate pasted multiple entries

log_errors

Either NULL or a character vector of length one indicating the name of a file in which to save the http errors. NULL means no error logging. When a file name is provided, the errors are saved in the specified file. Defaults to NULL

verbose

[Deprecated]

Value

A list of data frames containing the information from the statement

Examples

## Not run: 
#without indices
cap <- fhir_capability_statement(url = "https://server.fire.ly")

#with indices
cap <- fhir_capability_statement(url = "https://server.fire.ly",
                                 brackets = c("[","]"),
                                 sep = " || ")

#melt searchInclude variable
resources <- fhir_melt(cap$Resources,
                       columns = "searchInclude",
                       brackets = c("[", "]"),
                       sep = " || ",
                       all_columns = FALSE)

#remove indices
resources <- fhir_rm_indices(resources, brackets = c("[", "]"))

head(resources)

## End(Not run)

POLAR-fhiR/fhircrackr documentation built on Dec. 24, 2024, 3:06 a.m.