Links
Comment on page

Bulk Data $export

FHIR is normally used to enable access to data one patient or resource at a time, but new FHIR Bulk Data APIs (which use the FHIR $export operator) are making population level data transfer and analytics possible.

FHIR $export Operator

Request the analytics bulk-data endpoint with the FHIR $export operator to retrieve a list of bulk data files for your client application to download.

Bulk $export - Access Token

Use this endpoint to export bulk data for a given 1up user using the FHIR® $export operator. This initial request returns a list of download files, which can be individually requested to retrieve the data.
This request relies on having an Access Token obtained via Auth APIs (first get an authorization code, then exchange for an access token for a 1up user). See below for alternative client header auth $export option.
curl --location --request GET 'https://analytics.xxxxfhir.com/bulk-data/r4/$export' \
--header 'Authorization: Bearer {{accessToken}}'

Bulk $export - Client Header

Use this endpoint to export bulk data for all your client ID's 1up users' FHIR data using the FHIR® $export operator. This initial request returns a list of download files, which can be individually requested to retrieve the data. This relies on using your client ID and client secret in the header of your request.
curl --location --request GET 'https://analytics.xxxxfhir.com/bulk-data/r4/$export' \
--header 'client_id: xxx' \
--header 'client_secret: yyy' \
--header 'x-oneup-user-id: client'

Search Parameters

For FHIR R4 only we support the following search parameters:
Parameter
Description
Example
_type
Allows you to specify which types of resources will be included in the response.
For example, _type=Encounter would return only Encounter resources
analytics.{{baseUrl}}/bulk-data/r4/$export?_type=Encounter
e.g. analytics.1up.health/bulk-data/r4/$export?_type=Encounter
_since
Resources will only be included in the response if their state has changed after the supplied time (e.g. if Resource.meta.lastUpdated is later than the supplied _since time).
analytics.1up.health/bulk-data/r4/$export?_since=2021-01-01
Sample response output by the Bulk Data API:
{
"transactionTime": "2021-05-12T16:51:13.561Z",
"request": "https://analytics.1up.health/bulk-data/r4/$export",
"requiresAccessToken": true,
"output": [
{
"type": "AllergyIntolerance",
"url": "https://analytics.1up.health/bulk-data/r4/$export/AllergyIntolerance/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjo0LCJ1c2VySWQiOiIxMjM2NzUwNDkifQ.aOqtYWB9Xaup4R80pGjjl4gyaQV9SXRmZaqmnBHp2oI.ndjson"
},
{
"type": "Condition",
"url": "https://analytics.1up.health/bulk-data/r4/$export/Condition/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjoxMjAxLCJ1c2VySWQiOiIxMjM2NzUwNDkifQ.LcsXvPEnC0vNr1OwIUi4j98qjRxbT-99dr739r7mjrE.ndjson"
},
{
"type": "Procedure",
"url": "https://analytics.1up.health/bulk-data/r4/$export/Procedure/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjoxMywidXNlcklkIjoiMTIzNjc1MDQ5In0.2qEoEMEzMng0ws33jvWzqLfLQnstluA2BbkDAd1605U.ndjson"
},
{
"type": "MedicationOrder",
"url": "https://analytics.1up.health/bulk-data/r4/$export/MedicationOrder/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjo0MSwidXNlcklkIjoiMTIzNjc1MDQ5In0.NdLjPwLte_tvWN5nnaA5YMGw11NrKP_gd6mzXDTeII4.ndjson"
},
{
"type": "MedicationStatement",
"url": "https://analytics.1up.health/bulk-data/r4/$export/MedicationStatement/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjo1MywidXNlcklkIjoiMTIzNjc1MDQ5In0.2M1jLqkjN6uR3L9ISsWsJr5S8aj_rNannoHVC2iiEzU.ndjson"
},
{
"type": "Immunization",
"url": "https://analytics.1up.health/bulk-data/r4/$export/Immunization/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjo0LCJ1c2VySWQiOiIxMjM2NzUwNDkifQ.aOqtYWB9Xaup4R80pGjjl4gyaQV9SXRmZaqmnBHp2oI.ndjson"
},
{
"type": "Observation",
"url": "https://analytics.1up.health/bulk-data/r4/$export/Observation/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjo0MTYsInVzZXJJZCI6IjEyMzY3NTA0OSJ9.9MzsFPH0aWs85fuiFPv7TTSZftbQ2uYqZB1mrvgD_b8.ndjson"
},
{
"type": "DiagnosticReport",
"url": "https://analytics.1up.health/bulk-data/r4/$export/DiagnosticReport/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjozLCJ1c2VySWQiOiIxMjM2NzUwNDkifQ.Fpgzt5vbwdtj8ngj7YuOZ_ngZnwZSr0dQunZIrK05c4.ndjson"
},
{
"type": "Patient",
"url": "https://analytics.1up.health/bulk-data/r4/$export/Patient/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjoxLCJ1c2VySWQiOiIxMjM2NzUwNDkifQ.aiEJoxsOPrr3QMmgVmV2AWUXKIxhREElfFSCHUpRuks.ndjson"
},
{
"type": "RelatedPerson",
"url": "https://analytics.1up.health/bulk-data/r4/$export/RelatedPerson/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjoyLCJ1c2VySWQiOiIxMjM2NzUwNDkifQ.tFsPhGTH_LxHwSY8eE9i_DHU9hrxBcFYMjGi5MsjEuU.ndjson"
},
{
"type": "Encounter",
"url": "https://analytics.1up.health/bulk-data/r4/$export/Encounter/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjo0OCwidXNlcklkIjoiMTIzNjc1MDQ5In0.SlnbTyNdWuT_-k_RGHVn6ytWpDrrucuq71FeYvjQijs.ndjson"
},
{
"type": "DocumentReference",
"url": "https://analytics.1up.health/bulk-data/r4/$export/DocumentReference/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjoyODAsInVzZXJJZCI6IjEyMzY3NTA0OSJ9.txQ-_wmL9ybXMrLMprpQZ3heYbsvKYmhHODJQHbzWlI.ndjson"
}
]
}

Handling NDJSON Response

For accessing the .ndjson files either an access token or client credential headers is required, this can't be done in a browser, one can inject an access token using API test tools such as Postman.or cURL
The response will contain a set of links to Newline Delimited JSON (NDJSON) files for various FHIR Resource Types. Each NDJSON link in response will contain only one FHIR Resource type. but can contain 1000s of individual FHIR Resources. Depending on how much data is being exported, there may even be multiple NDJSON links for a single Resource Type.
To consume the NDJSON contents, you would follow one of the links in the response using either an access token, or client credentials headers. For example in the sample response above, using client credential headers:
curl --location --request GET 'https://analytics.{baseUrl}/bulk-data/r4/$export/AllergyIntolerance/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjo0LCJ1c2VySWQiOiIxMjM2NzUwNDkifQ.aOqtYWB9Xaup4R80pGjjl4gyaQV9SXRmZaqmnBHp2oI.ndjson' \
--header 'client_id: xxx'\
--header 'client_secret: yyy'\
--header 'x-oneup-user-id: client'
or with access token like:
curl --location --request GET 'https://analytics.{baseUrl}/bulk-data/r4/$export/AllergyIntolerance/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdGFydCI6ImU0NiIsInRvdGFsIjo0LCJ1c2VySWQiOiIxMjM2NzUwNDkifQ.aOqtYWB9Xaup4R80pGjjl4gyaQV9SXRmZaqmnBHp2oI.ndjson' \
--header 'Authorization: Bearer {accessToken}'