FHIR 的批量导入请求
Bulk Import Request for FHIR
https://github.com/smart-on-fhir/bulk-import/blob/master/import.md
我使用上面的 link 作为参考,并尝试使用以下代码 运行 导入
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'))
我收到 400 错误请求。我试着发帖给
url = "https://<fhir-server-name>.azurehealthcareapis.com/$import"
url = "https://<fhir-server-name>.azurehealthcareapis.com/Patient/$import"
我使用 apache 托管该文件,并且可以通过 http 和 https 访问该文件。有没有办法直接指向我的本地 ndjson 文件,而不是使用 http 服务器导入它 ?
patient_ndjson.ndjson 包含
{"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"}
能否请您提供一些样品请求。这会很有帮助。
$import
是一个草案规范,Azure API 上(尚)不支持 FHIR。
https://github.com/smart-on-fhir/bulk-import/blob/master/import.md
我使用上面的 link 作为参考,并尝试使用以下代码 运行 导入
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'))
我收到 400 错误请求。我试着发帖给
url = "https://<fhir-server-name>.azurehealthcareapis.com/$import"
url = "https://<fhir-server-name>.azurehealthcareapis.com/Patient/$import"
我使用 apache 托管该文件,并且可以通过 http 和 https 访问该文件。有没有办法直接指向我的本地 ndjson 文件,而不是使用 http 服务器导入它 ?
patient_ndjson.ndjson 包含
{"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"}
能否请您提供一些样品请求。这会很有帮助。
$import
是一个草案规范,Azure API 上(尚)不支持 FHIR。