1

https://github.com/smart-on-fhir/bulk-import/blob/master/import.md

I used above link for reference and tried to run import using the following code

import requests

url = "https://<fhir-server-name>.azurehealthcareapis.com/$import"

payload = "{\r\n\t\"inputFormat\": \"application/fhir+ndjson\",\r\n\t\"inputSource\": \"https://localhost\",\r\n\t\"storageDetail\": { \"type\": \"https\" },\r\n\t\"input\": [\r\n\t{\r\n\t\t\"type\": \"Patient\",\r\n\t\t\"url\": \"https://localhost/patient_ndjson.ndjson\"\r\n\t}\r\n\t]\r\n}"
headers = {
  'Accept': 'application/fhir+json',
  'Prefer': 'respond-async',
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <Auth Token>'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))

i am receiving 400 Bad Request . i tried posting to both

url = "https://<fhir-server-name>.azurehealthcareapis.com/$import"
url = "https://<fhir-server-name>.azurehealthcareapis.com/Patient/$import"

I used apache for hosting the file and the file is accessible with both http and https.. Instead of importing it using http server, is there any way to directly point to my local ndjson file ?

patient_ndjson.ndjson contains

{"resourceType":"Patient","id":"8c76dfe7-2b94-497b-9837-8315b150ac0e","meta":{"versionId":"1","lastUpdated":"2020-04-27T11:08:10.611+00:00"},"active":true,"name":[{"use":"official","family":"p000001"}],"gender":"female","birthDate":"2020-04-27T11:00:00+05:30"}
{"resourceType":"Patient","id":"bfab05c7-d36a-4b5a-a0d6-6efb1da0fb3d","meta":{"versionId":"1","lastUpdated":"2020-04-27T11:34:43.83+00:00"},"active":true,"name":[{"use":"official","family":"p000001"}],"gender":"female","birthDate":"2020-04-27T11:00:00+05:30"}
{"resourceType":"Patient","id":"4c314eb1-6309-424b-affc-197fb0131cf6","meta":{"versionId":"1","lastUpdated":"2020-04-27T12:09:20.777+00:00"},"active":true,"name":[{"use":"official","family":"p000002"}],"gender":"female","birthDate":"2020-04-27T03:00:00+05:30"}

Can you please provide some sample request . it would be helpful.

srinath
  • 2,748
  • 6
  • 35
  • 56
  • Please note that the "$import" operation you linked to at https://github.com/smart-on-fhir/bulk-import/blob/master/import.md is a proposed specification; it's not standardized and not currently supported by production FHIR servers. – Bosh Apr 29 '20 at 15:12
  • :-( So, in azure fhir api, there is no way to bulk import the data ? with the restriction of 500 max entries in json, i have around 60000 requests and each request is consuming more than 10 to 20 seconds for me. – srinath Apr 29 '20 at 16:28

1 Answers1

1

$import is a draft spec and it is not supported (yet) on the Azure API for FHIR.

MichaelHansen
  • 656
  • 3
  • 7
  • Can you suggest any other way of bulk importing the data. As i mentioned, i have hourly data and i have more than 60000 requests – srinath Apr 29 '20 at 16:51
  • You have this question too: https://stackoverflow.com/questions/61483216/sending-bulk-data-to-azure-fhir-server/61491452. That is the answer just send the data in through the API. The $import operation would have to do something similar, it is really just a question of whether you orchestrate it or the server does it for you. – MichaelHansen Apr 29 '20 at 16:59
  • Fine.. i will try to increase the RU's and post the data. – srinath Apr 29 '20 at 17:01
  • https://stackoverflow.com/questions/61484200/inserting-multiple-observation-values-in-single-resource-fhir . I am not going to do many search operations on the data. if that being the case, is there any way, i can have array of values in observation . Now, for heart- rate of 100 hours, i am creating 100 resources. Instead, if i can have one resource, in which value is represented as array, it would drastically reduce my request count. Can you guide me on how to have observation values as array ? – srinath Apr 29 '20 at 17:05
  • You can use sampledata or components in the Observation – MichaelHansen Apr 30 '20 at 17:25