fhirBulkClient {RonFHIR} | R Documentation |
fhirBulkClient
Description
Bulk data client in R for FHIR STU 3.
Usage
bulkclient <- fhirBulkClient$new(endpoint, tokenURL = NULL, token = NULL) bulkclient$patientExport(criteria = NULL) bulkclient$groupExport(groupId, criteria = NULL) bulkclient$wholeSystemExport(criteria = NULL) bulkclient$getBulkStatus() bulkclient$downloadBulk(requestNumber, returnType = "parsed" ,deleteFromQueue = TRUE) bulkclient$deleteBulkRequest(requestNumber) bulkclient$retrieveToken(jwt, scopes, tokenURL = NULL) bulkclient$setToken(token) print(bulkclient)
Arguments
- bulkclient
A
fhirBulkClient
object.- endpoint
The URL of the server to connect to.
- tokenURL
Authorization server’s endpoint.
- token
Acces token.
- criteria
The search parameters to filter the Resources on. Each given string is a combined key/value pair (separated by '=').
- groupId
Id of the Group resource.
- requestNumber
Number of the request in the queue.
- returnType
Specify the return type. This can be "parsed" or "ndjson".
- deleteFromQueue
If the request needs to be deleted from the queue after it's been downloaded.
- jwt
JSON Web Token signed with the app's private key (RSA SHA-256).
- scopes
Desired scope(s).
Details
$new()
Creates a new fhirBulkClient using a given endpoint.
If the endpoint does not end with a slash (/), it will be added.
$patientExport()
Request all data on all patients. Possible to filter the results with the _outputFormat, _since and _type parameters. The request will be added to the queue.
$groupExport()
Request all data of a patientgroup. Possible to filter the results with the _outputFormat, _since and _type parameters. The request will be added to the queue.
$wholeSystemExport()
Request all data. Possible to filter the results with the _outputFormat, _since and _type parameters. The request will be added to the queue.
$getBulkStatus()
Update and return the queue to see the progress of your requests.
$downloadBulk()
Download a request from the queue.
$deleteBulkRequest()
Cancel a request from the queue.
$retrieveToken()
Retrieve a token from the authentication server.
$setToken
Set a token.
print(p)
or p$print()
Shows which endpoint is configured.
Examples
## Not run:
# Read your private key
privatekey <- openssl::read_key("PrivateKey.pem")
# Create your claim
claim <- jose::jwt_claim(iss = "ServiceURL",
sub = "ClientID",
aud = "TokenURL",
# expiration date as epoch (5 minutes)
exp = as.integer(as.POSIXct( Sys.time() + 300)),
# 'random' number
jti = charToRaw(as.character(runif(1, 0.5, 100000000000))))
# Sign your claim with your private key
jwt <- jose::jwt_encode_sig(claim, privatekey)
# Define your scope(s)
scopes <- c("system/*.read", "system/CommunicationRequest.write")
# Create a new fhirBulkClient
bulkclient <- fhirBulkClient$new("FHIRBulkServerURL", tokenURL = "TokenURL")
# Retrieve your token
token <- bulkclient$retrieveToken(jwt, scopes)
# Set your token
bulkclient$setToken(token$access_token)
# Request a download for Patient Cohort 3
bulkclient$groupExport(3)
# Request the progress of the requests
bulkclient$getBulkStatus()
# When the downloads a available, download the bulkdata
patient_cohort_3 <- bulkclient$downloadBulk(1)
View(patient_cohort_3)
## End(Not run)