nazrulworld / fhir.resources

FHIR Resources https://www.hl7.org/fhir/resourcelist.html
https://pypi.org/project/fhir.resources/
Other
372 stars 104 forks source link

how to use the 'server' attribute? #44

Closed themantalope closed 3 years ago

themantalope commented 3 years ago

Hi all,

This is a really amazing library. I'm a physician, and I'm starting to learn about FHIR and how to use it and this library has been a great starting place.

I'm having a hard time finding documentation on the 'server' attribute that is found in many objects. For example if I create a new patient:

data = {'name':{'given':['Bob'], 'family':'Smith'}}
new_p = Patient(**data)

There is now a new_p.server attribute. I would like to know if I set the server attribute am I able to then just call new_p.create() to create an instance on the server? Or if I want to find patients on a server do I just set the search parameters in a Patient object and then call .search().

For context, I've been learning how to post and search for FHIR objects on a locally running HAPI FHIR server with this docker image.

Any help is much appreciated.

EDIT I now realize that I was using an old version of the library. I would like to know if similar functionality is available in the current version that from the master branch on this repository ('6.0.0b11').

nazrulworld commented 3 years ago

Hi @themantalope This is the library is the pure python representation of https://www.hl7.org/fhir/resourcelist.html. There is no attribute like create, search. I think you can use this https://pypi.org/project/requests/ library to connect to the server (create and search)

You can use fhir.resources to validate incoming data or validate data before creating a resource for the server.

themantalope commented 3 years ago

Thanks for letting me know!