fhir_url | R Documentation |
This function creates an object of class fhir_url which mostly represents a URL-encoded URL for a FHIR search request. A valid Search URL contains a base URL and a resource type and may contain additional search parameters. For more info on FHIR search see https://www.hl7.org/fhir/search.html.
fhir_url(url, resource, parameters, url_enc = TRUE)
## S4 method for signature 'character,missing,missing'
fhir_url(url, url_enc = TRUE)
## S4 method for signature 'character,character,missing'
fhir_url(url, resource, url_enc = TRUE)
## S4 method for signature 'character,character,character'
fhir_url(url, resource, parameters, url_enc = TRUE)
## S4 method for signature 'character,character,list'
fhir_url(url, resource, parameters, url_enc = TRUE)
url |
A character of length one specifying either the full search request,
e.g. |
resource |
A character of length one or fhir_resource_type object with the resource type to be searched, e.g. |
parameters |
Optional. Either a length 1 character containing properly formatted FHIR search parameters, e.g.
|
url_enc |
Should the url be URL-encoded? Defaults to |
You can use this function in two ways. If you provide just one string in the argument url with the full FHIR search request, this string
will be taken as a full FHIR search request. If you also provide the arguments resource
and/or parameters
, the string in url
will be taken
as the base url of your FHIR server and the arguments will be concatenated appropriately to form the full request. See examples.
Note that only the latter approach does a validity check on the resource type!
You can disable URL-encoding by setting url_enc=FALSE
.
An object of class fhir_url
#provide full FHIR search request
fhir_url(url = "http://hapi.fhir.org/baseR4/Patient?gender=male&_summary=count")
#provide base url and resource type
fhir_url(
url = "http://hapi.fhir.org/baseR4",
resource = "Patient"
)
#parameters in one string
fhir_url(
url = "http://hapi.fhir.org/baseR4",
resource = "Patient",
parameters = "gender=male&_summary=count"
)
#parameters as a named character
fhir_url(
url = "http://hapi.fhir.org/baseR4",
resource = "Patient",
parameters = c("gender" = "male", "_summary" = "count")
)
#parameters as a named list
fhir_url(
url = "http://hapi.fhir.org/baseR4",
resource = "Patient",
parameters = list("gender" = "male", "_summary" = "count")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.