aidbox.bulk data import
aidbox.bulk/* RPC operations

Overview

aidbox.bulk API uses Aidbox JSON RPC API
Features of the aidbox.bulk API:
  • Asynchronous validation of uploaded resources & references
  • Human readable validation errors
  • Can process Aidbox & FHIR format

RPC methods

aidbox.bulk/import-start

Starts aidbox.bulk import
Parameters
Result
Error
Object with the following structure:
  • format input resources format, fhir or aidbox (default: fhir)
  • meta meta data that will be attached to each of the imported resources
  • on-conflict action to resolve id uniqueness constraint violation, update or override
  • input array of objects
    • url string with input source url
Returns input params object with following attributes added:
  • status in-progress, finished, failed
  • count overall number of imported resources
  • time import execution time
  • input the import status of each specific input
    • status loaded, validated, failed
    • count number of loaded resources
    • errors number of validation errors
    • time input execution time
  • message "There is running import - wait until it finish or cancel it with aidbox.bulk/import-cancel"
  • import object identical to result object

Example

Request
Response
1
POST /rpc
2
content-type: text/yaml
3
accept: text/yaml
4
5
method: aidbox.bulk/import-start
6
params:
7
on-conflict: update
8
id_prefix: app1
9
format: fhir
10
meta: {source: app1}
11
input:
12
- {url: 'https://storage.googleapis.com/aidbox-public/synthea/100/corrupted-patient.ndjson.gz'}
Copied!
status: 200
1
result:
2
on-conflict: update
3
id_prefix: app1
4
format: fhir
5
meta: {source: app1}
6
input:
7
- {url: 'https://storage.googleapis.com/aidbox-public/synthea/100/corrupted-patient.ndjson.gz', status: loaded, count: 124, errors: 1, time: 157}
8
status: failed
9
errors: 1
10
time: 241
Copied!

aidbox.bulk/import-status

Returns latest aidbox.bulk import info
Parameters
Result
Error
Expects no parameters
Same as aidbox.bulk/import-start result
message "No active imports"

Example

Request
Response
1
POST /rpc
2
content-type: text/yaml
3
accept: text/yaml
4
5
method: aidbox.bulk/import-status
6
params: {}
Copied!
Status: 200
1
result:
2
on-conflict: update
3
id_prefix: app1
4
format: fhir
5
meta:
6
source: app1
7
input:
8
- url: >-
9
https://storage.googleapis.com/aidbox-public/synthea/100/Patient.ndjson.gz
10
status: loaded
11
count: 124
12
errors: 0
13
time: 1205
14
status: finished
15
count: 0
16
time: 1452
Copied!

aidbox.bulk/import-errors

Returns latest aidbox.bulk import detailed errors list
Parameters
Result
Error
Expects no parameters
Result is an array of objects with following structure:
  • input_no
  • line_no
  • type
  • id
  • resource
  • errors
message "No active imports"

Example

Request
Response
1
POST /rpc
2
content-type: text/yaml
3
accept: text/yaml
4
5
method: aidbox.bulk/import-errors
6
params:
7
omit-resources?: true
Copied!
Status: 200
1
result:
2
- input_no: 0
3
line_no: 1
4
type: Patient
5
id: e9adac47-eb98-4fce-b871-512226086c97
6
errors:
7
- path:
8
- name
9
- 0
10
- given
11
message: expected array
12
- input_no: 0
13
line_no: 20
14
type: Patient
15
id: b2d58f0f-4499-4392-ad3a-1c2141c8a6c1
16
errors:
17
- path:
18
- address
19
- 0
20
- line
21
message: expected array
Copied!

aidbox.bulk/import-cancel

Cancels latest aidbox.bulk import
Parameters
Result
Error
Expects no parameters
Returns object with following structure:
  • message "Import canceled"
  • import Same as aidbox.bulk/import-start result
message "No active imports"

Example

Request
Response
1
POST /rpc
2
content-type: text/yaml
3
accept: text/yaml
4
5
method: aidbox.bulk/import-cancel
Copied!
Status: 200
1
result:
2
message: "Import Canceled"
3
import: <. . .>
Copied!