client-py
client-py copied to clipboard
API include / revinclude functionality
I couldn't find anything in the library mapping to the API capability of _include
or _revinclude
.
For example, on the UHN test server, I can run the following query to get all Compositions and their corresponding Patients: http://fhirtest.uhn.ca/baseDstu2/Composition?_include=Composition:patient
Should the library support this notion?
You mean you'd like to have a way to specify _include
and _revinclude
? That is certainly a good idea and I'm open to suggestions!
On a related note, resolving references within a Bundle
is not yet supported. This is definitely something we want to add to FHIRReference (which hails from fhir-parser).
Ah, so supporting the resolution of references within a Bundle
could possibly give the client user the ability to specify which related references they would like to access when they make their initial queries.
For example, maybe a syntax that would be nice to support could be this:
p = Patient.where({'id': '1000'}).include(Observation)
for observation in p.observations:
print observation
Then the references are pre-fetched with a single API call with an _include
queryparam, and can be naturally accessed within the application.
The Resource.where()
method returns a FHIRSearch
instance. Yes, would be feasible to add an include()
method to that class to support this notion, then one could call perform(server)
to execute the search. 👍🏼