FHIR Chat · FHIR Python server/client · implementers

Stream: implementers

Topic: FHIR Python server/client


view this post on Zulip Abhi Pratap (Sep 21 2016 at 14:23):

Hi Folks - Can anyone point me to the recommended FHIR server/client implementation using Python. Thanks! - Abhi

view this post on Zulip Pascal Pfiffner (Sep 23 2016 at 06:07):

Not sure I can call it _recommended_, but we're maintaining a Python client: https://github.com/smart-on-fhir/client-py/

view this post on Zulip Pascal Pfiffner (Sep 23 2016 at 06:14):

See the develop branch for STU-3 (1.6) data models.

view this post on Zulip Viet Nguyen (Jun 28 2017 at 19:05):

Hi Pascal - We're using the FHIR Python client in an informatics workshop at the University of Utah. I wanted to thank you, Josh, Nikolai and all the contributors for putting this together. The examples in the docs are very helpful to getting started. We have a number of clinicians (like me) with limited coding experience who are learning Python. Retrieving data elements from core resources seems straight forward. I was wondering if there are additional examples of python scripts available for more advanced functions? Thanks!

view this post on Zulip Pascal Pfiffner (Jul 03 2017 at 04:16):

Glad to hear it! I'm afraid we don't have good "advanced" material on the topic, but I'm thinking you might get great answers if you ask specific questions here.

view this post on Zulip Viet Nguyen (Jul 05 2017 at 21:19):

@Pascal Pfiffner

I was able to create a value set called "DiabetesExamples" on the HAPI DSTU3 server using clinFHIR. I can read both the value set resource and expansion via

https://fhirtest.uhn.ca/baseDstu3/ValueSet/DiabetesExamples
https://fhirtest.uhn.ca/baseDstu3/ValueSet/DiabetesExamples/$expand

I want to retrieve the SNOMED codes from the expansion and create a list of the diabetes codes. I will then compare a patient's problem list codes against this list to determine if they have diabetes. I'm struggling with how to read the value set expansion and the relationship between valueset.ValueSet, valueset.ValueSetExpansion and valueset.ValuesetExpansionContains. I'm able to read the ValueSet resource, but I can't seem to get to the expansion. Sorry if this is a noob question. TIA

Here's my current code:

from fhirclient import client
import fhirclient.models.valueset as vs

# Define the FHIR Endpoint
settings = {
'app_id': 'my_web_app',
'api_base': 'https://fhirtest.uhn.ca/baseDstu3'
}
smart = client.FHIRClient(settings=settings)

# Retrieve "Diabetes Examples" Value Set

search = vs.ValueSet.read('DiabetesExamples',smart.server)
print(search.description)

# How can do I use the other valueset classes to create a python list??


Last updated: Apr 12 2022 at 19:14 UTC