Open dennisbrox opened 2 years ago
fhir.resources version 6.4, python 3.10.1, Win 10 I've been trying to add a list of resources to bundle.entry with bundle .type = 'collection' and nothing works. That is: BundleEntry.resource won't let me assign a person resource, bundle.entry doesn't allow append. No problem doing this in C# but the python validation is confusing. What is the exact syntax for adding 2 observations, say obs1 and obs2 to the bundle entry field? Thanks.
@dennisbrox can you please give us your code example? (maybe a gist link or directly past here)
Some of a few things I've tried:
from fhir.resources.bundle import Bundle from fhir.resources.bundle import BundleEntry from fhir.resources.person import Person . . . bundle = Bundle.construct() p = Person.construct()
. . . bundle.type = "collection" be = BundleEntry.construct()
bundle.entry.append(be) - doesn't work, no append method, equivalent works in C# as it knows entry is a list bundle.entry = [be] - works , no error at runtime bundle.entry = [p] - validation error of course
and be.resource = p - doesn't work, resource attribute doesn't exist even if it is in the BundleEntry class be = p - doesn't give an exception but bundle.entry = [be] does not validate of course
problem is to create a list of resources to assign to bundle.entry
It works in fhirclient the way it's supposed to. Slightly different syntax between fhir.resources and fhirclient of course. p_entry = BundleEntry() p_entry.resource = p c_entry = BundleEntry() c_entry.resource = c b.entry = [p_entry, c_entry]
So both fhirclient and firely in C# work the way they are supposed to. If fhir.resources doesn't work, it would be useful to be warned of that in github.
@dennisbrox thanks for your update. I am extremely busy these days, will look at this soon as possible.
@dennisbrox I got some time to check your statements. Here are my results.
I would suggest, you could create a python file and create your failed (except no. 1) examples and share here.
Description
Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.
What I Did