Operation: Bulk Import
The IG supports the use of the FHIR Bulk Import (by manifest) operation to rapidly import a large amount of data. The Bulk Import operation is a draft specification defined at the following URL: https://github.com/smart-on-fhir/bulk-import/blob/master/import-manifest.md
Request Flow
Bulk Data Import Kick-Off Request
To initiate a Bulk Import operation, the /$import operation should be executed against the server base URL.
POST [fhir base]/$import
Headers
- Content-Type: application/json (fixed value, required)
- Accept: application/fhir+json (fixed value, required)
- Prefer: respond-async (fixed value, required)
Body JSON Fields
inputFormat
(string, required)Servers SHALL support Newline Delimited JSON with a format type of
application/fhir+ndjson
but MAY choose to support additional input formats.inputSource
(uri, optional)URI for tracking this set of imported data throughout its lifecycle. MAY be used to specify a FHIR endpoint that can by the importing system when matching references to previously imported data.
input
(json array, required), array of objects containing the following fields- type (string, required) FHIR resource type
- url (url, required) Path to bulk data file of the type reflected in inputFormat containing FHIR resources
storageDetail
(object, optional) - Defaults to type of "https" with no parameters specifiedtype (string, required)
Parameters depending on type:
type parameter https
- contentEncoding
(array of strings, optional)aws-s3
gcp-bucket
azure-blob
Request Payload
The request body is a Parameters resource, and the request must include a directive requesting asynchronous processing.
Refer the Parameters (Parameters Submission) profile for PHSD Bulk Import.
Below is a sample request payload:
{
"resourceType": "Parameters",
"parameter": [
{
"name": "inputFormat",
"valueCode": "application/fhir+ndjson"
},
{
"name": "storageDetail",
"part": [
{
"name": "type",
"valueCode": "https"
},
{
"name": "credentialHttpBasic",
"valueString": "admin:password"
}
]
},
{
"name": "input",
"part": [
{
"name": "type",
"valueCode": "Practitioner"
},
{
"name": "url",
"valueUri": "https://example.com/practitioner.ndjson"
}
]
},
{
"name": "input",
"part": [
{
"name": "type",
"valueCode": "Location"
},
{
"name": "url",
"valueUri": "https://example.com/location.ndjson"
}
]
}
]
}
FOR DISCUSSION
Response - Success
- HTTP Status Code of 202 Accepted
- Content-Location header with the absolute URL of an endpoint for subsequent status requests (polling location)
- Optionally, a FHIR OperationOutcome resource in the body
Response - Error
HTTP Status Code of 4XX or 5XX
The body SHALL be a FHIR OperationOutcome resource in JSON format
If a server wants to prevent a client from beginning a new import before an in-progress import is completed, it SHOULD respond with a 429 Too Many Requests status and a Retry-After header, following the rate-limiting advice for "Bulk Data Import Status Request" below.
OR
Assuming the request is successfully accepted by the server, the server will respond with a payload resmbling the following:
{
"resourceType": "OperationOutcome",
"issue": [ {
"severity": "information",
"code": "informational",
"diagnostics": "Bulk import job has been submitted with ID: c9398169-aed3-49b1-ac42-0967564bc38c"
} ]
}
Sample NDJSON for PractitionerRole:
{"resourceType":"PractitionerRole",id":"29517",meta.profile":["http://ehealthontario.ca/fhir/StructureDefinition/ca-on-ppr-practitioner-response-profile-PractitionerRole|1.0.0"],meta.security":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Confidentiality","code":"N","display":"normal"}],extension":[{"url":"http://ehealthontario.ca/fhir/StructureDefinition/ca-on-ppr-ext-location-affiliation","extension":[{"url":"type","valueCodeableConcept":{"coding":[{"system":"http://ehealthontario.ca/fhir/CodeSystem/ppr-provider-role-affiliation-type","code":"B25","display":"Billing - Bill"}]}},{"url":"period","valuePeriod":{"start":"1995-08-01"}},{"url":"with","extension":[{"url":"name","valueString":"RAMROOPSINGH MEDICINE PROFESSIONAL CORP"}]}]},{"url":"http://ehealthontario.ca/fhir/StructureDefinition/ca-on-ppr-ext-practitionerRole-practicing","valueBoolean":true}],identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0203","code":"PRN"}]},"system":"https://fhir.infoway-inforoute.ca/NamingSystem/ca-on-provider-upi","value":"101626551226"},{"use":"secondary","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0203","code":"PRN"}]},"system":"https://fhir.infoway-inforoute.ca/NamingSystem/ca-on-provider-upi","value":"160083369738"},{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0203","code":"LN"}]},"system":"https://fhir.infoway-inforoute.ca/NamingSystem/ca-on-license-physician","value":"62959"},{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0203","code":"LN"}]},"system":"https://fhir.infoway-inforoute.ca/NamingSystem/ca-on-license-physician","value":"62959"}],period.start":"2014-03-05",practitioner.reference":"Practitioner/28217",code":[{"extension":[{"url":"http://ehealthontario.ca/fhir/StructureDefinition/ca-on-ppr-ext-practitionerRole-classification","valueCodeableConcept":{"coding":[{"system":"http://ehealthontario.ca/FHIR/CodeSystem/ppr-provider-role-class-type","code":"RH","display":"Regulated Health Professional"}]}},{"url":"http://ehealthontario.ca/fhir/StructureDefinition/ca-on-ppr-ext-LicenseClassificationCode","valueCoding":{"system":"http://ehealthontario.ca/fhir/CodeSystem/ppr-license-classification-code","code":"25","display":"Restricted -CPSO"}}],"coding":[{"system":"http://ehealthontario.ca/fhir/CodeSystem/ppr-health-care-provider-role-type","code":"MD","display":"Medical Doctor"}]}],specialty":[{"extension":[{"url":"http://ehealthontario.ca/fhir/StructureDefinition/ca-on-ppr-ext-practitionerRole-specialty-period","valuePeriod":{"start":"2020-05-06"}},{"url":"http://ehealthontario.ca/fhir/StructureDefinition/ca-on-ppr-ext-practitionerRole-classification","valueCodeableConcept":{"coding":[{"system":"http://ehealthontario.ca/FHIR/CodeSystem/ppr-provider-role-class-type","code":"SP","display":"Specialty"}]}}],"coding":[{"system":"http://snomed.info/sct","code":"394577000","display":"Anesthetics"}]},{"extension":[{"url":"http://ehealthontario.ca/fhir/StructureDefinition/ca-on-ppr-ext-practitionerRole-classification","valueCodeableConcept":{"coding":[{"system":"http://ehealthontario.ca/FHIR/CodeSystem/ppr-provider-role-class-type","code":"SP","display":"Specialty"}]}}],"coding":[{"system":"http://snomed.info/sct","code":"394577000","display":"Anesthetics"}]}],location":[{"reference":"Location/29517-1"},{"reference":"Location/29517-2"},{"reference":"Location/29517-3"},{"reference":"Location/29517-4"},{"reference":"Location/29517-5"},{"reference":"Location/29517-6"},{"reference":"Location/29517-7"},{"reference":"Location/29517-8"},{"reference":"Location/29517-9"},{"reference":"Location/29517-10"},{"reference":"Location/29517-11"}],"search.mode":"include"}
Data Requirements
Data must be one of the following sets:
- PractitionerRole
- Practitioner
- Organization
- Location
- Healthcare Service
PractitionerRole Bulk Import
Refer the PractitionerRole (PractitionerRole Submission) for PHSD Bulk Import.
Practitioner Bulk Import
Refer the Practitioner (Practitioner Submission) profile for PHSD Bulk Import.
Organization Bulk Import
Refer the Organization (Organization Submission) profile for the PHSD Bulk Import.
Location Bulk Import
Refer the Location (Location Submission) profile for the PHSD Bulk Import.
Healthcare Service Bulk Import
Refer the Healthcare Service (Healthcare Service Submission) profile for the PHSD Bulk Import.
Response Payload
Assuming the request is successfully accepted by the server, the server will respond with a payload resmbling the following:
{
"resourceType": "OperationOutcome",
"issue": [ {
"severity": "information",
"code": "informational",
"diagnostics": "Bulk import job has been submitted with ID: c9398169-aed3-49b1-ac42-0967564bc38c"
} ]
}
After a bulk data import request has been started, a client MAY send a DELETE request to the URL provided in the Content-Location header to cancel the request.
Endpoint DELETE [polling content location]
Response - Success
- HTTP Status Code of 202 Accepted
- Optionally a FHIR OperationOutcome resource in the body
Response - Error Status
- HTTP status code of 4XX or 5XX
- The body SHALL be a FHIR OperationOutcome resource in JSON format