Aidbox
Search…
⌃K

$import & /fhir/$import

$import is an implementation of the upcoming FHIR Bulk Import API. This is an asynchronous Operation, which returns url to monitor progress. There are two versions of this operation - /fhir/$import accepts data in FHIR format, /$import works with Aidbox format.

Resource requirements for all import operations:

Operation
id
resourceType
/$import
Required
Not required
/fhir/$import
Required
Not required
Keep in mind that $import does not validate inserted resources for the sake of performance. Pay attention to the structure of data you insert and use the correct URL for your data format, i.e.: use /fhir prefix for FHIR data.
Please consider using Asynchronous validation API to validate data after $import

Example

Request
Response
POST /fhir/$import
Accept: text/yaml
Content-Type: text/yaml
id: synthea
contentEncoding: gzip
inputs:
- resourceType: Encounter
url: https://storage.googleapis.com/aidbox-public/synthea/100/Encounter.ndjson.gz
- resourceType: Organization
url: https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz
- resourceType: Patient
url: https://storage.googleapis.com/aidbox-public/synthea/100/Patient.ndjson.gz
200
You can monitor progress by using id you provided in request body.
GET /BulkImportStatus/synthea
If you didn't provide id in request body, you can use content-location in response header.

Parameters

Parameter
Description
id
Identifier of the import
contentEncoding
Supports gzip or plain (non-gzipped .ndjson files)
inputs
Resources to import
update
Update history for updated resources (false by default)

Note

For performance reasons $import does raw upsert into resource table without history update. If you want to store the previous version of resources in history, please set update = true
With this flag Aidbox will update history for updated resources. For each resource:
  • if resource was not present in DB before the import, the import time will be the same.
  • if resource was present in DB before and it's updated during the import, it will double the time importing this resource because of additional insert operation into _history table.