将批量数据发送到 Azure FHIR 服务器

Sending bulk data to Azure FHIR Server

我正在尝试处理包含超过 20000 条患者信息的 csv 文件。总共有 50 列,每个患者将有多行作为其每小时数据。大多数列属于观察资源类型。比如心率、体温、血压。

我已成功将数据转换为 FHIR 格式。然而,当我尝试将数据推送到 FHIR 服务器中时,服务器抛出一个错误,指出数据最多只能有 500 个条目。

即使我等待多达 500 个条目并推送 json 文件,它也需要相当多的时间来掩盖 20000 * 50 。有什么有效的方法可以将数据批量插入 azure fhir 服务器吗?

目前,我正在使用以下代码。但看起来它会花费相当多的时间和资源。因为我的 csv 文件中有大约 70 万行。

def export_template(self, template):
     if self.export_max_500 is None:
         self.export_max_500 = template
     else:
         export_max_500_entry = self.export_max_500["entry"]
         template_entry = template["entry"]
         self.export_max_500["entry"] = export_max_500_entry + template_entry
         if len(self.export_max_500["entry"]) > 500:
             template["entry"] = self.export_max_500["entry"][:495]
             self.export_max_500["entry"] = self.export_max_500["entry"][495:]
             self.send_to_server(template)

最有效的方法是不发送多个(批)包。其实就是并行做很多个单独的请求运行。您的问题是您按顺序发送这些并且对往返时间造成巨大影响。你可以看看类似这个加载器的东西:https://github.com/hansenms/FhirLoader,它并行化请求。您还需要增加服务的 RU,以确保您有足够的吞吐量来获取数据。