我正在使用fhirclient (Smart ) python库,并成功地创建了一个包和单个资源。我假设" bundle“类中有帮助器方法,允许我向包中添加资源,但我似乎不太明白如何做到这一点。例如,我有类似于(伪代码)的内容:
b = fhirclient.Bundle()
p = fhirclient.Patient()
c = fhirclient.Claim()
# Now I want to add my patient (p) and claim (c) to the bundle (b)由于捆绑包包含列表元素"entry“,所以我所需要做的就是追加如下资源:
b.entry.append(p)
b.entry.append(c)但这不管用。我得到的信息是:"AttributeError:'NoneType‘对象没有属性'append’。
发布于 2017-06-02 17:59:22
您将希望使用以下流程创建条目:
p_entry = BundleEntry()
p_entry.resource = p
c_entry = BundleEntry()
c_entry.resource = c
b.entry = [p_entry, c_entry]使用from fhircilent.models.bundle import BundleEntry
https://stackoverflow.com/questions/44334181
复制相似问题