首页 > 解决方案 > 将批量数据发送到 Azure FHIR 服务器

问题描述

我正在尝试处理包含超过 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)

标签: hl7-fhirfhir-server-for-azure

解决方案


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


推荐阅读