You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

FHIR批量导入请求报400错误及本地文件导入方案咨询

Azure FHIR Server批量导入请求问题求助

我最近参考FHIR Bulk Import规范文档,尝试用Python代码向Azure FHIR Server发起批量导入请求,但请求一直返回400 Bad Request,想请教两个问题:

问题背景

我写的Python代码如下:

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	\"type\": \"Patient\",\r\n\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'))

我已经尝试过两个请求URL:

  • https://<fhir-server-name>.azurehealthcareapis.com/$import
  • https://<fhir-server-name>.azurehealthcareapis.com/Patient/$import

目前我用Apache托管了patient_ndjson.ndjson文件,HTTP和HTTPS都能正常访问,文件内容是三个Patient资源的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"}

我的疑问

  1. 能不能不用HTTP服务器托管文件,直接让请求指向本地的NDJSON文件来完成导入?
  2. 能不能给我一个针对Azure FHIR Server的可用批量导入示例请求,包括正确的URL、请求体、头部信息这些内容?

内容的提问来源于stack exchange,提问作者srinath

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 13:57:36