-
Notifications
You must be signed in to change notification settings - Fork 0
Bulk Data Export Workflow
Note: The bulk data work on this server is very much a work in progress, and may change as the specification evolves and is tested further.
The server exposes an /$export endpoint. The following sections outline the workflow for bulk export on this server, assuming that the server is being run on localhost:3001.
Request
GET http://localhost:3001/$export
Response
Status: 202 Accepted
Content-Location: http://localhost:3001/bulkstatus/<unique-id>
When the kickoff request is accepted, a new job is added to the bulk data job processing queue.
To poll for the status of the export request, send a GET request to the Content-Location endpoint specified from the kickoff response:
Request
GET http://localhost:3001/bulkstatus/<unique-id>
Response
Status: 202 Accepted
X-Progress: "Retrieving export files"
Retry-After: 120
When the job is still in progress, the client will be told to retry after a certain amount of time. When the job is finished, subsequent status requests will respond with the output of the bulk export:
Request
GET http://localhost:3001/bulkstatus/<unique-id>
Response
Status: 200 OK
{
"transactionTime": "<datetime of transaction>",
"requiresAccessToken": false,
"output": [
{
"type": "Encounter",
"url": "http://localhost:3001/<unique-id>/Encounter.ndjson"
}
]
}
The resources will now be present in the server's MongoDB database. Note that the output array may contain multiple urls that contain the resource types that are exported. To view the exported ndjson, send a GET request to the url in the output array:
GET http://localhost:3001/<unique-id>/Encounter.ndjson