python HelloWorld: extension/element models

121 views
Skip to first unread message

p...@governmenthealth.info

unread,
Mar 20, 2016, 4:37:25 PM3/20/16
to SMART on FHIR
Hello Group:

I am a newb at python (v2.7/Mac OSX) and I just trying to get the simplest client to retrieve some data. I assume that I have some type of setup error:

So far I had to use easy_install to bring in “requests” and “isodate”. Then I found the offending line and the calling line in models/extension.py and models/element.py.

Now I am stuck on the source code and error below.

Thanks in advance for any pointer(s) or answers.

Regards..

—————————————————————————
Traceback (most recent call last):
  File "t0.py", line 8, in <module>
    import fhirclient.models.patient as p
  File "<mydir>/client-py-master/fhirclient/models/patient.py", line 8, in <module>
    from . import domainresource
  File "<mydir>/client-py-master/fhirclient/models/domainresource.py", line 8, in <module>
    from . import resource
  File "<mydir>/client-py-master/fhirclient/models/resource.py", line 8, in <module>
    from . import fhirabstractresource
  File "<mydir>/client-py-master/fhirclient/models/fhirabstractresource.py", line 186, in <module>
    from . import fhirelementfactory
  File "<mydir>/client-py-master/fhirclient/models/fhirelementfactory.py", line 7, in <module>
    from . import element
  File "<mydir>/client-py-master/fhirclient/models/element.py", line 41, in <module>
    from . import extension
  File "<mydir>/client-py-master/fhirclient/models/extension.py", line 8, in <module>
    from . import element
ImportError: cannot import name element

————————————————

from fhirclient import client
settings = {
    'app_id': 'my_web_app',
}
smart = client.FHIRClient(settings=settings)

import fhirclient.models.patient as p
patient = p.Patient.read('hca-pat-1', smart.server)
patient.birthDate.isostring
# '1963-06-12'
smart.human_name(patient.name[0])
# Christy Ebert

Pascal Pfiffner

unread,
Mar 21, 2016, 5:28:18 AM3/21/16
to SMART on FHIR
There indeed seems to be an issue with Python 2.7. It works fine with Python 3, so I'd advise to go that route until we fix the imports.


Pascal

Pascal Pfiffner

unread,
Mar 23, 2016, 11:02:15 AM3/23/16
to SMART on FHIR
Pushed the update to version 1.0.3 which makes the data models work with Python 2.7 again.
Reply all
Reply to author
Forward
0 new messages